Configure vncserver in CentOS7
1. Run the following command as root to install TigerVNC server
Yuminstalltigervnc-server
You can also install the vnc client
Yuminstallvnc
2. Configure the VNC Server
2.1 create a new configuration file. Here I open window 3, as follows:
Cp/lib/systemd/system/vncserver @. service/lib/systemd/system/vncserver @: 3. service
2.2 edit/lib/systemd/system/vncserver @: 3. service and set zhongq parameters. The final content is as follows: (here, zhongq must be replaced with your account)
Unzip unitshortdescriptionappsremoteshorttopservice(vnc?after=syslog.targetnetwork.tar get [Service] Type = forking # Cleananyexistingfilesin/tmp /. x11-unixenvironmentExecStartPre =/bin/sh-c '/usr/bin/vncserver-kill % I>/dev/null2> & 1 |: 'execstart =/sbin/runuser-lzhongq-c "/usr/bin/vncserver % i-geometry1024x768" PIDFile =/home/zhongq /. vnc/% H % I. pidExecStop =/bin/sh-c '/usr/bin/vncserver-kill % I>/dev/null2> & 1 |: '{install}wantedby}multi user.tar get
2.3 update systemctl to make sure it takes effect
Systemctldaemon-reload
2.4 set the user's vnc Password
Vncpasswdzhongq
2.5 start the service to enable vnc's window 3
Systemctlstartvncserver @: 3. service or vncserver: 3
Close Window 3
Systemctlstopvncserver @: 3. service or vncserver-kill: 3
2.6 We can also set it to boot automatically
Systemctlenablevncserver @: 3. service