Tip: After the article is written, the table of contents can be automatically generated. For how to generate it, please refer to the help document on the right.
Article directory
Preface
I have an article before that discusses the configuration method of VNC based on Ubuntu GDM desktop, using the X11-VNC solution. I think the effect is good, and the speed is absolutely outstanding on the intranet. The problem is that it is compatible with almost every version of Ubuntu, and the configuration is also very simple.
Ubuntu18.04~Ubuntu22.04 install and configure VNC
I found that this method did not work for the distribution version of LightDM desktop, so I devoted myself to research and it was really studied thoroughly by me. If you need it, you can take a look. The method is almost the same as Ubuntu. Here, I found a customized version of firefly system, which is also an Ubuntu system, but the desktop was replaced by lightweight LightDM. This is not the point. No matter which distribution you are, as long as you can install X11-VNC.
1. What is VNC?
When you decide to configure VNC you must already know what VNC is. Of course, in addition to VNC, there are also RDP, Sunflower, Teamviewer, etc. I will only talk about VNC here.
2. System environment
I have successfully configured it on Ubuntu18.04, Ubuntu20.04, and Ubuntu22.04. As for the architecture, aarch64 and x86 are both possible. In theory, risc and mips are also possible, but I don’t have those devices, so I haven’t tested them specifically. Pass.
1.Premise
The premise of everything is based on the Desktop environment, that is, you must have a desktop. I have not studied the Server environment. It may be possible. Please study it yourself.
2. Install x11vnc
This software package comes with the Ubuntu software repository and can be installed using apt.
sudo apt update
sudo apt-get install x11vnc -y
After the installation is complete, set a password for it to ensure security.
sudo x11vnc -storepasswd /etc/x11vnc.pass
Note that you must remember the password. If you forget it and you cannot connect, you will need to execute the above command to reset it. You need to restart x11vnc after each setting. We haven't created a service file for it yet, so we don't need to execute the following restart command yet.
sudo systemctl restart x11vnc
After installing x11vnc, you need to configure a service for it so that it can automatically restart. Create service file.
sudo vim /etc/systemd/system/x11vnc.service
Write the following content into the service file created above and save it. Note that by default these are the components that come with the Ubuntu system. If your desktop is not gdm, the following commands may not take effect, so just keep the operating system as it is.
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
/usr/bin/x11vnc -many -display :0 -no6 -rfbport 5900 -rfbauth /etc/x11vnc.pass -auth /var/run/lightdm/root/:0
[Install]
WantedBy=multi-user.target
Remember that every time you change the unit file, you need to reload it.
sudo systemctl daemon-reload
After configuring the service, you still need to start it manually or restart the operating system. Here we choose to start it manually.
sudo systemctl start x11vnc
After starting, check the status. If an error is reported, it is successful and you can use the software to test. Viewing the status does not require sudo permissions, just normal permissions.
systemctl status x11vnc
Just because the status is running and there are no other errors in the log does not mean that it is fully usable. It still needs to be tested in actual use.
3. Test
It is recommended to use VNV Viewer for testing. This software is the best software I have used. It supports remote commands and can zoom in and out of the desktop. It is very effective for some desktops with small fonts or high resolution. Of course the most important thing is "free".
注意:下载VNC Viewer,不要下载VNC Server,刚才我们配置的就是Server
It can be said that VNC Viewer supports a full range of devices, including Windows (supports 11), MacOs, Linux, Android, IOS, and Raspberry Pi. Basically covers all the equipment we come into contact with every day.
1. How to use
The usage is actually very simple. The default server is port 5900. Do not change it.
file
There is one insideNew connection
. Open the following page. Just fill in VNC Server
and Name
. is actually A logo, for better recognition, you can fill it in with anything. , VNC Server
is the LAN IP of your device just now (WIFI is also acceptable, not limited to wired). There is no need to bring a port. The default is 5900
Name
After filling in, select OK to enter the following certification stage.
If this page comes out, it means that the network is connected and the server has responded. Next, you will enter password authentication. Select Continue to continue
Enter the password you just set and select Remember password (if you check it, you don’t have to enter it every time you connect. Depending on your personal preference, it may increase security risks). Click OK to proceed to the next step. At this point you should be able to enter the remote desktop.
Summarize
The method is quite simple, but of course there are some limitations. Compared with remote connection software, the benefits are still obvious. For example, Sunflower’s free user limit is 300kb. Teamviewer, etc. face various obstacles for non-paying users, so it is better to rely on one’s own efforts without asking for help. Bar.