Archive for the ‘How-To’ Category

Tuesday, February 3rd, 2009

Want to know your bandwidth usage? Or who among your network peers are using most it. Then install network top (ntop), with it you can monitor your network bandwidth usage using pretty graphs (rrdtool). Ntop installs out-of-the-box through YaST (I’m assuming you have SUSE). Enough talking!

Here’s how to install it:

  1. Install ‘ntop’ using YaST. So dependencies will be included.
  2. After installation, time to set the admin’s password and the user ntop should run after it initializes.
    rawswift:~ # ntop -A -u wwwrun

    If you want to access ntop’s interface from any computer in your network then edit the ntop’s configuration file and change the localhost IP (127.0.0.1) to the host’s local network IP.

    • Open ntop configuration file (as root):
      rawswift:~ # vi /etc/sysconfig/ntop
    • Change ‘NTOPD_PORT’ value:
      • From: NTOPD_PORT=”127.0.0.1:3000″
      • To (host network IP): NTOPD_PORT=”xxx.xxx.xxx.xxx:3000″
    • Then save it!
  3. Now start ntop script
    rawswift:~ # /etc/init.d/ntop start

If you want ntop to start on boot time then enable it in the init process:

rawswift:~ # chkconfig ntop on

Open you web browser and in the address box put the ntop’s host address and port (3000). You’ll now be able to see the bandwidth monitoring:

rawswift:~ # links 127.0.0.1:3000

What I like about ntop is that is uses rrdtool to graph the bandwidth usage. Really useful in tracking who uses the most bandwidth.

And if you want to go extreme, install ettercap and use ARP poison to sniff all data frames on your local area network (LAN). But be careful with playing man-in-the-middle attack in a low end computers. It’ll definitely bog down you network.

Tuesday, January 27th, 2009

Here’s how to install VirtualBox on OpenSUSE 11.1:

  1. First, you’ll have to download the package from Sun’s website.
  2. Get the right package for your OS platform (32-bit or 64-bit). I had the mistake of installing the wrong package. You can check your platform by running ‘uname’ command with ‘-a’ (print all information) argument:
    ryan@rawswift:~/Desktop> uname -a
    Linux rawswift 2.6.27.7-9-default #1 SMP 2008-12-04 18:10:04 +0100 x86_64 x86_64 x86_64 GNU/Linux
    ryan@rawswift:~/Desktop>

    A 64-bit kernel will give you ‘x86_64 x86_64 x86_64′ and a 32-bit would show ‘i686 i686 i386′.

  3. After you’ve download the package, it time to install it:
    ryan@rawswift:~/Desktop> sudo rpm -i VirtualBox-2.1.2_41885_openSUSE111-1.x86_64.rpm
    Creating group 'vboxusers'. VM users must be member of that group!
    ryan@rawswift:~/Desktop>

That’s it! Now run ‘Sun xVM VirtualBox’ on your application menu or ‘VirtualBox’ on your shell. Enjoy!

Problems and fixes (especially on a 32-bit and OSE package)

  • VirtualBox’s library requirements. Install the following:
    pam-devel
    libqt2-32bit
    libqt4-x11-32bit
    SDL-32bit
    libxslt-32bit
  • After running VirtualBox, it doesn’t show up on screen. Run VirtualBox on shell:
    ryan@rawswift:~/Desktop> VirtualBox
    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
             available for the current kernel (2.6.27.7-9-default) or it failed to
             load. Please recompile the kernel module and install it by
    
               sudo /etc/init.d/vboxdrv setup
    
             You will not be able to start VMs until this problem is fixed.
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    If the above error appears, you should run ‘vboxdrv’ script to create the VirtualBox kernel module:

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 failed
      (Look at /var/log/vbox-install.log to find out what went wrong)
    ryan@rawswift:~/Desktop>

    If it fails to compile, install ‘kernel-source‘ through YaST. Then run ‘/etc/init.d/vboxdrv setup’ again.

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 done
    Starting VirtualBox kernel module                                    done
    ryan@rawswift:~/Desktop>
  • Permission denied:
    ryan@rawswift:~/Desktop> VirtualBox
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    Run ‘chmod’ on ‘VirtualBox’. This will set the execute bit:

    sudo chmod +x /usr/lib/virtualbox/VirtualBox
  • Driver mismatch. If an error box appear when you ‘Start’ a virtual machine:
    The VirtualBox support driver which is running is from a different version of VirtualBox.
    You can correct this by stopping all running instances of VirtualBox and reinstalling the software.
    (VERR_VM_DRIVER_VERSION_MISMATCH).
    
    Result Code:	NS_ERROR_FAILURE (0x80004005)
    Component:	Console
    Interface:	IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}

    Check your VirtualBox package platform (64-bit or 32-bit, see the tutorial above).

