Markus Blog What’s going on Internet?

2Aug/0930

Installing VNC Remote Desktop on Ubuntu Linux VPS

I have a linux Ubuntu 8.10 VPS that I would like to have GUI and use it as remote desktop pc just like what we can do with Windows XP. Here are the steps that I run.

1. Most of the VPS that delivered by VPS hosting provider is minimal setup of linux, it means that most of the time it only have SSH server installed and the other services such as HTTP server, FTP server, Mail server must be installed by our self. The default setup of VPS linux also doesn’t have window manager (GUI) hence we must install it first:

sudo apt-get install ubuntu-desktop

2. Configure the Gnome Desktop Manager and XServer

sudo /etc/init.d/gdm start
sudo dpkg-reconfigure xserver-xorg

3. After we installed a window manager, next step is to install the remote desktop server, for linux we use TightVNC

sudo apt-get install tightvncserver

4. Next we need to configure the remote desktop server and create a password to access the VPS via its GUI. This command will start the server, you will be asked for a password, this password will be used as authentication when you connect to the VPS, make sure you have a strong password.

vncserver :1 -geometry 1024x768 -depth 16 -pixelformat rgb565

5. Now, if you execute command

ps aux

You should see an Xtightvnc process:

Xtightvnc :1 -desktop X –auth

This means the setting is OK and VNC server is running fine.

6. The default VNC server doesn’t use Gnome window manager as default, to run Gnome as default we must do some changes on the configuration file.

sudo nano ~/.vnc/xstartup

Comment "x-window-manager" and add this on the end of file:

gnome-session &

so it will look like this:

#!/bin/sh
 
xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
gnome-session &

7. Next, do a reboot. Usually a reboot is not needed, but just to make sure you can do it.

sudo reboot

8. Start the VNC server:

vncserver :1 -geometry 1024x768 -depth 16 -pixelformat rgb565

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

10. After you install it, run the VNC client and insert your VPS IP address and VNC server number on the VNC Server field and click on “Connect”. In this tutorial the VNC server number is :1, so you must fill in :1

VNC client login

You will be asked for a password to access the remote desktop, this password is the one you set on step 4.

Bookmark and Share

Related Article

Comments (30) Trackbacks (7)
  1. Amazing!! thanks for the walkthrough! make my night!!

  2. This is certainly the most straight forward description I have seen. It worked for me first time, thanks!

  3. Please can you do a rtorrent tutorial i’m begging YOU

  4. @mysoogal I will check on it

  5. Thanks for a straight forward and simple guide!

    Cheers

  6. This quick little throw away kludge worked for me;

    #!/bin/bash
    #Install X
    sudo apt-get install ubuntu-desktop
    #
    #startx
    sudo /etc/init.d/gdm start
    #
    #Configure xserver
    sudo dpkg-reconfigure xserver-xorg
    #
    #Install tightvncserver
    sudo apt-get install tightvncserver
    #
    #Start vncserver to test
    sudo vncserver :1 -depth 16 -pixelformat rgb565
    #
    #Verify server is running
    ps -ef | grep Xtightvnc
    #Kill vncserver and reboot
    sudo tightvncserver -kill :1
    #
    #Switch vncserver Window Manager to Gnome
    sudo sed -i “s/x-window-manager/gnome-session/” /$HOME/.vnc/xstartup
    #
    #Get viewer message
    echo “Get vncviewer from here; http://www.tightvnc.com/download.html
    #
    #Reboot
    echo “Will reboot in 5 seconds, ctrl-c to exit.”
    sleep 5
    sudo reboot

  7. Cheers Markus, Haven’t tried your source above yet, but looks promising! :D

  8. I found your tutorial very thourough, but I am lost already on instruktion 2.

    When I write sudo /etc/init.d/gdm start I get:
    sudo: /etc/init.d/gdm: command not found

    I have googled this, but fail to find a next step forward. Any ideas here?

    Thanks

  9. Very useful, worked a treat! Thanks.

  10. Bless you sir, this worked quite well.

  11. Hey, great tutorial. Im using Ubuntu 9.10 (Karmic Koala) and am having some trouble with the gdm starting and Xserver. Also it doesnt seem the tightvnc was included on the basic installation. when i try to install it, says that its not found. Any ideas? it would be much appreciated.

    Thanks, Jeff

  12. how do you fix the keybord i cant get it to work

  13. Hello , everything gone smoothly but now when trying to connect , everything goes fine but we get gray screen , see it here http://img17.imageshack.us/img17/203/blacktc.jpg
    can you help , please?

    • what virutalization do you use?, how much RAM does your VPS have? what ubuntu version do you use? does the Gnome installation went smooth?

      • the VPS is on Veportal , I think everything went smooth yes , i would really be thankfull if you could help :(

      • sorry , the VPS has 1.5GB ram ubuntu version is 8.10 but updated it before installation as it needed that

      • have you done step 6:

        6. The default VNC server doesn’t use Gnome window manager as default, to run Gnome as default we must do some changes on the configuration file.

        sudo nano ~/.vnc/xstartup

        Add this on the end of file:

        gnome-session &

  14. i tried that but in SSH was giving me error That not a valid comand sudo nano
    so i did vi ~/.vnc/xstartup then edited the file and added that , that was the only thing im not sure if i did correct , but sudo nano ~/.vnc/xstartup won’t work , says Invalid command , i would really be very thankfull if take a minute and login to SSH and see if i did that correctly

    • this is what i get when loged in with TightVNC

      img687.imageshack.us/img687/9391/blackpe.jpg

      • can you look at the vnc server log file? and see if there is an error message. big chances that your vps is hitting its limits as veportal use openvz and openvz vps always having problem with soft limits, see /proc/user_beancounters to check it.

    • that means you don’t have nano (text editor) installed, i like nano better that vi as it’s easier to use.

      apt-get install nano

      that should install nano and and you can run nano ~/.vnc/xstartup

  15. Hi Markus , I cheked everything is ok , and re did all the steps you said the only thing i dont see is ( Xtightvnc :1 -desktop X –auth ) when i excute ps aux , any idea?

  16. Man Thank you! the vps is from http://host90.com we contacted them and they did a fresh install woopa we now can access the graphical interface!

  17. Thanks a lot for this.


Leave a comment


*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word