Dropbox in openSUSE 11.4 (KDE)

Today, I needed to use my «forgotten» Dropbox Account (which I had, but didn’t use).

First of all, you need a Dropbox Account, if you have none yet, get a free account here !
It is really easy to get it to work in openSUSE with KDE (for gnome there is a package called dropbox-nautilus), just type in a console:

sudo zypper in dropbox dropbox-servicemenu

Execute dropbox command:

The first time you execute it, the program will download the «proprietary daemon» (it’s an automatic process) and let you configure the necessary parameters to run the program.

After that, an icon should appear at your system tray:
dropbox tray icon

By clicking in that icon, you will get to the folder you previously configured to be synced.

Have fun!

Create a «Server Status» MOTD for openSUSE

In order to produce a «System Status» Message Of The Day (MOTD) file in openSUSE, a-la Ubuntu, you should write this script (as systemstats.sh) in /usr/local/bin

#!/bin/bash
#
# Server Status Script
# Version 0.1.3 m
# Updated: July 26th 2011 m

CPUTIME=$(ps -eo pcpu | awk ‘NR>1’ | awk ‘{tot=tot+$1} END {print tot}’)
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk ‘{ print $3 » » $4 }’)
echo »
****************************************************************************
System Status
Updated: `date`

– Server Name = `hostname`
– OS Version = `grep openSUSE /etc/SuSE-release`
– Load Averages = `cat /proc/loadavg | awk {‘print $1″ «$2» «$3’}`
– System Uptime = `uptime | awk {‘print $3» «$4’}`
– Platform Data = `uname -orpi| awk {‘print $1» «$4’}`
– CPU Usage (average) = `echo $CPUTIME / $CPUCORES | bc`%
– Memory free (real) = `free -m | head -n 2 | tail -n 1 | awk {‘print$4’}` Mb
– Memory free (cache) = `free -m | head -n 3 | tail -n 1 | awk {‘print$3’}` Mb
– Swap in use = `free -m | tail -n 1 | awk {‘print $3’}` Mb
– Disk Space Used = `df -h / | awk ‘{ a = $4 } END { print a }’`
****************************************************************************
» > /etc/motd

# End of Script

Remember to make it executable (as root or sudo)

chmod +x /usr/local/bin/systemstats.sh

To make the script update the information automatically, you should edit /etc/crontab as root, and add this two lines at the end of the file

# Status Script
*/5 * * * * root /usr/local/bin/systemstats.sh

After you update the /etc/motd file (by running as root /usr/local/bin/systemstats.sh), it should look like something like this:

david@virtual:~> cat /etc/motd

****************************************************************************
System Status
Updated: Thu Oct 20 01:55:01 CEST 2011

– Server Name = virtual
– OS Version = openSUSE 11.4 (x86_64)
– Load Averages = 0.00 0.01 0.05
– System Uptime = 2:22, 1
– Platform Data = 2.6.37.6-0.7-desktop GNU/Linux
– CPU Usage (average) = 0%
– Memory free (real) = 3667 Mb
– Memory free (cache) = 138 Mb
– Swap in use = 0 Mb
– Disk Space Used = 9.5G
****************************************************************************

Based on the information found in http://www.md3v.com/create-a-linux-server-status-motd

OpenKinect in openSUSE

After the release of the official Kinect SDK, by Microsoft, I decided to test the OpenKinect drivers for linux (as I already installed the official SDK in a Windows box).

The process is as exposed in the wiki installation guide , but it refers to Fedora/Ubuntu.

The whole procedure in opensuse is as follows:

  • Install build dependencies (I had most of them already installed):
    sudo zypper in cmake libusb-1_0-0 libusb-1_0-devel pkg-config freeglut freeglut-devel
  • Clone GIT repository (in a new directory if desired):
    git clone https://github.com/OpenKinect/libfreenect.git
  • Prepare the «build environment» :
    cd libfreenect/
    mkdir build
    cd build
    cmake ..
  • Install and link the libraries:
    make -j3
    sudo make install && sudo /sbin/ldconfig /usr/local/lib64/
  • Config the Kinect so it can be used as a normal user:
    • Create file : /etc/udev/rules.d/66-kinect.rules containing:

      #Rules for Kinect ####################################################
      SYSFS{idVendor}==»045e», SYSFS{idProduct}==»02ae», MODE=»0660″,GROUP=»video»
      SYSFS{idVendor}==»045e», SYSFS{idProduct}==»02ad», MODE=»0660″,GROUP=»video»
      SYSFS{idVendor}==»045e», SYSFS{idProduct}==»02b0″, MODE=»0660″,GROUP=»video»
      ### END #############################################################

    • Add your user to the group Video (mine was already in that group, just check it in YaST, for instance)
  • Test the Kinect:
    glview

It should now work and show you the depth view, as well as the normal one. If it doesn’t work, just unplug and plug again the device (mine didn’t work before doing so).

Congratulations, you have your Kinect working in your openSUSE box!

Here’s a screenshot of what you will see (it’s set to IR mode):
Image and video hosting by TinyPic

Thanks a lot to Marcan for the development of this project (the initial dev. and now with the open kinect team), and the whole community for keeping the good work 😉

Have fun!

LAMP+Glassfish server in openSUSE 11.4

After the openSUSE 11.4 release, I thought about deploying a home server, with web, database and application server (Glassfish in my case).

First of all, a standard text-based system installation has to be done, you can add the specific patterns during installation process, but I prefer to add specific repositories after installation, as I would like to program in Java and learn some other languages:

  • openSUSE 11.4 11.4-0 updates
  • BuildService de openSUSE – Databases
  • openSUSE BuildService – Java:packages
  • openSUSE BuildService – devel:languages:per
  • openSUSE BuildService- PHP
  • openSUSE BuildService – devel:languages:python
  • Main repository (Contrib)
  • openSUSE-11.4-11.4-0
  • Packman Repository
  • openSUSE-11.4-Debug
  • openSUSE-11.4-Update-Debug
  • openSUSE-11.4-Non-Oss
  • openSUSE-11.4-Oss
  • openSUSE-11.4-Source

After adding those repositories (from YaST, community repositories), a zypper dup operation was performed (so the system gets updated to the latest package versions, no matter in what repository are they stored)

Finally, some the command to finish the package installation: zypper in -t pattern lamp_server.

You have to open the ports the firewall ports in YaST (and configure apache server to start on system boot): yast2->net services -> http server -> enable http server+open firewall ports.

After the whole process is done, you should be able to see the «It works!» web page (default for an apache web server installation).

To install glassfish in the new server, you should type the following (as root):

# cd /opt/
# wget -c http://download.java.net/glassfish/3.1/release/glassfish-3.1-ml.zip
 
# unzip
# rm glassfish-3.1-ml.zip
 

Now you have to create the init.d scripts:

# vi /etc/init.d/glassfish

And copy this into the script:

#! /bin/sh
GLASSFISHPATH=/opt/glassfish3/glassfish/bin
case «$1» in
start)
echo «starting glassfish from $GLASSFISHPATH»
$GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo «stopping glassfish from $GLASSFISHPATH»
$GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo «usage: $0 {start|stop|restart}»
exit 3
;;
esac

You need to add permissions to new file (thanks to David Blanco):
#chmod a+x /etc/init.d/glassfish

You can now start the server by typing :

# /etc/init.d/glassfish start

And finally, access the server in the host url+port 4848

Have fun!