First, try installing VNC on the server.
[Root @ wic ~] # Rpm-q tigervnc-server
If it is not installed, it will appear directly
Package tigervnc is not installed
Package tigervnc-server is not installed
If the X-Windows desktop is not installed, install Xwindows first.
[Root @ wic ~] # Yum check-update
[Root @ wic ~] # Yum groupinstall "X Window System"
[Root @ wic ~] # Yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
[Root @ wic ~] # Unlink/etc/systemd/system/default.tar get
[Root @ wic ~] # Ln-sf/lib/systemd/system/graphical.tar get/etc/systemd/system/default.tar get
[Root @ wic ~] # Reboot
Step 1: install VNC packages:
[Root @ wic ~] # Yum install tigervnc-server-y
Step 2: modify the configuration information and create a vncserver folder under/etc/systemd/system/@: 1. service extracts the example config file from/lib/systemd/system/vncserver @. copy service to it
[Root @ wic ~] # Cp/lib/systemd/system/vncserver @. service/etc/systemd/system/vncserver @: 1. service
Open the configuration file/etc/systemd/system/vncserver @: 1. Replace the default user name with the service.
Find this line
ExecStart =/sbin/runuser-l <USER>-c "/usr/bin/vncserver % I"
PIDFile =/home/<USER>/. vnc/% H % I. pid
Here I log on directly with the root user, so I replaced it
ExecStart =/sbin/runuser-l root-c "/usr/bin/vncserver % I"
PIDFile =/root/. vnc/% H % I. pid
For other users, replace john with the following:
ExecStart =/sbin/runuser-l <USER>-c "/usr/bin/vncserver % I"
PIDFile =/home/<USER>/. vnc/% H % I. pid
Step 3: Reload systemd
[Root @ wic ~] # Systemctl daemon-reload
Step 4: set a password for VNC
[Root @ wic ~] # Vncpasswd
Step 5: because Centos 7 on my side uses iptable firewall
Vim/etc/sysconfig/iptables
Add
-A input-m state -- state NEW-m tcp-p tcp -- dport 5900: 5903-j ACCEPT
Restart iptable
Service iptables restart
If you use the Centos 7 default firewall, you may need
[Root @ wic ~] # Firewall-cmd -- permanent -- add-service vnc-server
[Root @ wic ~] # Systemctl restart firewalld. service
Step 6: Enable and enable VNC by default
[Root @ wic ~] # Systemctl enable vncserver @: 1. service
[Root @ wic ~] # Systemctl start vncserver @: 1. service
In this way, the Centos end is basically set up, and the Windows end will go to the next VNC Viewer software. Try connecting. It looks a little simple but it goes up.