[root@centos8 ~]# dnf groupinstall “workstation”
或者
[root@centos8 ~]# dnf groupinstall “Server with GUI”
启用图形模式:
[root@centos8 ~]# systemctl set-default graphical
然后
[root@centos8 ~]# reboot
安装VNC配置远程连接
[root@centos8 dnf install -y tigervnc-server tigervnc-server-module
设置 VNC 密码
[root@centos8 ~]# vncpasswd
设置 VNC 服务器配置文件
[root@centos8 ~]# vim /etc/systemd/system/[email protected]
[Unit]
Description=Remote Desktop VNC Service
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/root
User=root
Group=root
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
启动 VNC 服务并允许防火墙中的端口
[root@centos8 ~]# systemctl daemon-reload
[root@centos8 ~]# systemctl start vncserver@:1.service
[root@centos8 ~]# systemctl enable vncserver@:1.service