VNC stands for Digital Community Computing. It lets you management your Ubuntu machine remotely. VNC server makes use of the Distant Body Buffer protocol (RFB) to remotely management one other laptop.
When a technical assist employees use keyboard or mouse, VNC will transmit the alerts from keyboard and mouse to the distant server. It makes the administration works simpler and handy with a graphical person interface. Furthermore, VNC is extra dependable than graphical SSH and RDP connections.
This tutorial will undergo the steps of organising and configuring VNC on Ubuntu 20.04 utilizing TightVNC. If you’re working a VNC on the earlier model of Ubuntu 16.04, there’s a information for it.
Set up Desktop Atmosphere and VNC server
Firstly, let’s set up a Desktop Atmosphere in your Ubuntu server as a result of it isn’t put in by default. There are lots of decisions: GNOME, MATE, XFCE, and so forth.
On this tutorial, we’ll select the XFCE. It’s a light-weight desktop setting and it assist the VNC connection will likely be steady and clean.
In your Ubuntu server, run the next command to replace the packages record:
$ sudo apt replace
Then, let’s set up the XFCE desktop setting:
$ sudo apt set up xfce4 xfce4-goodies gnome-icon-theme
Right here I’m utilizing TightVNC server, different common VNC servers are TigerVNC and x11vnc.
Set up tightvnc:
$ sudo apt set up tightvncserver
Subsequent, let’s run a VNC server occasion and it’s a must to set a password for the put in that server:
As we have now are beginning server first time after set up it can ask us to set a password that consumer use to attach. It should additionally ask to set view-only password which is able to permit the person to see the display however not work together with it.
Famous that the password size is between 6 and eight characters. When you enter the longer password, will probably be mechanically trim off.
If you wish to change the password of the VNC server, let’s run:
Configure the VNC server
While you begin VNC server occasion for the primary time, the preliminary configuration file will likely be created: ‘~/.vnc/xstartup’ and the VNC server listens on port 5901. We name this port as a show port. We will launch many situations of the VNC server and every occasion has its personal show ports: the primary show listens on port 5901, the second show listens on port 5902 and so forth.
It’s a necessity to configure the VNC server to run together with the Ubuntu server startup. In addition to, it’s a must to explicitly point out which Desktop Atmosphere the VNC server will hook up with.
Firstly, let’s cease the present VNC server occasion which is working on TCP port 5901:
$ vncserver -kill :1
Then backup the present configuration file:
$ cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
Now, modify the ‘xstartup’ file along with your favourite editor as under:
Restart the VNC server:
$ vncserver -localhost
Connect with the VNC server
By default, the VNC server does not use the safe protocol. To be able to safe the connection to the remotely Ubuntu server, it’s a must to create a SSH tunnel and point out that the VNC consumer hook up with VNC server by means of that tunnel.
Let’s set up a SSH connection on the native machine that forwards site visitors to the ‘localhost’ for VNC. Launch the terminal in your native machine (macOS or Linux), run the next command:
$ ssh -L 59000:localhost:5901 -C -l
-L 59000:localhost:5901: the port on the native machine is 59000 will likely be forwarded to the vacation spot server: localhost:5901
-C: compress the info to hurry up the connection
-l : point out the person that you’ll login to and the IP handle of the Ubuntu 20.04 server
Arrange SSH Tunneling on Home windows
In case of working a Home windows OS, you’ll be able to setup the SSH tunnel by utilizing PuTTY SSH consumer.
Let’s open the PuTTY then enter the IP handle of your Ubuntu server:
Subsequent, broaden the submenu Connection > SSH > Tunnels, enter ‘5901’ within the ‘Supply port’ and ‘:5901’ within the ‘Vacation spot’. Then, click on on ‘Add’ button because the under:
Through the use of the SSH tunnel, the VNC connection to your Ubuntu 20.04 server solely permit machines which might ssh to the server. It does not permit each machine simply connects to port 5901.
Now, you’ll be able to hook up with the remotely Ubuntu server utilizing the a VNC consumer. On this tutorial, we use the VNC viewer. Open the VNC consumer then enter the server IP handle and the port 5901:
You might have efficiently linked to the XFCE desktop of your Ubuntu server:
You’ll be able to management the server as for those who’re working with a bodily server in your workplace. For instance, you’ll be able to entry the file supervisor, launch a program or open the terminal:
Setup the VNC server as a systemd service
By working the VNC server as a system service, you’ll be able to simply begin, cease or restart it everytime you need.
Let’s create a brand new file referred to as ‘[email protected]’ within the listing ‘/and so on/systemd/system/’ in your Ubuntu server:
$ sudo vim /and so on/systemd/system/[email protected]
Add the next content material to file ‘[email protected]’ and ensure to edit the values in line 7, 8, 9 and 13 match your setting.
Description=Begin TightVNC server at startup
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280×800 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i
Then, reload the system daemon:
$ sudo systemctl daemon-reload
Allow the service:
$ sudo systemctl allow [email protected]
@1.service: the primary show affiliate with port 5901.
Kill the occasion is working:
$ vncserver -kill :1
Killing Xtightvnc course of ID 3159
Then begin that systemd service once more:
$ sudo systemctl begin [email protected]
Now, you’ll be able to confirm whether or not the service runs accurately:
$ sudo systemctl standing [email protected]
● [email protected] – Begin TightVNC server at startup
Loaded: loaded (/and so on/systemd/system/[email protected]; enabled; vendor preset: enabled)
Lively: energetic (working) since Solar 2020-08-16 17:37:51 UTC; 2min 2s in the past
Course of: 4611 ExecStartPre=/usr/bin/vncserver -kill :1 > /dev/null 2>&1 (code=exited, standing=2)
Course of: 4615 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280×800 -localhost :1 (code=exited, standing>
Principal PID: 4623 (Xtightvnc)
Duties: 129 (restrict: 7125)
On this tutorial, we realized set up and configure VNC server on Ubuntu 20.04. Now, you’ll be able to handle your remotely Ubuntu server with a graphical person interface.
Thanks for studying and please depart your suggestion within the under remark part.