Aug 23, 2009
Talk Web ID

Installing VNC Remote Desktop on Centos VPS

In this tutorial we’ll install Gnome desktop and VNC server on Linux Centos Virtual Private Server (VPS). You need to install Gnome as the desktop for Linux VPS, this way you’ll get Graphical User Interface to manage your VPS or just use it as remote desktop. The VNC server is the remote control software that allows you to connect to the VPS Desktop.

1. Install Gnome Desktop, VNC Server and Xterm.

yum groupinstall gnome-desktop
yum install vnc-server xterm

It will take some time to install the Gnome Desktop as it quite big packages.

 
2. Create a normal user.

Now we create a normal user that will be used as remote desktop user. In this example I use ‘vncuser’ but you can choose your own username, just make sure you replace ‘vncuser’ to your chosen username.

useradd vncuser

Setup the user password for vncuser

passwd vncuser

3. Login as vncuser and create VNC password.

Next we need to create password to access VNC server. This password is different with the password we create on step 2, the password on step 2 is for accessing SSH while this one is to accessing VNC remote desktop.

vncpasswd

The command above will ask you to supply password to access the VNC server and create .vnc directory with passwd file inside it. To check whether passwd file is created run this command

ls .vnc

After that return to root user by executing command

exit

4. Creating xstartup script.

After we create the VNC user now we’ll create the VNC server xstartup script, we do this by starting and stopping the VNC server as root.

service vncserver start
service vncserver stop

Now check if the xstartup script is created

ls /home/vncuser/.vnc

That command should show these files: passwd <hostname>:1.log xstartup

5. Edit the default xstartup script to run Gnome desktop.

The default xstartup script looks like this:

#!/bin/sh
 
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

You have to edit it so it looks like this:

#!/bin/sh
 
( while true; do xterm; done ) &
 
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 1024x768 -ls -name "$VNCDESKTOP Desktop" &
gnome-session &

6. Start the VNC server.

After finished editing the xstartup script run again the vncserver service

service vncserver start

You should see something like this:

New 'localhost.localdomain:1 (johndoe)' desktop is localhost.localdomain:1
 
Starting applications specified in /home/johndoe/.vnc/xstartup
Log file is /home/johndoe/.vnc/localhost.localdomain:1.log
 
                                                           [  OK  ]

7. Download Tight VNC client here: http://www.tightvnc.com/download.html

8. Connect to the VNC server

After you installed the Tight VNC client, run it and you’ll see this form:

VNC Connection

VNC Connection

On the VNC Server field, insert your VPS’ IP address followed with ‘:1’ and then click on Connect. You’ll be asked for a password, this is the password you created on step 3.

If you need VPS hosting with VNC remote desktop installed, please contact HalfDedi at www.halfdedi.com or email info@halfdedi.com, they have a great VPS service

Related posts:

  1. Minimum Install VNC Remote Desktop Server on Centos
  2. Installing Squid Web Proxy Server on Windows 7
  3. Microsoft Wireless Comfort Desktop 5000 Keyboard and Mouse

16 Comments

  • [...] read the how-to please go to: http://www.talk.web.id/2009/08/installing-vnc-remote-desktop-on-centos-vps/ as I write it for Talk Web ID. If you like the tutorial or have questions, please write on the [...]

  • Nice tutorial bro..
    gnome took 1 hour on my 512 Mb Ram vps :P

  • thanks,

    gnome took a while as it’s quite big packages to download and install

  • pleaase help me it dont work

  • if u can explain a little bit more step five, i did all of the steps but i don’t know what i have to do in step 5

  • basically you just have to make the xstartup script to be like what inside the bottom box.

  • hi when i start and stop vc service theres no folder created what i do?

  • i keep getting
    Starting VNC server: no displays configured
    i installed it step by step
    can you help?

  • On some VPS you have to remove this – httpd* – from the /etc/yum.conf to make the gnome desktop install. Once the install is complete put back the “http*”.

    If you don’t, you will get this error.
    Missing Dependency: httpd >= 2.2.0 is needed by package gnome-user-share-0.10-6.el5.i386 (base)

  • Yes, he didn’t say you need to edit the file “/etc/sysconfig/vncservers” and add this to the last two lines:

    VNCSERVERS=”1:vncuser”
    VNCSERVERARGS[1]=”-geometry 640×480″

    • actually the VNCSERVERARGS variable on /etc/sysconfig/vncservers is not needed as the geometry is already stated on the xstartup script.

  • After 4th step
    i found only passwd file on commend
    ls /home/vncuser/.vnc

    removed httpd* from yum.conf

    yet got one error
    Failed:
    httpd.x86_64 0:2.2.3-45.el5.centos.1

    • did the vncserver service runs OK? check the log file.

      why did you remove httpd? there is no need to remove it.

  • [root@anwo ~]# service vncserver start
    Starting VNC server: no displays configured [FAILED]

    can any one help out ?

    • edit the file “/etc/sysconfig/vncservers” and add this to the last two lines:

      VNCSERVERS=”1:vncuser”
      VNCSERVERARGS[1]=”-geometry 1024×768?

  • Thanks for helping me get this setup on my VPS. Great tut.

Leave a comment

*