Archive for the ‘Programming’ Category

Create a Git repository in an openSUSE box

First of all, you should install the package git-core, provided in the update repository.

You can get the package by using a 1-click link or typing in a terminal:

su -c 'zypper in git-core'

After Zypper ends installing git, we can start preparing the environment:

  1. Create the repository folder.mkdir repo_folder
  2. Enter that folder by typing cd repo_folder.
  3. Init the empty git repo git --bare init
  4. Add some files to the folder, and add them to the repository git add *
  5. Lets do the first commit! git commit -m 'First Repo commit'
  6. If you want to get some project source, you should enter git clone url_to_git_repo

And you have your repository working (locally).

Next step: connect it to the world! (in a future post 😉 )

Have a lot of fun!

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!

Return top

INFORMATION

I am a Management Engineering student, continuing my education after getting my Computer Bachelor's degree. I usually program for Android devices, although I have no apps. in Android Market yet.
 
Sharing Buttons by Linksku