Reference: https://rbgeek.wordpress.com/2012/06/26/how-to-install-vnc-server-on-centos-6/
VNC is a protocol, that's used to share, the desktop with other users/computers over the network/internet.in order to share A desktop, VNC server must is install and configure on the computer and VNC client must is run on the computer that would Access the shared desktop.
When we install the minimal copy of the CentOS Server, it is gives us the "Command line" interface.
But the some people prefer GUI instead and for this they the install full version of Gnome on CentOS. Actually there is a better-of-the-and that's to install VNC. VNC provides a lightweight virtual desktop than full blown version of Gnome.
To run of the VNC Server on CentOS, we had to install these required packages:
sudo yum groupinstall Desktop
sudo yum install Tigervnc-server
sudo yum install Xorg-x11-fonts-type1
This is optional:
sudo yum install VNC
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:root"
vncserverargs[1]= "-geometry 1024x600"
The iptables rules need to being 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 Remove 5 after Operation normal
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:
Nano. Vnc/xstartup
Comment the last line and run the Gnome:
#twm &
EXEC gnome-session & Some files do not exist in this line
Restart the service:
sudo service vncserver restart
sudo service Vncserver save resources after shutting down the service
Edit/etc/inittab to set the start CLI or GUI
How to install the VNC server on CentOS 6