确保桌面已安装@H_502_2@
yum -y install xorg-x11-app*
yum-yinstalltigervnctigervnc-servertigervnc-server-module
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
@H_502_2@
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@H_502_2@
systemctl daemon-reload
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service
vncserver -list@H_502_2@
# firewall-cmd --permanent --add-service="vnc-server" --zone="public"
# firewall-cmd --reload
ip:5901(ip:1)
原文链接:https://www.f2er.com/centos/375889.html