Install Ubuntu Server 22.04
- Install Ubuntu Server 22.04
- Reset login password, default user name ubuntu
Add user
It is not recommended to use the default user directly. Add a user (demodeom)
sudo adduser demodeom
Add demodeom to sudoer file
sudo visudo
Add at the end of the file
demodeom ALL=(ALL:ALL) NOPASSWD: ALL
ctrl + o
Then press Enter to save and ctrl + x
exit edit mode.
Switch users, and use the demodem user for subsequent operations.
Install desktop version
Update software repository
sudo apt update
Upgrade software
sudo apt upgrade
Install desktop
sudo apt install ubuntu-desktop
Restart
sudo reboot
After restarting, use the VNC login method provided by Tencent Cloud to access the Ubuntu desktop version
VNC
VNC remote desktop login tool
Install a compatible display manager
Ubuntu Linux uses GNOME Desktop Manager (GDM) as the default display manager. Newer versions of Ubuntu use gdm3. Unfortunately, GDM generally doesn't work well with x11vnc servers. To overcome this problem, you will have to install Light Display Manager or lightdm.
sudo apt install lightdm
The following screen will appear during the installation process. Press the Enter key on your keyboard to continue.
Next, select the lightdm option and press Enter key on your keyboard
Restart your PC for the display manager changes to take effect.
sudo reboot
Install x11vnc server
Install x11nvc server
sudo apt install x11vnc
Configure x11vnc server
You will now configure the service that starts the x11nvc server. Create a file named x11nvc.service in the /lib/systemd/system/ directory
sudo vim /lib/systemd/system/x11vnc.service
Copy and paste the following content into the newly created service file (be careful not to copy everything, be sure to change the login password)
[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 登陆密码
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
[Install]
WantedBy=multi-user.target
Reload systemd manager configuration
sudo systemctl daemon-reload
Then, enable the x11vnc service
sudo systemctl enable x11vnc.service
Finally, use the following command to start the VNC server.
sudo systemctl start x11vnc.service
Use systemctl to check the status of the x11vnc service
systemctl status x11vnc.service
The output should look similar to the image below.
Enable server port in firewall
The port used by the x11vnc server 5900
needs to open port 5900 in Tencent Cloud’s firewall.
Connect from another computer
You can now connect to your Ubuntu system via Remote Desktop Connection using VNC
You can use any VNC client to connect to your Ubuntu Linux PC. One of the recommended VNC viewers is VNC Connect by RealVNC. It works on nearly all major platforms, including macOS, Linux, Windows, iOS, Android, and more
RealVNC
Install VNC Viewer
- Download the Linux version of the compressed package VNC-Connect-Installer-1.3.0-Linux-x64.tar.gz
- After unzipping, run VNC-Connect-Installer-1.3.0-Linux-x64
- Select Install VNC Viewer Install VNC Viewer
VNC Viewer
-
Run VNC Viewer
-
Enter the IP address of the PC you want to connect to, and then enter the port number used by the x11vnc server. Then, press the Enter key on your keyboard to connect.