Wednesday, November 28, 2012

How to Install and Configure VNC Server on CentOS 5


In the name of Allah, Most Gracious, Most Merciful.
 

In this article I will describe the Installation and Configuration of VNC Server on CentOS 5. First you need to check for already installed VNC Server. You can check this by executing following command.


rpm -q vnc-server


If you found message like  "package vnc-server is not installe" then you need to install it first by executing following command from root user.

yum install vnc-server

Once VNC Server installed you need to have a window manager installed if not already available. execute following command to install 'GNOME Desktop Environment' from root user.

yum groupinstall "GNOME Desktop Environment"

Figure - 1

Figure - 2





Figure - 3

Now change the configuration of VNC Server's configuration file

cd /etc/sysconfig
vi vncservers

Figure -4
add following lines to the file. change anyusername to your already created username.

VNCSERVERS="1:anyusername"
VNCSERVERARGS[1]="-geometry 1024x768"

Figure - 5

now login to "anyusername" and configure the vnc password for this user

vncpasswd

Figure - 6



Now login with root user and start the "vnc server"

/sbin/service vncserver start

Figure -7
Now stop the vnc server

/sbin/service vncserver stop

Configure the vnc server for autostartup

/sbin/chkconfig vncserver on

Figure - 8

Now login to "anyusername"

su - anyusername
cd .vnc
vi xstartup

Figure - 9

uncomment following lines by deleting "#" sign

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

and change the xterm command as follows

xterm -geometry 1024x768 -ls -title "&VNCDESKTOP Desktop" & gnome-session &

Figure - 10

now start the vnc server again by root user

/sbin/service vncserver start

Once started you can now install the vnc client in you client machine and login to CentOs machine as follows


Figure - 11

Click Connect.
 

Figure - 12

Provide VNC password for user and click OK
 
Figure - 13
 
Desktop screen appreas.

Installation and Configuration of VNC Server completes. Insha-Allah this will help and serve the purpose. For any corrections and improvements please suggest.