Work behind proxy with subversion

Uncategorized No Comments

To checkout (or perform any other svn command) svn content from repository outside the proxy, modify ther servers file:

  • Linux/Mac OS X:

    [html]
    vi ~/.subversion/servers
  • Window 7/Window Server 2008:

    [html]
    cd %USERPROFILE%\AppData\Roaming\Subversion
    start servers

By uncommenting the following line and add your detail

[html]
http-proxy-host = your.proxy.com
http-proxy-port = 8000
http-proxy-username = defaultusername
http-proxy-password = defaultpassword

Install Apache2, Php5 and MySql on Ubuntu 9.10

MySql, PHP, Ubuntu/Linux No Comments

Step 1. List of libraries needed for Apache2, Php5 and MySql for Ubuntu:

[html]
apt-get update
apt-get install  apache2 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql php5

Step 2. Turn on php module to work with Apache:

[html]
a2enmod php5

Step 3. If you have .phtml or .pl file, remember to add to the follwing line to apache configuration file (/etc/apache2/apache2.conf):

[html]
AddType application/x-httpd-php .php .phtml

Step 4. Restart apache:

[html]
/etc/init.d/apache2 restart

Useful Link:

  • http://ubuntuforums.org/showthread.php?t=277819
  • http://ubuntuforums.org/showthread.php?t=479194&page=2

iFolder Client on Ubuntu 9.10

Ubuntu/Linux No Comments

Installing ifolder client in Ubuntu 9.10:

  • Step 1. Add source list to aptitude by:
    [html]
    sudo add-apt-repository ppa:marceloshima/ppa

    or manually add the following lines to /etc/apt/sources.list:

    [html]
    deb http://ppa.launchpad.net/marceloshima/ppa/ubuntu karmic main
    deb-src http://ppa.launchpad.net/marceloshima/ppa/ubuntu karmic main
  • Step 2. Update aptitude to get the latest list of software:
  • [html]
    sudo apt-get update
  • Step 3. Install ifolder3
    [html]
    sudo apt-get install ifolder3
  • Step 4. Modify /usr/bin/ifolder file by chaging:
    [html]
    cd /usr

    to

    [html]
    cd /usr/bin
  • Step 5. Run ifolder (it won’t be run automatically for ubuntu) by typing:
    [html]
    ifolder
  • Step 6. Fill in your ifolder server information and you are ready to go!

Useful links:

  • https://edge.launchpad.net/~marceloshima/+archive/ppa
  • http://www.x2b4.com/howto/how-to-install-ifolder-on-ubuntu-server/

Setting up Nagios 3 in Ubuntu 9.04 Jaunty + forward notification using postfix

ICE, Open Office, The Fascinator Desktop, Ubuntu/Linux, eResearch 7 Comments

Since The Fascinator Desktop 0.1 Release, #tf4desktop, we need to make sure ICE service and OpenOffice are running in the server to support the conversion sent thru The Fascinator Desktop.

I managed to setup Nagios in ICE server to watch ICE and OpenOffice process and when ICE or OpenOffice or even server are down, notification email will be sent to the developer team. I wrote the installation and configuration instruction below on setting up nagios in ubuntu:

Step 1: Installing Apache and other libraries

  • Install required library before installing nagios3
    [html]
    sudo -s apt-get install libgd2-xpm-dev build-essential apache2
  • Configure Apache if you want apache to listen to other port (by default, apache is listening to port 80)
    [html]
    gedit /etc/apache2/ports.conf
  • Change the Listen port number, apache is listening to port 85 in the below example:
    [html]
    NameVirtualHost *:80
    Listen 85
    <IfModule mod_ssl.c>
              # SSL name based virtual hosts are not yet supported, therefore no
              # NameVirtualHost statement here
              Listen 443
    </IfModule>
  • Restart apache:
    [html]
    /etc/init.d/apache2 restart
  • Check if Apache is running: http://localhost or http://localhost:85 (if you change the port number)

