eXTReMe Tracker
May 112011
 

For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception: the setup of xstartup in the ~/.vnc folder.

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

#—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

#————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

make sure restart vnc4server

The line which got Gnome working was “gnome-session &”

========================================

Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)

1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd

sudo apt-get install openssh-server openssh-client vnc4server xinetd vncviewer

2. Setup the ssh password for your login

ssh-keygen

3. Test out the ssh server by typing in

ssh localhost or ssh your_login@your_ip_address

4. Then create a vnc password

sudo vncpasswd ~/.vncpasswd

5. Edit the xstartup file in ~/.vnc directory

For your xstartup file in ~/.vnc (the “.vnc” folder in

your home directory), you need the following:

—————————–

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &

gnome-session &

# twm &

————————

instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session

6. Create a VNC desktop

vnc4server :1 -geometry 1024×768

7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:

ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress

8. Finally, load up your VNC desktop

vncviewer localhost:1

And now you are ready to use connect to your machine remotely and use administer the computer remotely.

P.S: If you are using a firewall (hardware or software, you need to get enable port forwarding and unblock ports 22 and 5900-5999 on the Ubuntu machine to allow SSH and VNC to be accessed.

May 112011
 

Running scripts in serial order on a multi-core machine will take quite a bit of time. If the tasks are repetitive, the command can be run under GNU Parallel.

You can install it on RPM or Debian based distribution from the GNU Parallel repository. Install the binary that fits your flavour of Linux. Please note that even though the latest release of GNU Parallel has a flavour of Linux associated with it, it runs on most of the older AND newer distributions. For instance I was able to install the April 21st 2011 release of amd_64 RPM on a RHEL5 machine, and it ran just fine for that 8 core machine.

After installation you can try it out on a sample directory by running:

ls -d */ | sed ‘s/\///g’ | parallel zip -r -q {}.zip {}

This will recursively zip all the directories within a given folder, in parallel. By default, it will use up the maximum number of cores, but you can check the man pages of parallel to check how to employ N number of processors to run the task in parallel.

ls *.jpg | parallel convert {} -resize 75% -quality 80% {}

If you have imagemagick installed, you could save a whole bunch of space by converting some of the high-res images to a slightly lower resolution. The above example will resize the images to 75% of their original size with 80% quality. The original images will be overwritten by the resize and downsampled ones. While this is running, you can fire up htop in another terminal window to watch all the processors working in parallel.