Invent

HOWTO: Use tightVNC to connect to remote VNC server running on Linux


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.

Step 1:
Our first step is to install the required packages on the server.

At the prompt on the Redhat/Centos Server:

$ yum install vnc-server

Once we have the vnc-server package installed we need to do some configuration on the server.

Step 2:
Create the VNC users and set system passwords for each.

$ su -
$ useradd john
$ useradd andy
$ passwd john
$ passwd andy

Step 3:
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:

$ vncpasswd

Step 4:
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.

VNCSERVERS=”1:john  2:andy”

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.

VNCSERVERARGS[1]=”-geometry 800×600″
VNCSERVERARGS[2]=”-geometry 1024×768″

Step 5:
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 start
$ service vncserver stop

The xstartup file is where you can setup application to autorun for the VNC user when they login.

Step 6:
Start the VNC server

As root at the prompt:

$ service vncserver start

Step 7:
Setup VNC server to run at boot time.

As root at the prompt:

$ chkconfig vncserver on

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:

http://192.168.3.12:5801

To login as Andy navigate to:

http://192.168.3.12:5802

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:

192.168.3.12:1

To connect to Andy:

192.168.3.12:2

Replace the 192.169.3.12 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Tweets

Contact us!

We’d Love to hear from you!

  • user_white 100 Cummings Center, Beverly, MA, 01915, USA
  • speech_white Tel. 1-800-873-7443
  • mail_white E-mail: sales@mavinerc.com

Visit also our social profiles:

Scroll to top