Step 2: Nagios 3

  • Creating user for nagios

    [html]
    /usr/sbin/useradd nagios
    passwd nagios
  • Creating group for nagios user
    [html]
    /usr/sbin/usermod -G nagios nagios
    /usr/sbin/groupadd nagcmd
    /usr/sbin/usermod -G nagcmd nagios
    /usr/sbin/usermod -G nagcmd www-data
  • Download nagios
    [html]
    cd /tmp
    wget http://freefr.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
  • Untar and compile
    [html]
    tar zxvf nagios-3.0.6.tar.gz
    cd nagios-3.0.6
    ./configure --with-command-group=nagcmd
    make all
    make install
    make install-init
    make install-config
    make install-commandmode
    make install-webconf
  • Get the nagios plugin
    [html]
    cd /tmp
    wget http://freefr.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
  • Untar and compile
    [html]
    tar zxvf nagios-plugins-1.4.13.tar.gz
    cd nagios-plugins-1.4.13
    ./configure --with-nagios-user=nagios --with-nagios-group=nagios
    make
    make install
  • Make sure nagios is running every time system started.
    [html]
    ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
  • Configure contact for nagios
    [html]
    gedit /usr/local/nagios/etc/objects/contacts.cfg

    Put the contact information:

    [html]
    define contact{
            contact_name                    nagiosadmin     ; Short name of user
        use             generic-contact     ; Inherit default values from generic-contact template (defined above)
            alias                           Nagios Admin        ; Full name of user

            email                           me@gmail.com            ; Email where the notification will be forwarded to
        host_notifications_enabled  1                       ; Enable host notification
        service_notifications_enabled   1                       ; Enable service notification
        service_notification_period 24x7                    ; Period of notification
        host_notification_period    24x7                    ; Period of notification
        service_notification_options    w,u,c,r                 ; Notify if service: w: warning; u: unreachable; c: critical; r: recovered
        host_notification_options   d,u,r                   ; Notify if host: d: down; u: unreachable; r: recovered
        service_notification_commands   notify-service-by-email ; Service notification command
        host_notification_commands  notify-host-by-email    ; Host notification command
        can_submit_commands     1                       ; Enable allow command submission
            }
  • If you would like to add new command or edit existing command such as “notify-service-by-email” or “notify-host-by-email”, you can do it through:
    [html]
    gedit /usr/local/nagios/etc/objects/command.cfg

    Below are example of adding new command to check if OpenOffice is still running in port 2002:

    [html]
    # 'check_tcp_local' command definition
    define command{
            command_name    check_tcp_local
            command_line    $USER1$/check_tcp -p $ARG1$ $ARG2$
            }
  • Configure nagios host
    [html]
    gedit /usr/local/nagios/etc/objects/localhost.cfg

    Configuration:

    [html]
    define host{
            use                     linux-server            ; Name of host template to use
                                                            ; This host definition will inherit all variables that are defined
                                                            ; in (or inherited by) the linux-server host template definition.
            host_name               localhost
            alias                   localhost
            address                 XX.XXX.XXX.XXX          ; IP address of the host where the nagios is going to watched
            }
  • Adding Services to be watched. (below are the example how nagios watching ICE and Openoffice)
    [html]
    gedit /usr/local/nagios/etc/objects/localhost.cfg

    Adding new services at the end of the localhost.cfg file:

    [html]
    define service{
            use                             local-service         ; Name of service template to use
            host_name                       localhost             ; Must be the same as the host_name define on the top
            service_description             ICE running           ; Name of the new service
            check_command                   check_tcp!80          ; ICE is running in port 80, so we use check_tcp command to check if ICE is still running
            check_interval                  60                    ; Checking interval 60 minutes
            check_period                    24x7                  ; Allow 24x7 checking
            retry_interval                  3                     ; Trying for three times
            max_check_attempts              3                     ; Maximum trying attempt
            notification_interval           60                    ; Notify admin every 60 minutes if ICE service is still not running
            notification_period             24x7                  ; Enable notification for 24x7
            notification_options            w,c,u                 ; Notify if: w: warning; c: critical; u: unreachable
            contact_groups                  admins                ; Notify admins group
            }

    define service{
            use                             local-service         ; Name of service template to use
            host_name                       localhost             ; Must be the same as the host_name define on the top
            service_description             Open Office running   ; Name of the new service
            check_command                   check_tcp_local!2002  ; OpenOffice is running in port 2002, so we use check_tcp_local command to check if OpenOffice is still running
            check_interval                  60                    ; Checking interval 60 minutes
            check_period                    24x7                  ; Allow 24x7 checking
            retry_interval                  3                     ; Trying for three times
            max_check_attempts              3                     ; Maximum trying attempt
            notification_interval           60                    ; Notify admin every 60 minutes if ICE service is still not running
            notification_period             24x7                  ; Enable notification for 24x7
            notification_options            w,c,u                 ; Notify if: w: warning; c: critical; u: unreachable
            contact_groups                  admins                ; Notify admins group
            }

    NOTE: if the SSH and HTTP are not enabled in the host, comment out the service configuration from localhost.cfg

    [html]
    #define service{
    #        use                             local-service         ; Name of service template to use
    #        host_name                       localhost
    #        service_description             SSH
    #        check_command                   check_ssh
    #        notifications_enabled           0
    #        }

    #define service{
    #        use                             local-service         ; Name of service template to use
    #        host_name                       localhost
    #        service_description             HTTP
    #        check_command                   check_http
    #        notifications_enabled           0
    #        }
  • Before you start up Nagios, make sure there are no errors with the command. (This need to be done everytime the configuration files has been modified)
    [html]
    /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  • Restart apache & nagios
    [html]
    /etc/init.d/apache2 restart
    /etc/init.d/nagios start
  • Check if nagios has started
    [html]
    /etc/init.d/nagios status
  • Nagios from web (Assume that apache listening port is 85). Log in using username nagiosadmin and password for nagiosadmin
    http://localhost:85/nagios
  • To see nagios log:
    [html]
    tail -f /usr/local/nagios/var/nagios.log &

