1.安装桌面环境
通常使用 GNOME 或 XFCE 作为桌面环境,二选一
安装 GNOME 桌面环境
sudo yum groupinstall "GNOME Desktop" "Graphical Administration Tools" -y
安装 XFCE 桌面环境(轻量级)
sudo yum groupinstall "Xfce" -y
2.设置系统启动到图形界面
# 将系统默认启动级别设置为图形化模式
sudo systemctl set-default graphical.target
# 重启系统
sudo reboot
3.安装并配置远程桌面服务
为了从 Windows 或其他平台连接到你的 CentOS 服务器的桌面环境,你需要安装一个远程桌面服务器,比如 xrdp
# 安装 xrdp
sudo yum install epel-release -y
sudo yum install xrdp -y
# 启动并配置 xrdp 服务
sudo systemctl start xrdp
sudo systemctl enable xrdp
最后就可以使用windows自带的远程桌面输入ip(端口默认是3389,可以忽略)进行连接使用了
附
卸载步骤
# 停止并禁用 xrdp 服务
sudo systemctl stop xrdp
sudo systemctl disable xrdp
# 卸载 GNOME 桌面环境(如果安装的 GNOME 桌面环境)
sudo yum groupremove "GNOME Desktop" "Graphical Administration Tools" -y
# 卸载 XFCE 桌面环境(如果安装的 XFCE 桌面环境)
sudo yum groupremove "Xfce" -y
# 恢复系统默认启动级别
sudo systemctl set-default multi-user.target
# 重启系统
sudo reboot
评论区