Jul 24, 2011
Talk Web ID

Minimum Install VNC Remote Desktop Server on Centos

On this tutorial we are going to install VNC server on a Centos 5.6 Linux VPS. The objective is to install minimum packages to save disk space and keep the package installation minimum.

To install VNC server and Gnome desktop, run this command:

yum install vnc-server gnome-desktop xorg-x11-xinit xterm gnome-applets gnome-session gnome-themes gnome-panel gdm firefox dbus-x11

Then create a normal user to run the VNC service and create password to login to VNC remote session:

adduser johndoe
passwd johndoe
 
su - johndoe
 
vncpasswd
 
ls .vnc/

You’ll see: passwd this file is storing the password for login to VNC session

exit

Next is editing VNC server configuration /etc/sysconfig/vncservers and add the new user to list of VNC server:

nano /etc/sysconfig/vncservers

Add the user to list of VNC server:

VNCSERVERS="1:johndoe"

Now let’s start the vncserver service to generate xstartup script where we’ll configure it to start Gnome desktop environment.

service vncserver start
service vncserver stop
 
su - johndoe
 
ls .vnc/

You’ll see: <hostname>:1.log passwd xstartup

We need to modify the xstartup script so Gnome session is called when we start the VNC server

nano .vnc/xstartup

modify:

#!/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 &

to:

#!/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 1024x768 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

Save the modification, go back as root and let’s start the VNC server

exit
service vncserver start

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

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 when you run vncpasswd command.

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. Installing VNC Remote Desktop on Centos VPS
  2. Installing Squid Web Proxy Server on Windows 7
  3. Free Mail Server for Windows Server 2003 – 2008

10 Comments

  • sorry i cant……….

    when i write vncpasswd =====> -bash: vncpasswd: command not found

    and when i write ls .vnc/ ======> ls: .vnc/: No such file or directory

    can you help me

    • that means you haven’t install vnc server, please run the yum command on the very first step above.

  • I installed everything, and when i connect to server i can see the black screen, and nothing else

    • what virtualization do you use? and how much ram do you have on your vps?

      • I have the same problem. When connecting to the VNC server it just shows a blank grey screen.
        My VPS’s virtualization is OpenVZ with 512MB RAM(1GB Burst).
        any help would be much appreciated.

        Thanks.

  • Hi there!!

    This tutorial works for me!!

    My info:
    VPS Server
    OS:centos-5-x86

    Thx.

    +10 Like!

  • Hello, i tried to install it, but when i’m tried this comand

    ls .vnc/

    show :

    [root@149 ~]# su – johndoe
    [johndoe@149 ~]$ ls .vnc/
    ls: .vnc/: No such file or directory

    how can i resolve it ? thank’s

    • su – johndoe

      vncpasswd

      ls .vnc/

  • When i’lm runing service vncserver start i get :

    root@149 ~]# service vncserver start
    Starting VNC server: no displays configured [ OK ]

    • that means you didn’t follow the steps carefully:

      nano /etc/sysconfig/vncservers

      add:

      VNCSERVERS=”1:johndoe”

Leave a comment

*