Step 3: Postfix to send outgoing mail

  • Install postfix

    [html]
          apt-get install postfix
  • Configure postfix
    [html]
          dpkg-reconfigure postfix

    Configuration:

    • General type of mail configuration: Internet Site
    • System mail name: e.g. smtp.gmail.com
    • Root and postmaster mail recipeint: e.g. me@gmail.com
    • Other destinations to accept mail for (blank for none): use the default value
    • Force synchronous updates on mail queue?: Yes
    • Local networks: Use default: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    • Mailbox isze limit (bytes): 0 (default)
    • Local address extension character: + (default)
    • Internet protocols to use: all (default)
  • Do some testing using mailx:
    [html]
    sudo apt-get install mailx
    echo test |mail -s "test mail sent to external" me@gmail.com
    echo test |mail -s "test mail sent to normal user" <normal user name>
    echo test |mail -s "test mail sent to root" root
  • To forward email to me@gmail.com (change to your email address)
    [html]
          echo me@gmail.com > ~/.forward

Add java path to Eclipse (Mac/Ubuntu)

Eclipse, Mac OS, Ubuntu/Linux 1 Comment

Sometimes when you have more than one version of java running in your computer, Eclipse will get confuse and will not run properly especially when your JAVA_HOME is set to the java version that Eclipse does not like (sound like human).

To add java version to Eclipse:

  1. Exit your eclipse
  2. Locate your eclipse.ini file in eclipse folder. If you can’t find it, you can use locate command below:
    [html]
    lindaoctalina$ locate eclipse.ini
    /Users/lindaoctalina/eclipse_folder/eclipse3.4.1/Eclipse.app/Contents/MacOS/eclipse.ini
  3. Open and edit eclipse.ini and add “-vm” and your java home before “-vmargs”:
    * Mac

    [html]
    -vm
    /System/Library/Frameworks/JavaVM.framework/Home

    * Ubuntu

    [html]
    -vm
    /usr/lib/jvm/java-6-sun
  4. Start up your eclipse again ;)

Thanks to Oliver for helping me out

Removing unwanted workspace from eclipse

Eclipse No Comments

After removing the workspace from the filesystem, the “removed” workspace will still appear when Eclipse is started. Thus, when you click on this workspace, an empty directory will be recreated in the filesystem.

To totally remove the workspace from Eclipse workspace list after you remove the workspace folder from the filesystem:

  1. close your eclipse
  2. Locate org.eclipse.ui.ide.prefs file in your ECLIPSE_HOME/configuration/.settings folder and remove unwanted workspace from “RECENT_WORKSPACES” list. *beware of the “\n” ;) *
  3. start your eclipse again and your “removed” workspace should not be in the workspace list

Linux-FS Watcher for The Fascinator Desktop (Updated)

Firefox, The Fascinator Desktop, Ubuntu/Linux, eResearch, xhtml, xml No Comments

Recently I am involved in The Fascinator Desktop project. Peter Sefton is updated the detail workflow of this project: Desktop Repositories: Smashing up Power point. Part of my involvement is to develop filesystem watcher (Linux and Mac OS watcher).

The Linux FS watcher can be checked-out from http://fascinator.usq.edu.au/svn-auth/code/watcher/tags/0.1. This is a standalone program, thus you can use it directly to monitory your filesystem. The whole application is developed in python.

