Today I will explain how to setup VNC on your Centos Linux Server and how to connect to it using the tightVNC desktop client and VNC web client.
VLC’s main functionality is to allow the display of an X Window session running on a remote computer. VNC is much like a Windows remote desktop connection except it allows connections from any platform that supports a VNC client.
Our first step is to install the required packages on the server.
At the prompt on the Redhat/Centos Server:
Once we have the vnc-server package installed we need to do some configuration on the server.
Create the VNC users and set system passwords for each.
$ useradd john
$ useradd andy
$ passwd john
$ passwd andy
Set the VNC user passwords
To set the passwords the VNC users will use to login with, login as each user and tun the following command:
Edit the VNC server configuration.
The configuration file for VNC server is located at /etc/syconfig/vncservers
The VNCSERVERS line states the users which can login to the VNC server, edit this line to reflect the users you have added e.g.
Once you have done this you need to setup the display options for each user. In this example we have two users John and Andy.
The following two lines set the john login to have a 800×600 screen, and the andy login to have a 1024×768 screen.
Once we have setup the VNC users we need to create the xstartup scripts by starting and stopping the vncserver service as root.
$ service vncserver stop
The xstartup file is where you can setup application to autorun for the VNC user when they login.
Start the VNC server
As root at the prompt:
Setup VNC server to run at boot time.
As root at the prompt:
In this example I will connecting from a Windows 7 machine to my Redhat/Centos server.
This can be accomplished in two ways either using the Java web client or a VNC client.
To connect via the web client move to the machine you wish to use as the client and open your Java enabled web browser.
To login as John navigate to the following URL, replacing 192.168.3.12 with the IP address of the VNC server:
To login as Andy navigate to:
On connecting to VNC server, a Java applet will execute allowing you to login and display the remote desktop.
To connect to the VNC server using a VNCclient we need to download one onto our client system. In this example I will use tightVNC. You can download this from http://www.tightvnc.com/
I am using the Version 2.0 currently as it supports scaling of the window for full screen use.
Once you have tightVLC installed to connect to your VNC server enter the address in client in the following format:
To connect to John:
To connect to Andy:
Replace the 18.104.22.168 with the IP of your VNC server and the port to reflect the user number setup in the VNC server configuration.
If you have any problems connecting to your VNC server, check your server firewall settings. In this example we require 5801, 5802, 5901 and 5902 to be open to the client.