Setup VNC server on VPS

We will discuss  setting up your VPS as a VNC server and using a client from your Windows machine to connect. Why would you want to use your VPS as a remote desktop? Well one example I can think of would be if you wanted to explore the GUI features of Linux before installing it on your box at home. Another advantage would be to install a desktop environment if you’re unfamiliar or uncomfortable with the command prompt to run administrative tasks…

But isn’t a desktop environment a memory intensive application that will eat up my RAM and bring my VPS to a crawl? Not really. We dont even need to run X Server (and couldn’t because of video terminal issues with Xen), thereby eliminating much of the stress placed on the system. In our tests, VNC server with GNOME running a freshly rebuilt 384MB VPS only consumed about 35MB RAM. Although this article applies to CentOS, the changes are minimal if you use any other Linux distribution we offer.

Installation

Lets start by logging on to our VPS and installing the required packages for VNC. We’ll need the X Window System and a desktop environment, which can be installed with:

# yum groupinstall “X Window System”
# yum groupinstall “GNOME Desktop Environment”

You may prefer to install a different desktop environment, such as KDE, which is a little larger and resource intensive than GNOME. To get a complete list of available packages give the “yum grouplist” command.

The installation of each package may take a while to finish, so go pour yourself a cup of coffee.

NOTE: If you receive the error “Error: Missing Dependency: libgaim.so.0 is needed by package nautilus-sendto” while installing GNOME Desktop Environment, you will need to manually install nautilus-sendto with the following procedure:

# yum install yum-utils
# yumdownloader nautilus-sendto
# rpm -Uvh –nodeps nautilus-sendto[PRESS TAB]

Source: http://bugs.centos.org/view.php?id=2483

Configure VNC Server

VNC Server should have been installed along with X Window System, so we can now move on to configuration. Edit the /etc/sysconfig/vncservers file and add (or uncomment) the following two lines:

# nano /etc/sysconfig/vncservers

VNCSERVERS=”5:root” # display port and username
VNCSERVERARGS[2]=”-geometry 800?600 -nolisten tcp -nohttpd -localhost”
Change the criteria to match  your desired configuration. For example, change “5:root” to a different display port and/or username if you do not wish to use root. Likewise, change the resolution if you prefer. The other parameters can be left as they are. Save the file and exit.

Now we need to assign a password to the VNC server. Do this by issuing:

# vncpasswd

To start VNC server, type

# vncserver :5

This will generate a local Notice that :5 is the same port we gave in the first config file.

Before you log in through a VNC client there is one more file that needs to be adjusted to match our configuration. First, kill the dekstop you launched earlier with:

# vncserver -kill :5

Now edit the local config file in the root folder:

# nano ~/.vnc/xstartup

We want to have VNC load GNOME instead of the default twm. Look for the following line:

twm &And replace it with

gnome-session &Ok now save and restart the VNC instance:

# vncserver :5

Remember the port you are using to start VNC (:5), you will need it later when connecting with a VNC client. VNC Server should be running GNOME as needed now. Notice we didn’t even bother with any X Server configuration because it’s not needed to give us a fully functioning remote desktop. This should do it for configuration. Let’s go on to testing our setup.

Connecting with VNC client

Load up your favorite VNC client ( RealVNC) and type your IP followed by the port number you loaded VNC server with (NOT the general VNC port). Such as:

124.211.33.10:5

Then click connect. You will be prompted for your password (the one you specified with vncpasswd) after which your Linux desktop should come up. If you are having problems connecting, check your firewall rules to see if the generic VNC port (5900) is open for incoming connections.

That should be it, congratulations on installing VNC server and enjoy your new Linux desktop

  • 1 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

OpenVZ basic commands

Following are some important commands which are normally used while working on a Hardware...

Howto List existing VPS

SSH to the master server and run the following command:/usr/sbin/vzlist -aThe -a switch tells the...

Install shoutcast server on CentOS server

Shoutcast is a free-of-charge audio homesteading solution. It permits anyone on the internet to...

How to integrate XCache into PHP5 on a Fedora 8 or CentOS 5.1 system (with Apache2)

From the XCache project page: “XCache is a fast, stable PHP opcode cacher that has been...

PureFTPd Installation and Setup

IntroductionThe following HOWTO is aimed at installing and setting up a FTP server, based on...