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 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 another 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/[email protected]: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/null 2>&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 file changed 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.
This article is from the "Feng Xuewei blog" blog, make sure to keep this source http://hsuehwee.blog.51cto.com/10114119/1632211
CENTOS7 Installation Configuration Vncserver/vncviewer