CentOS 6.0 VNC remote desktop configuration method

Time:2021-8-30

VNC (Virtual Network Computing) is the abbreviation of virtual network computer. VNC is an excellent remote control tool software developed by the famous European Research Laboratory of at & T. VNC is a free open source software based on UNIX and Linux operating systems. Its remote control capability is powerful, efficient and practical. Its performance can be comparable to any remote control software in windows and MAC. In Linux, vnc includes the following four commands: vncserver, vncviewer, vncpasswd, and vncconnect. In most cases, I only need two of these commands: vncserver and vncviewer.

VNC basically belongs to a display system, that is, it can transmit the complete window interface to the screen of another computer through the network. The “terminal server” contained in the windows server, the charging software PcAnyWhere developed by Symantec, the recently popular TeamViewer, domestic Xietong XT800 and express KDT all belong to this principle, At the same time, these software have made corresponding improvements based on the principle of VNC, improving the ease of use, connectivity and permeable intranet (TeamViewer, Xietong XT800, KDT)

You must understand:

When calling vncserver, the listening port on the server side will be enabled according to your configuration. By default, the port starts from 5900, plus your desktop number.

• for example, if your desktop number is 1, the connection port number of VNC is 5900 + 1 = 5901
• for example, if your desktop number is 10000, the connection port number of VNC is 5900 + 10000 = 15900
Next, configure the VNC server so that the user (root) can remotely connect to the graphical interface of the Linux system through the VNC client (provided that your server is installed on the desktop)

1. Check whether VNC is installed on Linux system

Enter the command in the terminal window:

Copy code

The code is as follows:

rpm -q vnc-server

The returned information is as follows

Copy code

The code is as follows:

package vnc-server is not installed

Description VNC server is not installed

2. Run the following command to install:

Copy code

The code is as follows:

yum install vnc vnc-server

3. Start VNC service

Copy code

The code is as follows:

vncserver
You will require a password to access your desktops.
Password:
Verify:

You will be prompted to enter the password, which is required for remote login. Enter the password and press enter

4. Switch to the root account: Su root, and then enter the password of the root account

Copy code

The code is as follows:

VI / etc / sysconfig / vncservers #vnc configuration file
Vncservers = “10000: root” # cancel the previous # 10000: root (desktop number: user) # vncservergas [2] = “- geometry 800×600 – nolisten TCP – localhost”

Last save exit

5. Configure the firewall to allow port 10000 + 5900 = 15900 to pass through the firewall (otherwise the VNC server cannot be connected remotely)

Copy code

The code is as follows:

vi /etc/sysconfig/iptables
-A input – M state — state new – M TCP – P TCP — dport 15900 – J accept

Save exit

6. Restart VNC server

Copy code

The code is as follows:

/etc/init.d/vncserver restart
perhaps
service vncserver restart

7. Restart the firewall to make the port configuration take effect

Copy code

The code is as follows:

/etc/init.d/iptables restart
service iptables restart

8. Set VNC server to start automatically after startup

The first method: use the “ntsysv” command to start the graphical service configuration program, add an asterisk in front of the vncserver service, and click OK to complete the configuration.
The second method: use “chkconfig” to operate in command line mode. The command is as follows

Copy code

The code is as follows:

chkconfig vncserver on
chkconfig –list vncserver
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off

9. Change VNC connection password

Copy code

The code is as follows:

vncpasswd

At this point, the VNC server is set up and can be connected with the VNC client

VNC server: your IP: 15900

Note: if a gray screen appears after connection, you can set it according to the following method

Enter the user’s home directory, CD / home / user

If you log in with the root account, the current directory is the user root directory

Copy code

The code is as follows:

cd ~/.vnc
VI xstartup # editing
#TWM & # comment out this line
Gnome session & # add this line

Save and exit to connect normally!

It’s done here. You can use it next http://IP:port Web login, for example

http://IP:5801 , you can also log in with IP: 1 in vncviewer.

Recommended Today

Ios15 adaptation

Need immediate modification 1. Uinavigationbar, uitoolbar and uitabbar styles Uinavigationbar, uitoolbar and uitabbar need to use uibarappearance APIs to set colors. // UINavigationBar let navigationBarAppearance = UINavigationBarAppearance() navigationBarAppearance.backgroundColor = .red navigationController?.navigationBar.scrollEdgeAppearance = navigationBarAppearance navigationController?.navigationBar.standardAppearance = navigationBarAppearance // UIToolbar let toolBarAppearance = UIToolbarAppearance() toolBarAppearance.backgroundColor = .blue navigationController?.toolbar.scrollEdgeAppearance = toolBarAppearance navigationController?.toolbar.standardAppearance = toolBarAppearance // UITabBar let tabBarAppearance […]