VNC X11 sessie op Ubuntu 12.04 server zonder scherm of grafische kaart

VNC X11 sessie op Ubuntu 12.04 server zonder scherm of grafische kaart

on Mar 20 in Computer, Linux by

flattr this!

I’m splitting my HTPC in a backend-frontend system, in order to place the server in another location where I don’t suffer from the noise it makes.

In doing so I felt there was no need to put a graphics card in the system. But I still wanted to vnc into the system, get a remote X11 session. Without any graphics card whatsoever you need vnc4server for that (or an NX server, but for internal purposes VNC would do just fine)

Start by becoming root

sudo -s

Now we’ll install the server itself

apt-get install vnc4server

We also need a window manager, I’ll choose for XFCE’s. That might be a little too heavy for you, so you can choose something else like openbox or ratpoison. As long as you’ve got a window and session manager

apt-get install xfwm4 xfce4-session

I prefer the service to start automatically, so we’ll create an upstart script for that.

nano /etc/init/vnc-server.conf

And pase this content in it. Replace “skerit” with your own username. Replace “1024×768″ with your preferred resolution.

# vnc-server.conf

start on runlevel [2345]
stop on runlevel [016]

post-start script
        su skerit -c '/usr/bin/vnc4server :0 -geometry 1024x768'
end script

post-stop script
        su skerit -c '/usr/bin/vnc4server -kill :0'
end script

#End of File

Before actually starting this script, we have to run it ourselves in order to set up the password.
Unfortunately, this password must be at least 6 and at most 8 characters long.
Again: replace “skerit” with your own username.

su skerit -c 'vnc4server :0 -geometry 1024x768'

After this it’ll tell you it has created several files that we’ll need to edit:

New 'barabas:0 (skerit)' desktop is barabas:0

Creating default startup script /home/skerit/.vnc/xstartup
Starting applications specified in /home/skerit/.vnc/xstartup
Log file is /home/skerit/.vnc/barabas:0.log

Now we need to add something to that newly created xstartup script in order for it to actually start xfce4.

This should be the new content of xstartup:


[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
startxfce4 &

Now all you need to do is start the newly created service:

start vnc-server

And now you can connect to it form your favorite vnc client.


  • Andy zegt:

    Thanks for a great tutorial, however is there a way to use the Gnome desktop in place of XFCE, alas I’m not a big fan of XFCE.
    Thanks again

    • skerit zegt:

      Sure, that’s possible. I’m not sure when I’ll have the time to take a look at it, though.
      Try apt-get install gnome-session and then replacing startxfce4 with gnome-session. At least, that worked for Gnome2, I don’t know what script starts the new Gnome3 session, but it’s probably the same.

  • demetri zegt:

    Great post! Thank you very much.

  • lepo zegt:

    Thanks a lot, was exactly what I was looking for!

Leave a Comment