一、图形界面安装

之前直接执行下面程序报错,

yum groupinstall -y "GNOME Desktop"

注意:如果你的centos7是最小化安装的那默认都是不带X WINDOWS的,那在安装图形化界面之前,你得先安装一下X WINDOWS

yum groupinstall "X Window System"

在安装图形化界面:

yum groupinstall -y "GNOME Desktop"

等待。。。。。。

二、安装报错(木有解决)

1.

查找资料:

执行yum update grub2-commonn报错:

根据之前错误提示,执行 yum update grub2-common-1:2.02-0.65.el7.centos.2.noarch,版本升级成功:

2.输入 init 5 没有反应,还在命令行

目前木有解决

三、安装远程桌面(超级卡,不推荐)

之前安装木有问题,但是init 5 和startx都无法切入图形界面,所以后续安装了远程桌面。

首先安装桌面环境,这里安装 GNOME。

yum -y groups install "GNOME Desktop"

关于桌面环境相关命令

# 从命令行切换到桌面环境
startx

# 获取当前启动模式
systemctl get-default

# 修改启动模式为图形化
systemctl set-default graphical.target

# 修改启动模式为命令行
systemctl set-default multi-user.target

默认启动桌面环境后以 root 用户自动登录

# 修改配置文件
vi /etc/gdm/custom.conf


# 增加如下配置
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=root


远程服务设置

# Windows 远程登录需要安装 Xrdp,需要 epel 源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install -y xrdp

# Xrdp 会调用 VNC,安装 tigervnc-server
yum install -y tigervnc-server

# 修改 Xrdp 最大连接数
vim /etc/xrdp/xrdp.ini
max_bpp=32

# 启动 Xrdp 并设置开机启动
systemctl start xrdp
systemctl enable xrdp

# 开放 3389 端口,或者关闭防火墙
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload
# 关闭防火墙
systemctl stop firewalld
# 禁止防火墙开机启动
systemctl disable firewalld
四、峰回路转(之前在xshell执行 init 5 ,不能切换图形界面,虚拟机就好了)

有些其他报错,参考:

  五、卸载图形界面

yum groupremove "GNOME Desktop"