Make sure the required packge is installed in the machine.
# rpm -qa | grep vnc
If you do not get the output packages then install then using yum
# yum -y install vnc-server
Once the package is installed these are the steps you need to follow
# vi /etc/sysconfig/vncservers
on the line 20
VNCSERVERS="2:root" <== give the username of the user by whom you want to use vncserver as in my case root
Assign a password for the vncserver for the root user
# vncpasswd
Password:
Verify:
# service vncserver restart
If the service starts without any error then you can move to the next step or else check for the log messages which you can find in
# less /var/log/Xorg.0.log
Now I will assume that the service started without any error So for the next step
# go to line no. 5 and uncomment it
exec /etc/X11/xinit/xinitrc <===uncomment this line
save and exit
Restart the service# service vncserver restart
The vncserver package in CentOS 6 and RHEL 6 is different as compared to earlier versions to which most of us get confuse.
Installing vnc-server rpm
# yum -y install tigervnc-server
Once the package is installed
# vi /etc/sysconfig/vncservers
on the line 18
VNCSERVERS="2:myusername" <== give the username of the user by whom you want to use vncserver as in my case root
Assign a password for the vncserver for the root user
# vncpasswd
Password:
Verify:
and restart your vncserver using this command
# service vncserver restart
In CentOS 6 you do not need to edit any other file from here you can use the same steps as I described earlier using the client software to connect your vncserver.