how to install vnc server on ubuntu

Install and connect to VNC server on Ubuntu

It is often useful to be able to access a remote machine from a different machine. This is especially true when you are working on a remote server and you want to be able to see what is going on. This is where VNC comes in. VNC stands for Virtual Network Computing and it allows you to access a remote machine from a different machine. This is done by using a VNC client to connect to a VNC server on the remote machine. The VNC server will then send the screen of the remote machine to the VNC client. The VNC client will then display the screen of the remote machine on your local machine. This allows you to control the remote machine from your local machine.

In this article, I will show you how to install VNC server on Ubuntu. I will also show you how to connect to the VNC server from a VNC client on a different machine.

Install VNC server

To install VNC server on Ubuntu, run the following command:


sudo apt update
sudo apt install lightdm
sudo reboot
sudo apt install x11vnc

sudo nano /lib/systemd/system/x11vnc.service

Add the following to the file:


[Unit]
Description=x11vnc service
After=display-manager.service network.target syslog.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -forever -display :0 -auth guess -passwd mint
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure

[Install]
WantedBy=multi-user.target

Save file and run these commands


systemctl daemon-reload
systemctl enable x11vnc.service
systemctl start x11vnc.service
systemctl status x11vnc.service

Connect to VNC server

To connect to the VNC server, you will need a VNC client. There are many VNC clients available. I will be using TightVNC on Windows 10. To connect to the VNC server, run the following command:


x11vnc -display :0 -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared

Or you can use GUI to connect to the VNC server. To do this, follow these steps:

  1. Make sure TightVNC is installed on your local machine.
  2. Open TightVNC.
  3. Click on the “New” button.
  4. Enter the IP address of the remote machine in the “Host” field.
  5. Enter the port number of the VNC server in the “Port” field.
  6. Enter the password of the VNC server in the “Password” field.
  7. Click on the “OK” button.

You should now be connected to the VNC server. You should now be able to see the screen of the remote machine on your local machine.