Running xserver on VPS


Has anyone tried to install the x windows system on their VPS so they can connect from home using a VNC client?

I attempted to run:

$ sudo apt-get update
$ sudo apt-get install x-window-system

And got a bunch of 404 errors:

Failed to fetch 404 Not Found
Failed to fetch 404 Not Found

Can I run apt-get as a sudo user? If so, are my source listings out of date in /etc/apt? My VPS linux version is Debian 4.0 (which is pretty old).


Yep, you’re on an old enough release that we don’t have packages available. Write in to support and ask for an upgrade. Once that’s done, you should be able to install a VNC server using apt-get.


Thanks andrewf Mr. DH Code Monkey! They upgraded my VPS and it worked like a champ. For others that are interested in setting up VNC on their VPS, below are the instructions that worked for me.

Before getting started, make sure your packages are up to date,

$ apt-get update

To install the X Window System with the Gnome windows manager,

$ apt-get install x-window-system
$ apt-get install gnome

To install a vncserver,

$ apt-get install vnc4server

To launch the vncserver,

$ vncserver

After it starts, it will create a .vnc directory in your $HOME. If you want to run a gnome session instead of a basic twm, uncomment the first two lines in .vnc/xstartup,

Uncomment the following two lines for normal desktop:

exec /etc/X11/xinit/xinitrc

There were errors in the .vnc/hostname:#.log file because it could not find the “exec” command. You might have to change the permissions on xinitrc so it is executable,

$ sudo chmod 755 /etc/X11/xinit/xinitrc

After these changes are made, kill the current session and start another,

$ vncserver -kill :1
$ vncserver

There are many vnc clients available. I use RealVNC Free Edition.



To start I need to precise that I’m not native English speaker and that I’m a noob, nut I try to learn ;).

So I have just created a new VPS server on my dreamhost account and i create a admin user in the web panel.

I am using putty (windows) to connect in ssh.

I tried to follow your tuto and I ran :
$ apt-get update
$ apt-get install x-window-system.

But when I try to run
$ apt-get install gnome

I have this message :
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Do you have any explanation?

Thanks by advance for your help.


The final error message (specifically, “are you root?”) is telling you what the problem is. Simply running these commands as an admin user isn’t sufficient; you need to run them from that user using “sudo”.


Thank you andrewf the setup seems to be good. But I still have a problem.

So I launch the vncserver
$ vncserver

And I uncomment the two lines for normal desktop:
exec /etc/X11/xinit/xinitrc

I did’nt do the step after and I tried to run my vnc client to connect :
for the address I put :
for the password I put : thepassworddifineforvnc
port : 5900

But it refuse to connect. Do you think that I need to run $ sudo chmod 755 /etc/X11/xinit/xinitrc ?

Thank you.


Actually I run the command $ sudo chmod 755 /etc/X11/xinit/xinitrc and i tried to connect but it’s still not working.

So I really don’t know what I am doing wrong.