YUM install Centos_linux install GNOME desktop environment on Centos 6/7

YUM install Centos_linux install GNOME desktop environment on Centos 6/7


CentOS is very common as a server operating system, but it is rarely used as a desktop environment because of the need for stability and not very trendy updates.

CentOS is very common as a server operating system, but it is rarely used as a desktop environment because of the need for stability and not very trendy updates. There is usually no need to install a desktop environment on the server, and a minimal installation of CentOS (that is, minimal CentOS) is sufficient. However, it is also very convenient to install the desktop environment through YUM in a minimally installed CentOS.

The unit's server let me install the minimal CentOS operating system. But my colleague said it was inconvenient to operate, so I tried it and recorded this installation method by the way. A GUI desktop system can be easily installed using the yum groupinstall command.
 

1. yum's group command

yum can install complete packages in program group mode. Supported packages are available via,

# yum grouplist

Queried. In the group package,

  • For  CentOS 6 , Desktop, Desktop Platform, KDE Desktop, X Window System are the main desktop environments.

  • For  CentOS 7 , there are two desktop environments, KDE Plasma Workspaces and Gnome Desktop.

The returned result on CentOS 7 is as follows,

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.usc.edu
 * extras: mirror.lug.udel.edu
 * updates: mirror.cogentco.com
Available environment groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Installed groups:
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Security Tools
   System Administration Tools
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Scientific Support
   Smart Card Support
   System Management
Done

The package list is displayed according to the language used by the system, and supports Simplified Chinese file names. Therefore, it is best to check with the above command before installation. If the system uses Simplified Chinese and the installation instructions use English, it may cause errors such as not being able to query the software package. The following installation instructions are in English.

2. Install a graphical desktop environment

Cent OS 7

The desktop environment installation package mix on CentOS 7 has been tweaked to make it easier than ever. There are two main camps, KDE and GNOME.


To install the KDE desktop environment (using Plasma as the default desktop manager, it's beautiful, see here),

# yum groupinstall "KDE Plasma Workspaces"

To install the GNOME environment,

# yum groupinstall "GNOME Desktop"

安装程序会自动解决安装包和组件的依赖关系。

 CentOS 6

要安装 KDE 桌面环境,执行指令,

# yum groupinstall "X Window System" "KDE Desktop" Desktop

即可,同时安装了 3 个软件包。注意,因为 KDE Desktop 和  X Window System 两个软件包名称中间都包含空格,需要用引号引起来才行。

要安装 Gnome 桌面环境,执行指令,

# yum groupinstall "X Window System" "Desktop Platform" Desktop

即可,也是同时安装了 3 个软件包,其中 X Window System 是必须的,不管是 Gnome 还是 KDE。

既然是桌面环境,可能还需要诸如字体、管理工具之类的,如,

# yum -y groupinstall "Graphical Administration Tools"
# yum -y groupinstall "Internet Browser"
# yum -y groupinstall "General Purpose Desktop"
# yum -y groupinstall "Office Suite and Productivity"
# yum -y groupinstall "Graphics Creation Tools"

3. 启用

从命令行直接启动图形桌面环境,

# startx

这样就会启动默认的 Gnome 或者 KDE 桌面环境。如果有人喜欢同时安装 GNOME 和 KDE,切换方法可以参考 CentOS 文档。

如果希望启动时自动启动到图形桌面,需要修改启动配置。因为 CentOS 7 开始使用 systemd 管理器,其操作方式与之前版本有所不同。

CentOS 7

CentOS 7 中直接使用 systemd 指令修改启动目的状态即可。

使用,

# systemctl get-default

可以查询到当前所设定的状态。multi-user.target 相当于以前的 level 3,也就是命令行终端;而 graphical.target 相当于以前的 level 5,也就是图形界面。

所以如果要设置默认启动到图形界面,则执行,

# systemctl set-default graphical.target

CentOS 6 等

编辑 /etc/inittab,将 id:3:initdefault: 改为 id:5:initdefault:。(请注意这里的英文半角冒号。)参考这里。

直接用 sed 会很方便,

sed -i 's/id:3:initdefault:/id:5:initdefault:/' /etc/inittab

启动图形界面后,如果希望从图形界面切换到命令行界面,可以用 Ctrl + Alt + F6(实际上 F1 到 F6 都行,不过它们代表 Linux 中不同的控制台),或者反过来 Ctrl + Alt + F7 回到刚才的图形界面。


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324822113&siteId=291194637