Dependencies before you run the Linux FS watcher:

  • pyinotify: Note for Ubuntu users: Try to download the pyinotify directly from http://trac.dbzteam.org/pyinotify instead of using ubuntu pyinotify package. And if you have any issue with this library, you can ask for help directly from the website, the support teams are very helpful. I had the issue with renaming a directory once, and their responses are quick! Refer to: http://trac.dbzteam.org/pyinotify/ticket/20.
  • sqlite: This library should be pre-shipped with your ubuntu, if not, you can directly get the package from the package manager. sqlite is used to store all the events happened within the watched directory. The table for the event consists of filePath, event (file deletion or modification), and timestamp when the event is invoked.
  • foresite: (Won’t be needed anymore since it return JSON file instead of atom feed) Download from http://code.google.com/p/foresite-toolkit/. This library is used to generate atom feed requested through web service to provide the list of events stored in the sqlite.

To run the program, go to the watcher directory after you checked-out the code:

  • Modify the config.json configuration file, change the watchDirs to the directory you want to watch. Make sure it’s exist, and try not to watch your home directory. (I have not developed any code to ignore the python object file, thus, when you watch your home directory, your watcher program object file will be added to the database).
    [html]
        "watchDirs" : ["/home/octalina/workspace/watcher/someDir", "/home/octalina/workspace/watcher/modeDir"],

    If you want to run the watcher as a daemon, change the daemon value to True.

    [html]
           "daemon" : "True"
  • Change to app directory and run watcher:
    [html]
           python watcher.py
  • To run the webservice, open another terminal tab and run:
    [html]
           python jsonWebservice.py

To try get the the list of file changes can be done using curl/wget:

[html]
curl localhost:9000

or if date range is specified:

[html]
curl localhost:9000 -H "Last-Modified: Wed, 17 Jun 2009 18:38:12 GMT"

PySvn in Ubuntu and Mac

Subversion, Ubuntu/Linux No Comments

My main intention of building Subversion 1.5.1 is for PySvn 1.6.0 because it needs at least subversion 1.5.0.
Download source package from: https://launchpad.net/ubuntu/+source/pysvn/1.6.0-1.

* Untar the pysvn_1.6.0.orig.tar.gz into pysvn_1.6.0 directory
* Move to the Source directory:

[html]
octalina@desktop:~$ cd pysvn_1.6.0/Source

* Make sure subversion is installed
* Create the makefile:

[html]
octalina@desktop:~$ python setup.py configure
Info: Found Python include in /usr/include/python2.5
Info: Found  PyCXX include in /home/octalina/pysvn-1.6.0/Import/pycxx-5.4.1
Info: Found   PyCXX Source in /home/octalina/pysvn-1.6.0/Import/pycxx-5.4.1/Src
Info: Found    SVN include in /usr/local/include/subversion-1
Info: Found    APR include in /usr/local/apr/include/apr-1
Info: Found    SVN library in /usr/local/lib
Info: Found    APR library in /usr/local/apr/lib
Info: Creating Makefile for Source
Info: Building against SVN 1.5.1
Info: Creating Makefile for Tests

* compile the source code:

[html]
make

* Install pysvn by copying the extension from pysvn_1.6.0/Source.pysvn to python site-specific directory. e.g. normally Python 2.5 will be installed in /usr/lib/Python2.5

[html]
mkdir python-libdir/site-packages/pysvn
cp pysvn/__init__.py python-libdir/site-packages/pysvn
cp pysvn/_pysvn*.so python-libdir/site-packages/pysvn

Test on pysvn installtion:

[html]
octalina@octalina-desktop:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysvn
>>>

Dual Monitor in Ubuntu Hardy

Ubuntu/Linux No Comments

It’s really painful to get dual monitor done in Ubuntu (Hardy). I have tried so many ways to get my dual monitor works. Although I am a programmer, I am totally dumb in hardware like graphic card, system model or monitor type. And even my Ubuntu knowledge is intermediate for the software part, I do not know how to check my all those hardware stuffs from the system.

My first task is to identify the graphic driver ships with my PC.

[html]
octalina@desktop:~$ lspci -nn | grep VGA
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Radeon HD 2400 XT [1002:94c1]

Well, my first way is to install proprietary driver that I can get from ‘System->Administration->Hardware Drivers’. I *forget* to write down the driver name. But this driver slow down my computer and when I use ‘top’ command to show the process, ‘xorg’ takes up too much memory.

