yum groupinstall "GNOME Desktop"
yum install tigervnc-server
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vi /etc/systemd/system/vncserver@:1.service
更改
#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i" #PIDFile=/home/<USER>/.vnc/%H%i.pid ExecStart=/sbin/runuser -l root-c "/usr/bin/vncserver %i" PIDFile=/root/.vnc/%H%i.pid 这两行中的替换为需要通过vnc远程登录的用户名。第二行的/home/是用户的home目录;如果是root则是/root,PIDFile=/root/.vnc/%H%i.pid。 如果有防火墙 firewall-cmd --permanent --zone=public --add-service vnc-server firewall-cmd --reload 设置密码 vncpasswd 启动vnc vncserver 启动运行 systemctl daemon-reload systemctl enable vncserver@:1.service reboot systemctl start vncserver@:1.service xfce yum -y install epel-release yum -y group install "Xfce" yum -y group install "X Window System"
—黑屏处理
vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
vncserver -kill :1
vncserver
文章评论