Virtual Network Computing (VNC) is a technology which allows remote control of another computer using the  Remote Frame Buffer protocol (RFB). In this guide, we’ll cover how to Install and Configure VNC Server on Ubuntu 18.04 LTS.

VNC works in a client/server model. The VNC client is installed on the local computer while the VNC server is installed on the remote system to be managed. The server transmits a duplicate of the remote computer’s display screen to the viewer(client).

Install and Configure VNC Server on Ubuntu 18.04 LTS

Install VNC server on Ubuntu 18.04 by running the commands below in your terminal.

sudo apt update
sudo apt -y install vnc4server

Step 2: Install Desktop Enviroment

Ensure you have a Desktop Environment installed on your Ubuntu 18.04. For this guide, we’ll install  Xfce desktop environment.

sudo apt install xfce4 xfce4-goodies

You can choose to use other Desktop environments.

Step 3: Configure VNC Server

Once you’ve finished the installation of Desktop environment and VNC server. Configure VNC server on Ubuntu 18.04 LTS as follows.

1. Set a secure access password

Run the vncpasswd command to set password for your VNC server.

$ vncpasswd

When prompted, enter and verify your password to set.

2. Start VNC server

Start VNC Server on Ubuntu 18.04 using the command:

$ vncserver :1

New 'ubuntu-01:1 (computingforgeeks)' desktop is ubuntu-01:1
Creating default startup script /home/computingforgeeks/.vnc/xstartup
Starting applications specified in /home/computingforgeeks/.vnc/xstartup
Log file is /home/computingforgeeks/.vnc/ubuntu-01:1.log

3. Kill VNC Server

Kill VNC Server using the command:

$ vncserver -kill :1
Killing Xvnc4 process ID 20842

4. Set VNC Server Desktop Environment

VNC configuration file is located on ~/.vnc/xstartup. Edit it with your favorite text editor.

sudo vim ~/.vnc/xstartup

Add the following line at the end of the file.

exec /usr/bin/startxfce4 &

Finally start VNC Server with ;

  • Display number [1]
  • Screen resolution [800×600]
  • Color depth [24]
$ vncserver :1 -geometry 800x600 -depth 24 

New 'ubuntu-01:1 (computingforgeeks)' desktop is ubuntu-01:1
Starting applications specified in /home/computingforgeeks/.vnc/xstartup
Log file is /home/computingforgeeks/.vnc/ubuntu-01:1.log

Step 4:  Connect to the VNC Desktop

You can connect to remote desktop using a VNC client and SSH tunneling. Create an ssh tunnel to VNC server using the following command

ssh <username>@<vnsserverip>  -C  -L 5901:

Then install vncviewer client

sudo apt install tigervnc-viewer

On Arch Linux, install it with:

sudo pacman -S tigervnc

Once your SSH tunnel is running, connect to localhost:5901 using  VNC client. When prompted for password, enter the password created during the VNC server configuration.

install vnc server ubuntu 18.04 01

Once connected, you’ll see the default Xfce Desktop environment

install vnc server ubuntu 18.04 02

Step 5:  Configure Systemd

Stop the current VNC server instance:

vncserver -kill :1

Create a systemd service unit file for managing VNC Server.

sudo vim /etc/systemd/system/[email protected]


Description=Start TightVNC server at startup


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


Don’t forget to replace computingforgeeks with your actual remote user username. Save the file and exit when done.

Reload systemd and start VNC

sudo systemctl daemon-reload
sudo systemctl enable --now [email protected]

Check status:

$ systemctl status [email protected]
* [email protected] - Start TightVNC server at startup
   Loaded: loaded (/etc/systemd/system/[email protected]; indirect; vendor preset: enabled)
   Active: active (running) since Wed 2018-12-05 11:32:50 PST; 7s ago
  Process: 24161 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1 (code=exited, status=0/SUCCESS)
  Process: 24154 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, status=2)
 Main PID: 24168 (Xvnc4)
    Tasks: 63 (limit: 1110)
   CGroup: /system.slice/system-vncserver.slice/[email protected]
           |-24168 Xvnc4 :1 -desktop ubuntu-01:1 (computingforgeeks) -auth /home/computingforgeeks/.Xauthority -geometry 1280x800 -depth 24 -rfbwait 30000 -rfbauth /home/v
           |-24174 vncconfig -iconic
           |-24176 /bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
           |-24186 xfce4-session
           |-24189 /usr/bin/dbus-launch --sh-syntax --exit-with-session xfce4-session
           |-24190 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
           |-24194 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
           |-24198 /usr/bin/ssh-agent -s
           |-24202 xfwm4

How to secure a VNC Server on Ubuntu?

If you have followed the steps mentioned above, you will have a perfectly working VNC server on your Ubuntu device. However, keep in mind that VNC sends passwords without any security – meaning, someone can easily listen to your conversation by logging themselves in! Therefore, to secure your VNC server, you can use a VPN for encryption which will mask your remote VNC server location, making it impossible to track. There are plenty of free VPNs for Ubuntu that you can use to set up a secure VNC server. 

You have successfully installed and configured VNC server on Ubuntu 18.04 server.

Check other Ubuntu guides available in our website.

Install AnyDesk on Ubuntu

How To Install Docker on Ubuntu

How To Install Envoy Proxy on Ubuntu

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here