Centos7 安装图形化桌面

Linux是一个多任务的多用户的操作系统,好多Linux爱好者在安装完Linux后经常遇到一个问题——没有图形化桌面,今天小编在安装RHEL7的时候,一不留神没有安装图形化桌面,下面分享一下安装图形化桌面的过程。


一、RHEL7系统安装——发现默认没有桌面

在安装的时候没有注意选择时,默认是“Minimal Install”,安装完后是这个样子的:

Centos7 安装图形化桌面

Centos7 安装图形化桌面

命令行的界面好不爽。登录进去,用命令startx启动图形化试试:

Centos7 安装图形化桌面

果然没有安装图形化。下面来进行图形化组件的安装。


二、安装图形化组件


1、先挂载

[plain] view plain copy
 Centos7 安装图形化桌面Centos7 安装图形化桌面
  1. #mount /dev/sr0 /mnt             //把光盘挂载到“/mnt”上面  
  2. #df                              //查看是否已经挂载  

Centos7 安装图形化桌面


2、创建本地yum仓库

验证本地yum仓库,找出需要安装的组件组的包名称

Centos7 安装图形化桌面

[plain] view plain copy
 Centos7 安装图形化桌面Centos7 安装图形化桌面
  1. #yum clean all         //清除yum仓库缓存  
  2. #yum makecache         //创建yum仓库缓存  
  3. #yum repolist          //列出可用yum仓库  
  4. #yum groplist          //列出程序组  

Centos7 安装图形化桌面


3、安装桌面组件包

#yum -y groupinstall "Server with GUI"           //安装图形化程序组

Centos7 安装图形化桌面


三、设置图形化默认启动


1、启动桌面——startx

[plain] view plain copy
 Centos7 安装图形化桌面Centos7 安装图形化桌面
  1. #startx             //启动xwindow进入图形化桌面  

Centos7 安装图形化桌面


Centos7 安装图形化桌面


2、进入图形化,并进行图形化的设置

Centos7 安装图形化桌面


3、设置默认运行级别为图形化

[plain] view plain copy
 Centos7 安装图形化桌面Centos7 安装图形化桌面
  1. [[email protected] Desktop]# systemctl get-default          \\查看默认运行级别  
  2. multi-user.target  
  3. [[email protected] Desktop]# cat /etc/inittab  
  4. # inittab is no longer used when using systemd.  
  5. #  
  6. # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.  
  7. #  
  8. # Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target  
  9. #  
  10. # systemd uses 'targets' instead of runlevels. By default, there are two main targets:  
  11. #  
  12. # multi-user.target: analogous to runlevel 3               \\运行级别3:多用户界面  
  13. # graphical.target: analogous to runlevel 5                  \\运行级别5:图形化界面  
  14. # # To set a default target, run: # # ln -sf /lib/systemd/system/.target  
  15.   
  16. /etc/systemd/system/default.target #  
  17. [[email protected] Desktop]# systemctl set-default graphical.target \\设置默认图形化运行级别  
  18. rm '/etc/systemd/system/default.target'  
  19. ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'  
  20. [[email protected] Desktop]# systemctl get-default                    \\查看默认运行级别  
  21. graphical.target                                                    \\图形化设置OK  
  22. [[email protected] Desktop]#  

Centos7 安装图形化桌面



OK,图形化桌面已经安装好了!!!

ps:linux系统启动后没有进入图形化有以下原因:

①系统在安装的时候没有安装图形化

②系统默认的运行级别不是图形化

③系统在安装后,有降低内存的操作,内存过低无法启动桌面。

解决方案:a、增加内存

            b、查看swap的大小,尝试扩大swap分区

④系统在重启后,软件出现了问题,导致桌面灭有启动


注意:RHEL7在系统上与6有了不同的改变,没有了init运行级别,只有3级别和5级别。