tigervnc-server安装
#vncserver安装方法
#su - root
rpm -ivh tigervnc-server-1.8.0-13.el7.x86_64.rpm
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
sed -ri 's/\<USER\>/root/g' /etc/systemd/system/vncserver@:1.service
sed -i 's/home\///g' /etc/systemd/system/vncserver@:1.service
#vim /etc/systemd/system/vncserver@:1.service #修改<USER>为root
#ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
#PIDFile=/root/.vnc/%H%i.pid
vncpasswd
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl restart vncserver@:1.service
systemctl status vncserver@:1.service
如果提示
PID file /root/.vnc/gsmc:1.pid not readable (yet?) after start.
执行mv /tmp/.X11-unix /tmp/.X11-unix_bak正常
systemctl restart vncserver@:2.service
#su - gsmc -c 'vncpasswd'
#systemctl stop vncserver@:1.service
#systemctl start vncserver@:1.service
#killall Xvnc
#vncviewer:root用IP:1
#echo n|vncpasswd<<EOF
#123123
#123123
#EOF
vnc共享当前桌面
还要加一个桌面终端参数,一般而言是显示器的console输出桌面号:0.0
x0vncserver PasswordFile=~/.vnc/passwd display=':0.0' 2>1 >/dev/null &
这样就可以了.
设置同一个显示端口可以连接多个客户机
# vncserver -alwaysshared
python