One. Installation
Run the following command to install Vncserver as root user;
Yum Install Tigervnc-server
Also run the following command to install the vncviewer;
Yum Install VNC
Stop and disable the firewall;
Systemctl Stop Firewalld.service
Systemctl Disable Firewalld.service
Two. Configuration
Vncviewer is basically not configured;
Vncserver configuration, create a new profile to open windows 1th as an example (you can also open multiple windows at the same time, modify the number), as follows:
Cp/lib/systemd/system/[email protected]/lib/systemd/system/[email Protected]:1.service
Or add one more window:
Cp/lib/systemd/system/[email protected]/lib/systemd/system/[email Protected]:2.service
Edit/lib/systemd/system/[email Protected]:1.service, set user root related parameters, the final content is as follows:
[Unit]Description=Remote desktop service (VNC)After=syslog.target network.target[Service]Type=forking# Clean any existing files in /tmp/.X11-unix environmentExecStartPre=/bin/sh-c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘ExecStart=/sbin/runuser-l root -c "/usr/bin/vncserver %i"PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh-c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :‘ |
[email protected]:1.service - Remote desktop service (VNC) Loaded: loaded (/usr/lib/systemd/system/vncserver@:1.service; enabled) Active: failed (Result: exit-code) since Tue 2015-04-14 10:09:24 CST; 1min 36s ago Process: 3258 ExecStart=/sbin/runuser-l sysadmin -c /usr/bin/vncserver%i (code=exited, status=1/FAILURE) Process: 3254 ExecStartPre=/bin/sh-c /usr/bin/vncserver-kill%i > /dev/null2>&1 || : (code=exited, status=0/SUCCESS)Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Starting Remote desktop service (VNC)...Apr 14 10:09:24 F1A-VMHOST-SWPE runuser[3258]: Password:Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: [email protected]:1.service: control process exited, code=exited status=1Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Failed to start Remote desktop service (VNC).Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Unit [email protected]:1.service entered failed state.Warning: Unit filechanged on disk, ‘systemctl daemon-reload‘recommended. |
Three. Application
Update Systemctl to make it effective;
Systemctl Daemon-reload
Set the vncserver password;
VNCPASSWD Root
Follow the prompts to enter your password and confirm your password
Start the 1th window that the service uses to enable VNC;
Systemctl start [email protected]:1.service or vncserver:1
Close Window # 1th:
Systemctl Stop [email protected]:1.service or vncserver-kill:1
set to boot automatically;
Systemctl Enable [email protected]:1.service
End.
CentOS Configuration Vncserver