How to turn your Ubuntu 14.10 headless server into a XFCE + VNC Network Desktop

This tutorial describes the installation of Gnome 3, XFCE and VNC on a headless server (server without monitor) to turn it into a Linux Desktop that you can access from anywhere over the internet with VNC. The server that is used for this setup is a root server in a datacenter that runs just a minimal Ubuntu 14.10 operating system. I will guide you trough the installation and configuration of the following software:

Ubuntu 14.10
Gnome 3.14
VNC 4.1.1

Important Notes: This procedure is only applicable to a new installed Ubuntu Linux OS, if you have existing running Ubuntu Linux with a different version where you like to install a desktop and vnc, i suggest you make a backup of your system and after that, you may proceed with this procedure. All commands below assume that you are logged in as root user, so please run "sudo -" to become root if you are logged in as a different user.

WARNING: The VNC protocol does not encrypt the transmitted data or login details, use a VPN tunnel if you plan to use it over a insecure or public network.

1. Installing Gnome

First we install some prerequisites for installing Ubuntu PPA repositories:

apt-get install software-properties-common

Then add the Gnome 3 PPA repository with this command:

add-apt-repository ppa:gnome3-team/gnome3-staging

Then, Press [ENTER] to proceed

to load the gpg key.

Then run:

apt-get update

to load the package list from the server and install pending updates:

apt-get upgrade

2. Installing VNC

VNC (Virtual Network Computing), this is used for remote access software to control and this can be done by installing in destination server.

VNC client(source) -> Internet cloud -> VNC Server(destination)

VNC Destination server:
Assign a IP address 
VNC server installed
Password set in VNC (for security purposes)

VNC Source client:
VNC viewer installed (you can install this to any client pc either your using windows or linux)

Here are the steps:

apt-get install gnome-core xfce4 firefox

Then you may choose Yes or Y to confirm the action, after that issue the command

apt-get install vnc4server

You should test it by running vncserver and setting a password.


If you seen this option view-only password, this means you have no control on remote server. So, in this case you will need to choose "n", so you have a full access.

Once its running, you may kill the process.

vncserver -kill :1

Then I will make a backup of the original vnc startupfile by executing the command

cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

The next command will empty the file

> ~/.vnc/xstartup

By using vi editor, you may edit the file.

vi ~/.vnc/xstartup

Insert this given data into the file xstartup.

for easier copy / pasting, here the content of the startup file as text

startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

Then make the startup file executable.

chmod +x xstartup

Next, I will create a startup script

then insert this data into that vncserver file.

[ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/vncservers.conf
prog=$"VNC server"
start() {
 . /lib/lsb/init-functions
 echo -n $"Starting $prog: "
 ulimit -S -c 0 >/dev/null 2>&1
 for display in ${VNCSERVERS}
 export USER="${display##*:}"
 if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
 echo -n "${display} "
 su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"
stop() {
 . /lib/lsb/init-functions
 echo -n $"Shutting down VNCServer: "
 for display in ${VNCSERVERS}
 export USER="${display##*:}"
 if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
 echo -n "${display} "
 export USER="${display##*:}"
 su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
 echo -e "\n"
 echo "VNCServer Stopped"
case "$1" in
start [email protected]
stop [email protected]
stop [email protected]
sleep 3
start [email protected]
if [ -f /var/lock/subsys/vncserver ]; then
stop [email protected]
sleep 3
start [email protected]
status Xvnc
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1

and make it executable.

chmod +x /etc/init.d/vncserver

Then, I need to create a configuration file for the vnc server:

mkdir -p /etc/vncserver

vi /etc/vncserver/vncservers.conf

Then insert this to vncserver.conf and make it root user in VNCSERVERS="1:root" (this will depend on what user are you gonna use)

VNCSERVERARGS[1]="-geometry 1024x768"

Now, will create to startup upon boot of the system.

update-rc.d vncserver defaults

You may reboot the system.


Once the system up and running you may use any VNC client and configure it. (as with me i install TightVNC on my windows pc)

In this example, in VNC server -> <enter the ip address  of the target server>:<port number>, since this VNC server is using port number 5901.

Then you need to enter the password.

If its working, then you should be able to access the desktop of the remote server.

Share this page:

Suggested articles

15 Comment(s)

Add comment


By: Mike

It ought to be possible to turn all of this into a script, and save lots of copying an pasting.

By: JohnP

VNC doesn't encrypt anything. Using that over the internet without discussion about using a VPN or ssh tunnel is gross negligence, IMHO.

There are other options that behave faster and use ssh tunnels by default.  NX protocol is one of those. x2go-server or freeNX are implementations.  They work over the same ssh port you've already opened and desktop performances feels 2-3x faster than VNC or RDP.

I'm confused by VNC still gets any press for internet use. These flaws in the protocol are well known.

By: till

I've added a warning note to use a VPN if this setup is used for connections over public networks. 

By: josh

Why does it say Gnome 3 but the end result is an Xfce desktop?

By: MikeC

"you can access from anywhere over the internet"

Where is the router configuration information. hole in your firewall, redirected to certain fixed IP in your internal net, etc.  Actually its a good thing that this open access description doesn't provide that information because I agree with JohnP that this is a negligent security setup.

By: Roland C. Ilao

Hello, the idea here is to show how to make gnome 3 and VNC work on ubuntu 14.10 and to other guys want to learn about this, then its simple shows to basic knowledge about this part. So, if we are thingking about securing, yes i agree also, that this procedure should include the security flaws. But for now, we want to show how this make it work.

This is intented for beginner of linux on how to install gnome and vnc.

By: Roland C. Ilao

We can install any package other than xfce or gnome, the idea here is to make it work on ubuntu 14.10.

By: JohnP

VNC is harder to get working than x2go. It just is.  It is like saying we should all still be using telnet or plain ftp instead of ssh, scp, sftp or sshfs ...

x2go is F/LOSS, secure, works better than VNC, plus can use ssh-keys - why show how-to for inferior tools?

apt-get install x2goserver (on the server)

apt-get install x2goclient (on the client)

Use a non-3D desktop, point the client at the server (hopefully using configured ssh keys), and be happy.

By: bugggg

/etc/init.d/vncserver start

Starting VNC server: 1:myuser Password:

asking for myuser's password

By: Brendan

This worked fantastically well.   I didn't need to use the Gnome PPA seems Ubuntu Precise already has the required features.  Also I am passing it through my SSH connection.  If i didn't my default firewall would block it anyway.   I prefer VNC because its easy to find on android and windows devices so I can literally get access to my VPS from anywhere and there are no side effects from a network failure, I just reconnect.  I use a Java application with a security mechanism that requires me to see the screen to login.  after that I can use the command line for everything else.  This really helped me a lot.

By: sven86

Why not NX instead of VNC? It does encryption via SSH, and it's faster than VNC.

By: Jason Hunter

why is it that we on gnu/linux systems are having such a crap way of getting remote gui access? I mean, windows have always had "splendid" rdp support. We're a unix community; why are we having to go through all this crap? This should've been standard on all gnu systems

By: Alme

I have a question recarding the theme. When I use this method, I am able to xfce and it loades fine but the theme and icons does not load at all. Also another issue that I notice, command tab complition is not working in the terminal. I have the same xstartup as you. I have to note here that the vncserver is started as root and the OS Im using is Kali 2.0.

By: CJ

Great tutorial. Thank you

By: Gokul

One small detail.. set the password by entering 'vncpasswd' just after running vncserver.