The following is a tutorial for installing a VNC server (VNC Server) on Ubuntu 20.04:
-
Update system:
sudo apt update sudo apt upgrade
-
Install the Xfce desktop environment:
sudo apt install xfce4 xfce4-goodies
-
Install TightVNC server:
sudo apt install tightvncserver
-
Start the VNC server and set the access password:
vncserver
When you run vncserver for the first time, you will be asked to set an access password and confirm the password.
-
Stop the VNC server:
vncserver -kill :1
Note that ":1" is the identifier for the display, if you set a different display number you should change accordingly.
-
Configure the VNC server:
cd ~/.vnc mv xstartup xstartup.bak touch xstartup chmod +x xstartup nano xstartup
Open the xstartup file in an editor and copy paste the following into the file:
#!/bin/bash xrdb $HOME/.Xresources startxfce4 &
-
Restart the VNC server:
vncserver
-
Configure the firewall:
sudo ufw allow 5901
This will allow connections to port 5901 via VNC.
You should now be able to connect to your Ubuntu 20.04 server via a VNC client. Make sure to specify the connection in the format used in the VNC client <IP地址>:5901
. Then enter the VNC access password you set earlier.
Note that VNC connections transmit data in clear text, so it is recommended to use VNC in a secure network environment and set a strong password to ensure security.
Hope this tutorial helps you!