Using VNC Server on CentOS with Windows VNC Viewer

Virtual Network Computing (VNC) allows user to have access to remote GUI console. For CentOS, the vncserver comes installed.


Step 1: Starting a  VNC Session on Vncserver

Step 1a: Remember to turn on the services by issuing the commands
# service vncserver start


Step 1b: Enter the VNC Password
# vncpasswd
(Type and confirm the password)


Step 1c: Test the VncServer
# vncserver

New 'xxx.yourserverdomain.com:2 (root)' desktop is xxx.yourserverdomain.com:2
Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/xxx.yourserverdomain.com:2.log


Step 2 - Connecting to VNC session using VN Client 

Step 2: Use an TightVNC or RealVNC for the Client


Step 2a: Type into the VNC Clients the VNC Server connection
xxx.yourdomainserver.com:2

You have your connection.........


Step 3 - Changing default Windows Manager to Gnome Session
(Change the default twm windows )
# vim ~/.vnc/xstartup

# Type the following at your xstartup:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &


Step 4: How to kill VNC Server Connection
At the VNCServer,
# vncserver -kill :2