Wednesday, July 29, 2009

Configure VNC Server for Remote Desktop

Step1: Get packages for VNC

The server package is called 'vnc-server'. If the server is not installed, install it
#yum install vnc-server
The client program is 'vnc'. If is not installed, install it.
#yum install vnc

Step2: Create a user who can use VNC

#useradd zooz
Step3: Set password for VNC user
Logon as each user and create password for each user. This will create .vnc directory
# vncpasswd

Step4: Create xstartup scripts

We will create the xstartup scripts by running vncserver as root
# vncserver
This will start first vnc server instance ( We can run multiple vnc instances #vncserver :2 #vncserver :3 etc)
# vi .vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Step5:Modify etc/sysconfig/vncservers

#vi /etc/sysconfig/vncservers
Add the vnc server entries
VNCSERVERS="1:root 2:zooz"
VNCSERVERARGS[1]="-geometry 1280x1024"
VNCSERVERARGS[2]="-geometry 1280x1024"

Step6: Configure VNC Server to start automatically on restart

#chkconfig vncserver on 345
# service vncserver restart


Cool , Its ready!!! We can now connect to the server; just install vnc client and access with any of the vnc server instances
Servername:1
Servername:2