Install a VNC Server on Linux

To install a VNC server on linux you can use a built-in package manager to perform the initial install. On Cenots linux it is Tiger VNC. Install as follows:

yum install tigervnc-server

Next you will need to configure the vnc server options to allow for a connection. Edit the following file:

vi /etc/sysconfig/vncservers

And add the following line

VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 1024x768"

now restart the vnc server

[root@computer ~]# service vncserver restart
Shutting down VNC server:                                  [  OK  ]
Starting VNC server: 2:root
New 'computer:2 (root)' desktop is computer:2

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/computer:2.log

                                                           [  OK  ]

Now verify which port it is running on. In this case it is 5902. We can verify it is listening using “netstat”

[root@computer ~]# netstat -an | grep 5902
tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN

Now with your vnc client enter the op address of your host and the port as follows:

<ip>:<port>

Where it has the server connection info.

Having a vnc server can be very useful for having remote desktop sharing on a linux host. It makes linux administration considerably easier.

Be the first to comment

Leave a Reply