VNC is an acronym for Virtual Network Computing; freely available, open-source and alternative for the Microsoft RDP protocol (RDP). This technology is introduced for graphically sharing your desktop system by enabling you to operate another computer remotely using your mouse and keyboard. In other words, we can say that VNC is a set of protocols utilized for sharing desktop systems. It allows users who are not comfortable with the command-line to manage their settings, applications, and files remotely.
Now, you will learn about how to install and setup VNC on your Ubuntu system. So let’s start!
First of all, update your system repositories by executing the below-given command:
sudo apt-get update
The next step is getting the graphical interface.
You might know that the Ubuntu servers are handled via the command line, and the servers do not have a pre-install desktop environment. If you are using the Ubuntu desktop version, then skip this step.
In the Ubuntu repository, you will get a variety of desktop environments. In this post, we will install the “Xfce,” which is a lightweight and robust desktop environment, excellent to use on a remote server:
sudo apt install xfce4 xfce4-goodies
There exists a lot of software for controlling a Linux-based distribution. However, we will use the “TigerVNC” on our system. It is an open-source VNC server utilized to control the access of your desktop remotely. Now, install TigherVNC on your system by using the following command:
sudo apt install tigervnc-standalone-server
Execute the below-given “vncpasswd” command to set the password:
Enter a password between six to eight characters. Next, confirm that you have selected a view-only password by giving “n” as an input to the terminal:
sudo nano ~/.vnc/xstartup
These commands will unset the session manager and the session address. It also will enable the xface4 at the time of server startup:
sudo chmod u+x ~/.vnc/xstartup
This command will create and open up the VNC configuration file in nano editor:
These lines are added to set the interface related settings of VNC:
sudo vncserver
In the output, you will see a “:1” after your system hostname. This value symbolizes the port where VNC is currently operating on your system. For instance, on our Ubuntu, the VNC server is running on the 5901 TCP port of the system (5900+1). If you see a number other than “1,” then add that number in the “5900,” and you will get the port number on which VNC is operating on your system:
VNC also provides you the option to create a Systemd unit file and add your VNC services, such as starting, restarting, and stopping the VNC to it. To do so, execute a below-given command in the Ubuntu terminal:
sudo nano /etc/systemd/system/vncserver@.service
Here, do not forget to add your user name with the “User” command:
sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver
@1.service
Check out the status of your VNC service:
sudo systemctl status vncserver@1.service
The output signifies VNC service is running on the Ubuntu system:
The main concept behind the connection of the VNC server is to create an SSH tunnel that allows traffic from the port “5901” of the system. If you want to connect to a VNC server, then check out the syntax of the following SSH command:
ssh -L 5901:127.0.0.1:5901 -N -f -l username ip address
Here, the “-l” option is added to specify the user login name, “-f” enables ssh to run in the background, and the “-N” option checks if we added the username or not (length is zero or not).
For creating an SSH tunnel on our system, we will execute this command:
ssh -L 5901:127.0.0.1:5901 -N -f -l linuxhint-VBox 192.168.43.1
After this, open your VNC viewer application and connect it to the VNC Server at your localhost port 5901 “localhost:5901”.
Virtual Network Computing or VNC enables Ubuntu users to properly manage the application, their settings and files that exist on a remote server. It permits them to have complete control by sharing the desktop system. In this guide we showed how to install and setup VNC on Ubuntu. Want to try remotely accessing a system? Try out our provided method in your Ubuntu system!
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…