VNC Server

To install VNC Server on Ubuntu 16.04, do the following:

First, let's update the apt sources,

apt-get update

Now we can install the vnc4server daemon to get a vnc server running

sudo apt-get install vnc4server xfce4

We will now need to add your user account as a user in vncserver

nano /etc/systemd/system/vncserver.service

ExecStart=/usr/bin/vncserver -depth 24 -geometry 1024x768 %i
ExecStop=/usr/bin/vncserver -kill %i

Now, we need to reload the vnc service to reflect these changes

systemctl daemon-reload

One that has been completed, login to the user that you added in vncserver.service, and start the vnc server


Set the password when prompted.

Edit xstartup so you get the xfce desktop environment when VNC server is started

nano /home/user/.vnc/xstartup

Delete all existing entries and place the following in that file

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
startxfce4 &

Start the VNC server,

systemctl start vncserver.service

and finally, allow it to autostart on boot,

systemctl enable vncserver.service

Now VNC should be accessiable on your VPS_IP:5901 via a desktop based VNC viewer.

Last Modified: February 17 2018 19:46:03