HostOnNet Blog

Install VNC Server on Ubuntu Server

We will be installing xfce4 desktop on remote Ubuntu server to run it as a Virtual Desktop. This instruction will work on Ubuntu and Debian servers.

Lets install xfce, chromium browser and vncserver.

apt update && apt upgrade
apt install xfce4 xfce4-goodies chromium-browser tightvncserver

Now we need to create a user for desktop to run

useradd -m -s /bin/bash desktop
usermod -G sudo desktop

Lets set password for vnc server, for this change to user desktop

su - desktop

Run vncserver, this will ask you to enter password.


At this point, you will be able to connect to VNC server using your server-ip:1

Lets kill the running VNC Server

vncserver -kill :1

Starting VNC Server on Boot

Create a file

vi /etc/systemd/system/vncserver.service

Add following content

Description=Start TightVNC server at startup

ExecStartPre=-/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1
ExecStop=/usr/bin/vncserver -kill :1



systemctl daemon-reload

To auto start enable the service with command

systemctl enable vncserver

You can start/stop vncserver with command

systemctl enable vncserver
systemctl start vncserver

Change VNC Password

You can change vnc password by running command


This need to be done as user "desktop".

Posted in Linux