#To run the VNC Server on CentOS, we have to install these required packages:
sudo yum groupinstall Desktop
sudo yum install tigervnc-server
#To start VNC Server on boot
sudo chkconfig vncserver on
#To setup users’ VNC password:
vncpasswd
#Edit the /etc/sysconfig/vncservers file:
sudo nano /etc/sysconfig/vncservers
#Add the following to the end of the file:
VNCSERVERS=”1:shree”
VNCSERVERARGS[1]=”-geometry 1024×600″
#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