So second way is to get the correct driver and install it manually which can be found in Ubuntu forum and choose “ATI-only BigDesktop” driver. I follow the step for “ATI-only BigDesktop” by modifying my /etc/X11/xorg.conf (remember to back up /etc/X11/xorg.conf before performing any modification). After the process was done, I restarted my computer. Instead of loading login page, I get black screen instead. It’s only one way to recover by putting back the original xorg.conf file. After the second way fail, I thought I used the wrong driver, so I repeat the step again but using the ‘MergedFB‘ driver instead. Well, no luck, I get the same black screen.

Few days with only single monitor, I could not do my work efficiently. So I continued search for the correct way to setup my dual monitor. There is instruction for Ubuntu (Hardy) found in Ubuntu forum, but I use the “Instructions for Kubuntu 7.04 (Feisty)” instead because I want to use “fglrx-control” ATI accelerated graphic driver controller interface to configure my dual monitors.

So:
* Install linux-restricted-modules from the restricted repositories:

[html]
sudo apt-get update
sudo apt-get install linux-restricted-modules-generic

* Install the driver provided by ati included in the repositories:

[html]
sudo apt-get update
sudo apt-get install xorg-driver-fglrx

* Install the control panel for the graphic card. Although I see lots of forum stated that this control panel is buggy, but it works fine with me.

[html]
sudo apt-get install fglrx-control

The above control panel is located at “Other->ATI Catalyst Control Center”, this control panel will detect your monitor type and the graphic card you are using (which again I am dumb with this).

Display Manager

Choose monitor 1 and click on the display Modes tab. From here, you can choose to have your monitor cloned or use big desktop to widen the monitor.


Display Mode

Then lastly click on “Apply button”, you will be logged out from ubuntu with dual screen.

Dual Monitor in Ubuntu Intrepid Ibex

After Upgraded to Ubuntu 8.10 Intrepid Ibex, I thought that I can use the above instruction. However, the fglrx-control is not available for Ibex, it has been replaced with fglrx-amdcccle.

After installing fglrx-amdcccle, before using it, you need to activate the ATI Graphics Drivers from System->Administration->Hardware Drivers. Select the ATI/AMD proprietary FGLRX graphics driver and Activate it. You need to restart your computer.

Configure dual monitor can be done through command line by typing:

[html]
 sudo  aticonfig --initial=dual-head --screen-layout=above

Another way of configuring dual monitor is using the GUI from ATI Catalyst Control Center (the same as the configuration of the above Ubuntu Hardy). This Control center can be found in Applications->Accessories->ATI Catalyst Control Center.

Note: Another restart required after configuring to dual monitor mode.

Have fun

Have fun

Getting iso image from CD

Mac OS, Ubuntu/Linux No Comments

After completed Frozen Throne, I wanted to play Warcraft III from my Mac. My friends gave me the Frozen Throne .iso image which enable me to run without cd. Although I have Warcraft installed in my Mac, I do not have the .iso image for Warcraft III. I am too lazy to insert and eject the cd too as I play it regularly. I can’t just keep the cd by myself as I am sharing it with my house mate. So time to learn to create cd image file (This should work the same way as Linux/Ubuntu).

So after I put in the cd, when I type ‘mount’ command, I will have this:

[html]
lindaoctalina$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local)
fdesc on /dev (fdesc, union)
map -hosts on /net (autofs, automounted)
map auto_home on /home (autofs, automounted)
/dev/disk1s1s2 on /Volumes/Warcraft III (hfs, local, nodev, nosuid, read-only, noowners)

The last line of the above code is for my Warcraft III cd drive. I need to ‘umount’ the cd before I can process the iso file. (Note: You might need to use root/sudo user)

[html]
lindaoctalina$ sudo umount /dev/disk1s1s2

Then start to create the iso image:

[html]
lindaoctalina$ dd if=/dev/disk1s1 of=warcraft3.iso bs=1k

The process of dd command is to copy the file to the harddisk, convert it and format the file. For the ‘if=/dev/disk1s1′ means that read from cd room instead of stdout and ‘of=warcraft3.iso’ means that copy to local harddisk with the name of warcraft3.iso. ‘bs’ is to specified the number of blocks per bytes (can have kB, MB, etc)

You need to wait for few minutes to let the image file being created, then you will get the following code:

[html]
687548+0 records in
687548+0 records out
704049152 bytes transferred in 540.453743 secs (1302700 bytes/sec)

After finish, remember to eject the cd. As it is not mounted, we need to do manually (in Mac can use disk utility to eject the disk). Use below code to eject manually from terminal:

[html]
eject /dev/disk1s1

Note: it works for any application that requires CD and not only Warcraft III and Starcraft.

« Previous Entries