VNC Server Installation
The VNC server is specifically designed for this purpose. The installation is pretty straight forward as mentioned in this link. However, there are chances you may encounter some issues while installing. So, I am describing the issues that I faced and how I resolved them.
yum install vnc vnc-server
We need to decide which user will be using the vnc-server.
su vncuser
Now, we need to set the password.
vncpasswd
As a root user, perform the below operation.
vim /etc/sysconfig/vncservers
Add the below 2 lines.
VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1600x1200"
Type the below commands.
service vncserver start
service vncserver stop
chkconfig vncserver on
If the above commands are successful, we need to edit the xstartup
file for whom we have configured the vncserver
. So, in our case, we have configured it for the user vncuser
. So,
su vncuser
vi ~/.vnc/xstartup
Uncomment the below 2 lines.
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
If the above step is also successful, we are finished with the configuration of the VNC server. However, we need to configure the firewall to permit the vnc communication. In the link, it is mentioned to directly edit the /etc/sysconfig/iptables
file which is a very wrong approach. Instead do the below step.
iptables -I INPUT 1 -p tcp --dport 5901 -j ACCEPT
We have made the changes. But we need to change them.
/etc/init.d/iptables save
service iptables restart
service vncserver start
Now, we can view this machine as vncuser
from a network machine by typing the below commands.
vncviewer
#Enter the server name as,
servername:1 #1 because, we opened up port 5901.
ssh
to connect to the various servers. If you're doing the same thing on multiple servers you can also use tools to run the same commands simultaneously on all the other computers at the same time too. – slm Feb 20 '14 at 23:30