Archive for June, 2010

Installing Vnc Server on Linux Machine without monitor

Vnc Installation Without Monitor

Packages Required :

1.vnc

2.vnc-server

3.Desktop Environment KDE or GNOME

Configuring VNC :

1. Add users like normal users.

2. login to each users

3. create password by running vncpasswd

4. It creates .vnc folder

5. Edit /etc/sysconfig/vncservers, and add the following to end of the file

VNCSERVERS="1:amitn 2:someuser"

VNCSRVERARGS[1]="-geometry 640×480"  ( for amitn )

VNCSRVERARGS[2]="-geometry 640×480"  ( for someuser)

VNCSRVERARGS[1]="-geometry 800×600"

6.Create Xstartup scripts by starting and stopping vncserver as root

/sbin/service vncserver start

/sbin/service vncserver stop

7. Login to each user and edit xstartup script

8. vi .vnc/xstartup

#!/bin/sh

# Add the following line to ensure you always have an xterm available.

( while true ; do xterm ; done ) &

# 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" & startkde &

Using Rsync to Syncronise files between servers

Rsync is a nice utility to synchronize files and folders between two servers securely and efficiently. It only copies the difference so making the process much faster and efficient.

Ok, here i will show you how to setup rsync.

1. Download the rsync package. Click Here

2. Untar the package and enter into the directory.

3. ./configure

4. make

5. Make install

6. Create the configuration file for rsync

#vi /etc/rsyncd.conf

#/etc/rsyncd.conf
secrets file = /etc/rsyncd.secrets
motd file = /etc/rsyncd.motd #Below are actually defaults, but to be on the safe side...
read only = yes
list = yes
uid = nobody
gid = nobody

[out]
comment = comment for your directory
path = /home/rsync/out

[confidential]
comment = For your eyes only
path = /home/rsync/secret-out
auth users = amit,nishant
hosts allow = 192.168.100.100
hosts deny = *
list = false

#save the file.

Now create a script for starting and stopping the daemon :

#vi /etc/init.d/rsyncd

#!/bin/sh
# Rsyncd This shell script takes care of starting and stopping the rsync daemon
# description: Rsync is an awesome replication tool.

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /usr/bin/rsync ] || exit 0

case "$1" in
start)
action "Starting rsyncd: " /usr/bin/rsync --daemon
;;
stop)
action "Stopping rsyncd: " killall rsync
;;
*)
echo "Usage: rsyncd {start|stop}"
exit 1
esac
exit 0

# Now create a symbolic link at /etc/rc.d/rc3.d

#cd /etc/rc.d/rc3.d

#ln -s /etc/init.d/rsyncd rsyncd

Now start rsyncd at the server side

#service rsyncd start

You can issue this command to copy the files :

rsync -avz amit@server name or ip::out /home/rsync/in

or you can use the following command to use ssh

rsync -avz -e ssh rsync@server_ip:/home/rsync/out/ /home/rsync/from_remote

Now you can set this up in a cron.