确保桌面已安装
yum -y install xorg-x11-app*
yum-yinstalltigervnctigervnc-servertigervnc-server-module
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vim/etc/systemd/system/vncserver@:1.service
[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=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
# 一般账号
PIDFile=/home/root/.vnc/%H%i.pid
# root账号
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
vncpasswd
systemctl daemon-reload
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service
vncserver -list
# firewall-cmd --permanent --add-service="vnc-server" --zone="public"
# firewall-cmd --reload
ip:5901(ip:1)