How to install VNC server on CentOS 6

When we install the minimal copy of CentOS Server, it only gives us the “Command Line” interface.But some people prefer GUI instead and for this they install Full version of Gnome on CentOS. Actually there is a better way and that is to install VNC. VNC provides a lightweight virtual desktop than full blown version of Gnome.

To run the VNC Server on CentOS, we have to install these required packages:
sudo yum groupinstall Desktop
sudo yum install tigervnc-server
sudo yum install xorg-x11-fonts-Type1
To start VNC Server on boot

sudo chkconfig vncserver on
To setup users’ VNC password:
vncpasswd
Edit the /etc/sysconfig/vncservers file:
sudo vi /etc/sysconfig/vncservers
Add the following to the end of the file:
VNCSERVERS="1:USERNAME"
VNCSERVERARGS[1] ="-geometry 1024x768"

The iptables rules need to be amended to open the VNC ports:
sudo iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
sudo service iptables save
sudo service iptables restart

Restart the VNC Server:
sudo service vncserver restart
Now kill the VNC Server:
vncserver -kill :1
Edit the xstartup file in .vnc directory:
vi .vnc/xstartup
Comment the last line and run the Gnome:
#twm &
exec gnome-session &

Restart the service:
sudo service vncserver restart

Related Posts:

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>