yum install epel-release -y
yum grouplist #其中Available Groups代表未安装的分组
如果系统中已安装会提示在Installed 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
设置vnc密码:
启动: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
客户端远程连接:
http://mirror.xrk.org/vnc/VNC-Viewer-6.20.113-Windows.exe
输入ip:1连接:
192.168.1.100:1
附件下载 https://www.cnop.net/uploadfile/2020/0328/20200328014555868.zip
一键安装脚本:
bash <(curl -s https://gitee.com/cnop/shell/raw/master/Xfce.sh)