一、安裝圖形化界面
yum group install "GNOME Desktop" "Graphical Administration Tools"
參考
https://www.itzgeek.com/how-tos/linux/centos-how-tos/install-gnome-gui-on-centos-7-rhel-7.html
二、安裝vncserver
yum install tigervnc-server
#增加用戶和密碼
useradd erico
password erico
#配置vncserver
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
#修改配置 vim /etc/systemd/system/vncserver@:1.service
[Service]Type=forking# Clean any existing files in /tmp/.X11-unix environment ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'# #ExecStart=/sbin/runuser -l-c "/usr/bin/vncserver %i"# #PIDFile=/home//.vnc/%H%i.pid
ExecStart=/sbin/runuser -l erico -c "/usr/bin/vncserver %i"
PIDFile=/home/erico/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#切換到用戶erico 配置vncserver 登錄密碼
su - erico
vncserver
#啟動vncserver 服務
su - root
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
#完成 erico 用戶可遠端vnc 登錄。端口為 5901
#如需配置root用戶也可遠端vnc登錄,配置如下:
#在root用戶環境下
vncserver #配置root的vnc登錄密碼
#執行后,root的vnc登錄 端口為:5902 (端口+1)