Home > Operation and Maintenance > CentOS > How to enable vnc service in centos7

How to enable vnc service in centos7

藏色散人
Release: 2021-04-12 16:34:34
forward
7219 people have browsed it

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
Copy after login

Also run the following command to install vncviewer;

yum install vnc
Copy after login

Stop and disable the firewall;

systemctl stop firewalld.service
systemctl disable firewalld.service
Copy after login

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
Copy after login

Or add another window:

cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service
Copy after login

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 || :'
Copy after login

Three .Apply

Update systemctl to make it effective;

systemctl daemon-reload
Copy after login

Set the password for vncserver;

 vncpasswd root
Copy after login

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
Copy after login

Close window No. 1:

systemctl stop vncserver@:1.service   或者 vncserver -kill :1
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template