Saturday, January 24th, 2009

I’ve experience a problem with Brasero. After a fresh intall of OpenSUSE 11.1, I tried to burn an ISO using Brasero, I had no problem with it on my previous install or so I think. When I try to burn, it couldn’t detect my DVD drive: “No available medium” but the DVD disc are properly placed inside the tray. Anyway I’ll be post here the quick fix I did to get it working:

Here’s it is:

  1. Open YaST
  2. Go to ‘Security and Users
  3. Click ‘User and Group Management
  4. Edit your profile
  5. Go to ‘Details‘ tab
  6. Then on the ‘Additional Groups‘, check the ‘cdrom
  7. Click ‘Ok‘ to save setting

Now open Brasero and start burning!

Note: If Brasero still can’t detect your DVD drive, restart your system this would fix it.

Friday, January 23rd, 2009

After the installation, The first thing I do is to remove those icons because first, I don’t use it and second, I like my desktop clean.

Here’s how you can remove the “Online Help” and “openSUSE” icon on Gnome desktop:

As root, change directory to ‘/usr/share/dist/desktop-files/’ then delete or move this files:

  • GnomeOnlineHelp.desktop
  • SuSE.desktop

Remove

rawswift:/ # cd /usr/share/dist/desktop-files/
rawswift:/usr/share/dist/desktop-files # rm *

Move

rawswift:/ # cd /usr/share/dist/desktop-files/
rawswift:/usr/share/dist/desktop-files # mv * /to/backup/folder/.

After you remove or move it, notice that the two icons will automatically disappear on the desktop (must be a daemon, run by Nautilus Greeter Application, ‘ggreeter’).

I hope this helps!

Update!

I just found out about this! While I was removing applications on session startup, I’ve noticed an entry named ‘SUSE’ that run an application called ‘ggreeter’. I’m not really sure if removing it will disable those icons, anyway I continue on and disable that entry. The name just gave me a hint and so far I haven’t encountered any problem. Here’s how to disable it:

  1. Open the ‘Control Center
  2. Click ‘Sessions‘ under ‘System‘ category
  3. On ‘Startup Programs‘, uncheck ‘SUSE
  4. Then click ‘Close‘ button

What ‘SUSE’ does is run ‘ggreeter –once’ on startup, must be a daemon.

Wednesday, August 13th, 2008

I keep on forgetting this SQL query. So I decided to put it here as a reference:

CREATE TABLE testtbl (
   id int AUTO_INCREMENT,
   created_on TIMESTAMP DEFAULT 0,
   updated_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON
                    UPDATE CURRENT_TIMESTAMP,
   first_name varchar(25),
   last_name varchar(25),
   primary key(id)
);
Wednesday, August 13th, 2008

This command can be handy. Let say you want to archive your project from the repository and you don’t want to include the ‘.svn‘ directories.

First, checkout your project from the repository:

svn co http://myproject.domain.org/svn/trunk/ myproject-dir

Second, remove the .svn directories:

rm -rf `find myproject-dir -type d -name .svn`

Then archive it using tar command:

tar -cvzf myproject_archive.tgz myproject-dir

…and there you have it!