In this tutorial, we will show you how to install VNC on Debian 10. For those of you who didn’t know, VNC (Virtual Network Computing) server is free and open-source software that is designed for allowing remote access to the Desktop Environment of the server to the VNC Client whereas the VNC viewer is used on the remote computer to connect to the server.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of the VNC server on an Ubuntu Debian 10 (Buster).
Prerequisites
- A server running one of the following operating systems: Debian 10 (Buster).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install VNC on Debian 10 Buster
Step 1. It’s always a good practice to keep your system packages up-to-date to ensure you have the latest security patches and bug fixes. Open a terminal and run the following commands:
sudo apt update sudo apt upgrade
The first command updates the package lists, while the second command upgrades all installed packages to their latest versions.
Step 2. Installing VNC Server on Debian 10.
TightVNC is a popular and lightweight implementation of the VNC protocol, offering both a server and a viewer component. To install the TightVNC server, run the following command:
sudo apt install tigervnc-standalone-server tigervnc-common
Once successfully installed the next step is to run the vncserver
the command that will create the initial configuration and set up the password:
vncserver
Step 3. Configure VNC Server.
You should first stop the VNC server which is running on port 5091 with the following command:
vncserver -kill :1
The next step is to create the systemd
unit file named vncserver@.service
:
sudo nano /etc/systemd/system/vncserver@.service
Paste the following content:
[Unit] Description=Start TightVNC server at startup After=syslog.target network.target [Service] Type=forking User=root Group=root WorkingDirectory=/home/root PIDFile=/root/.vnc/%H:%i.pid 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 [Install] WantedBy=multi-user.target
Then, enable the unit file with the following command:
sudo systemctl daemon-reload sudo systemctl enable vncserver@1.service sudo systemctl start vncserver@1.service
Step 4. Connecting to VNC server.
To access the remote desktop on the VNC server from the windows system, you must have a VNC viewer installed on your system. There is various VNC viewer available to use. Download any one and install on your system, for example:
If you are using putty, then you need to set the ssh tunneling. Let’s have a look at the command below to enable ssh tunneling in Linux:
ssh -L 5901:127.0.0.1:5901 -C -N -l username your_server_ip
Congratulations! You have successfully installed VNC. Thanks for using this tutorial for installing VNC on Debian 10 Buster system. For additional help or useful information, we recommend you check the official VNC website.