First, install
1. Run the following command as root to install vncserver;
yum install tigervnc-server
2. Run the following command to install the same vncviewer;
yum install vnc
3. Stop and disable the firewall;
systemctl stop firewalld.service
systemctl disable firewalld.service
Second, copy the configuration file
cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
vim /etc/systemd/system/vncserver@:1.service
Set the user root parameters (the text of "<USER>" Replace username for your system, there are two places
After changing for the better as follows:
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
three,
1. Update systemctl to take effect;
systemctl daemon-reload
2. Set vncserver password;
vncpasswd root
When prompted, enter the password and confirm password
3. Start the service is used to enable vnc No. 1 window;
systemctl start vncserver @: 1.service or vncserver: 1
Close the window No. 1:
systemctl stop vncserver @: 1.service or vncserver -kill: 1
4. The automatic startup is set;
systemctl enable vncserver@:1.service
When the client connects with the ip: 1 to form the connection.