VNC server

VNC (Virtual Network Computing) is a graphical desktop sharing system that can be used to control a remote computer. VNC transmits mouse and keyboard events from one node to another on a network and updates the graphical screen on the other end of the network. Vnc is platform independent. VNC makes use of RFB (Remote Frame Buffer) protocol.

VNC depends on two modules:

VNC server

VNC client

VNC server listens to the incoming connections from client. VNC can be used to work on the gui of your vps.

Please note that Veeble servers have VNC pre-installed.

1. First check whether vncserver is installed in the server.

yum list vnc-server. 

If not, you can install the package using yum install vnc-server.

yum install vnc-server

2. Setup a vnc password.

Type ” vncpasswd ” command in the shell. you will be prompted to enter the password. You can use a strong password. By default this will be saved in /root/.vnc/passwd

vncpasswd

3. Open the file /etc/sysconfig/vncservers to setup vnc session.

At the bottom add the following lines.

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
 

Here 1 means the session number.

4. Install kde and gnome environments.

yum install kde*
yum install gnome*

5. Setting up vnc startup script.

Open the file /root/.vnc/xstartup and add the following lines to get a kde desktop.

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
startkde &

You can comment the previous entries.

6. start vnc session

vncserver :1 

check whether you are able to telnet to the port 5901

root@proxy:~# telnet 123.45.2.6 5901
Trying 123.45.2.6...
Connected to 123.45.2.6.
Escape character is '^]'.
RFB 003.008

If you are not able to connect, make sure that port 5901 is open.

8. Testing vnc.

You can download the VNC client from here

After downloading and extracting the VNC client in your windows machine, open vnc client. In the server field, enter the following details.

serverip:1

You will be prompted to enter the vnc password. If everything goes well, you will be able to see the kde desktop.

7. To kill a vnc session, use

vncserver -kill :1

OR

Download the GNOME Desktop environment to your server:

yum groupinstall "Desktop"

After installed GNOME Desktop enviroment then start to install TigerVNC server

yum install tigervnc-server xorg-x11-fonts-Type1

Now your VNC is installed on your CentOS 6.

Start the VNC server.

vncserver

You will be asked to enter the password now.

VNC Client

Now time to connect to your VNC Server:

First download appropriate VNC client from here

Then use it to connect to your server.

Use the fOllowing entry as VNC address:

IP:1

Enjoy your VNC Server