Home > Article > Operation and Maintenance > How to enable vnc service in centos7
The following is the tutorial column of centos to introduce to you centos 7 to open the vnc service, I hope it will help you if you need it Friends help!
CentOS7 configuration VNC
1. Installation
Run the following command as root user to install vncserver;
yum install tigervnc-server
Also run the following command to install vncviewer;
yum install vnc
Stop and disable the firewall;
systemctl stop firewalld.service systemctl disable firewalld.service
2. Configuration
vncviewer basically does not need to be configured;
For the configuration of vncserver, create a new configuration file, taking opening window No. 1 as an example (you can also open multiple windows at the same time, just modify the number), the method is as follows:
cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service
Or add another window:
cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service
Edit /lib/systemd/system/vncserver@:1.service, set user root related parameters
[Service] Type=forking # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i -geometry 800x600" PIDFile=/root/.vnc/%H%i.pid ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
Three .Apply
Update systemctl to make it effective;
systemctl daemon-reload
Set the password for vncserver;
vncpasswd root
Enter the password and confirm the password as prompted
Start the service to enable window No. 1 of vnc;
systemctl start vncserver@:1.service 或者 vncserver :1
Close window No. 1:
systemctl stop vncserver@:1.service 或者 vncserver -kill :1
Set to start automatically at boot;
systemctl enable vncserver@:1. service
End.
The above is the detailed content of How to enable vnc service in centos7. For more information, please follow other related articles on the PHP Chinese website!