@H_301_0@确保桌面已安装
@H_301_0@yum -y install xorg-x11-app*
@H_301_0@yum-yinstalltigervnctigervnc-servertigervnc-server-module
@H_301_0@cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
@H_301_0@
@H_301_0@vim/etc/systemd/system/vncserver@:1.service
@H_301_0@[Service]
@H_301_0@Type=forking
@H_301_0@# Clean any existing files in /tmp/.X11-unix environment
@H_301_0@ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
@H_301_0@ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
@H_301_0@# 一般账号
@H_301_0@PIDFile=/home/root/.vnc/%H%i.pid
@H_301_0@# root账号
@H_301_0@PIDFile=/root/.vnc/%H%i.pid
@H_301_0@ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
@H_301_0@vncpasswd
@H_301_0@systemctl daemon-reload
@H_301_0@systemctl start vncserver@:1.service
@H_301_0@systemctl enable vncserver@:1.service
@H_301_0@vncserver -list
@H_301_0@
@H_301_0@# firewall-cmd --permanent --add-service="vnc-server" --zone="public"
@H_301_0@# firewall-cmd --reload
@H_301_0@ip:5901(ip:1) 原文链接:https://www.f2er.com/centos/375889.html