Saturday, 3 May 2014

How To Install VNC Server On CentOS


VNC (Virtual Network Computing ) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol to remotely control another coumputer on a network.

To run the VNC Server on CentOS, we have to install these required packages:

yum groupinstall Desktop
yum install tigervnc-server
yum install xorg-x11-fonts-Type1
yum install vnc


To start VNC Server on boot


chkconfig vncserver on
To setup users’ VNC password:


vncpasswd
Edit the /etc/sysconfig/vncservers file:


nano /etc/sysconfig/vncservers
Add the following to the end of the file:


VNCSERVERS="1:vn"
VNCSERVERARGS[1]="-geometry 1024x600"
The iptables rules need to be amended to open the VNC ports:


iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
service iptables save
service iptables restart
Restart the VNC Server:


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 &

Restart the service:


service vncserver restart

Now, download VNCViewer onto our desktop computer from which we want to access the shared desktop.

Connect using ServerIP/Name:1 (:1 is for the VNC server window)

http://www.realvnc.com/download/viewer/

Enter the password that we created using the vncpasswd command:

Ability to connect for multiple users:

Create a local user, using the following command:


adduser vnc

Create a password for newly created user:


passwd vnc

Switch to the newly created user and run vncpasswd command for it:

su vnc


vncpasswd

Edit the /etc/sysconfig/vncservers file:


nano /etc/sysconfig/vncservers

Add these lines for new user:


VNCSERVERS="1:vn 2:vnc"

VNCSERVERARGS[1]="-geometry 1024x600"

VNCSERVERARGS[2]="-geometry 1024x600"

Restart the VNC service:


service vncserver restart

Kill the vncserver session for new user and edit the xstartup file:


su vnc

vncserver -kill :2

cd ~

nano .vnc/xstartup

Modify the file so it looks like this:


#twm &

exec gnome-session &

Restart the VNC service:


service vncserver restart

No comments:

Post a Comment