yum install tigervnc-server tigervnc vnc vnc-server
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vim /etc/systemd/system/vncserver@:1.service
找到这一行
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
这里直接用root 用户登录,所以我替换成
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
systemctl daemon-reload
vncpasswd
Would you like to enter a view-only password (y/n)? n #注意表示"是否输入一个只能查看的密码,选择否",否则连接vnc会出现黑屏
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
systemctl stop vncserver@:1.service
systemctl status vncserver@:1.service
locale -a|grep zh_CN #查看语言支持
vim /etc/locale.conf #修改为zh-CN.utf-8
reboot