yum install epel-release -y
yum grouplist #其中Available Groups代表未安装的分组
安装软件:
yum groupinstall "X Window system"
yum groupinstall xfce
systemctl isolate graphical.target
安装vnc服务端:
yum install vnc-server tigervnc-server tigervnc-server-module -y
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
修改ExecStart,PIDFile信息为自己的(这里以root为例):
vi /etc/systemd/system/vncserver@:1.service #改动后如下
ExecStart=/usr/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 start vncserver@:1.service
vi /root/.vnc/xstartup #内容如下
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
startxfce4 &
systemctl restart vncserver@:1.service
bash <(curl -s https://gitee.com/cnop/shell/raw/master/Xfce.sh)