直接上命令
yum -y groupinstall "Server with UKUI GUI"
yum -y install tigervnc-server.x86_64
systemctl get-default
systemctl set-default graphical.target
vncpasswd
vim /root/.vnc/config
--------------
SecurityTypes=VncAuth
BlacklistTimeout=0
BlacklistThreshold=1000000
------------------
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
#修改/etc/systemd/system/vncserver@:1.service,换成root
------
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/root
User=root
Group=root
PIDFile=/root/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i -SecurityTypes=VncAuth BlacklistTimeout=0 BlacklistThreshold=1000000
ExecStop=/usr/bin/vncserver -kill %i
Restart=on-success
RestartSec=15
[Install]
WantedBy=multi-user.target
------
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
默认端口5901
可以reboot下服务器再测试下连接