CentOS Linux:
1. Packages to be installed: tigervnc and tigervnc-server
2. Configure the display resolution, desktop, and User:
Edit/etc/sysconfig/vncservers
Add two lines according to the last two lines commented out.
The code is as follows: |
Copy code |
VNCSERVERS = "2: myname" # Here myname is the user account VNCSERVERARGS [2] = "-geometry 1024 × 768-nolisten tcp" PS: remove-localhost. |
3. Configure the VNC desktop environment and password:
To allow a user to remotely log on to the local machine, you need to switch the user to log on to the local machine to set the desktop environment and password.
The code is as follows: |
Copy code |
Command line execution: $ vncserver
|
The system will prompt you to set the password upon initial execution, and enter the password as prompted.
4. Start the VNC Server service
Log on as an administrator, stop the service, and then start
The code is as follows: |
Copy code |
# Service vncserver stop # Service vncserver start |
5. Add to start
The code is as follows: |
Copy code |
Chkcongfig vncserver on |
Install the VNC client on windows
In Windows, you can use VNC Viewer and Fedora Linux's Remote Desktop Viewer. You can also choose to install other good client software, such as the TightVNC client.
We use VNC Viewer in windows, download address: http://www.realvnc.com/download/viewer/
When trying to connect to the VNC Server of Linux on another PC machine with a VNC client, the following information may appear: unable to connect to host: Connection refused (10061) Chinese: unable to connect to the host, the connection is rejected (10061)
If your VNC configuration is correct and you can check the status of the service vncserver to confirm that the instance has been started, the reason is that the desktop number is not added when the IP address is not entered on the VNC client. If no value is added, the above error will occur. The correct format is IP: 1.
For example, 10.10.23.221: 1. The desktop number is the number in front of the user account we set in/etc/sysconfig/vncservers.
In this way, the connection will be connected and you will be asked to enter the password! Now you can start your VNC journey.