1、
yum install tigervnc-server
2、
vncpasswd
#设置密码
3、
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
4、
vim /etc/systemd/system/vncserver@\:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[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 1366×1024”
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
[Install]
WantedBy=multi-user.target
5、
systemctl daemon-reload systemctl restart vncserver@:1 systemctl enable vncserver@:1