当前位置: 首页>>技术教程>>正文


如何在CentOS 7上安装桌面环境?方法汇总

Centos 7安装桌面问题描述

我最近安装了CentOS 7,当时做的是最小安装,没有GUI,而现在我想在其中安装一个GUI环境,那么,如何在先前安装的CentOS 7上安装桌面环境而不用重新安装系统呢?

常用的解决方案汇总

1.安装GNOME桌面:

  1. 安装GNOME桌面环境。

    # yum -y groups install "GNOME Desktop" 
    
  2. 完成安装后输入如下所示的命令:

    # startx 
    
  3. 这个命令会启动GNOME桌面环境。对于首次启动,初始设置功能会运行,您必须进行首次使用的配置。

    • 首先选择系统语言。

    • 然后选择键盘类型。

    • 添加在线帐户,这个事可选的。

    • 最后点击“开始使用CentOS Linux”。

  4. GNOME桌面环境如下图所示:

centos,gui,desktop-environment,unix-linux

如何使用GNOME Shell?

CentOS 7默认的GNOME桌面以经典模式开始,但如果要使用GNOME Shell,则需要做如下设置:

选项A:如果使用startx启动GNOME,请设置如下:

# echo "exec gnome-session" >> ~/.xinitrc
# startx 

选项B:设置系统图形登录systemctl set-default graphical.target并重启系统。系统启动后

  1. 单击位于”Sign In”按钮旁边的按钮。

  2. 在列表中选择”GNOME”。 (默认是GNOME Classic)

  3. 单击”Sign In”并使用GNOME Shell登录。

centos,gui,desktop-environment,unix-linux

  1. GNOME shell启动如下:

centos,gui,desktop-environment,unix-linux

2.安装KDE桌面:

  1. 这样安装KDE桌面环境。

    # yum -y groups install "KDE Plasma Workspaces" 
    
  2. 完成安装后输入如下所示的命令:

    # echo "exec startkde" >> ~/.xinitrc
    # startx
    
  3. KDE桌面环境启动如下:

centos,gui,desktop-environment,unix-linux

3.安装Cinnamon桌面环境:

  1. 安装Cinnamon Desktop Environment介绍如下。首先添加EPEL存储库(从Fedora项目提供的EPEL存储库)Extra Packages for Enterprise Linux (EPEL)

    • 如何添加EPEL存储库?

      # yum -y install epel-release
      
      # sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo # set [priority=5]
      # sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/epel.repo # for another way, change to [enabled=0] and use it only when needed
      # yum --enablerepo=epel install [Package] # if [enabled=0], input a command to use the repository
      
    • 现在从EPEL Repository安装Cinnamon桌面环境:

      # yum --enablerepo=epel -y install cinnamon*
      
  2. 完成安装后输入如下所示的命令:

    # echo "exec /usr/bin/cinnamon-session" >> ~/.xinitrc
    # startx 
    
  3. Cinnamon桌面环境将开始。对于首次启动,初始设置功能运行,必须进行首次使用的配置。

    • 首先选择系统语言。

    • 然后选择键盘类型。

    • 请添加在线帐户,这个事可选项。

    • 最后点击“开始使用CentOS Linux”。

  4. Cinnamon桌面环境如下图所示:

centos,gui,desktop-environment,unix-linux

4.安装MATE桌面环境:

  1. 这样安装MATE桌面环境。

    # yum --enablerepo=epel -y groups install "MATE Desktop"
    
  2. 完成安装后输入如下所示的命令:

    # echo "exec /usr/bin/mate-session" >> ~/.xinitrc 
    # startx
    
  3. MATE桌面环境启动。

centos,gui,desktop-environment,unix-linux

5.安装Xfce桌面环境:

  1. 这样安装Xfce Desktop Environment。

    # yum -y groupinstall X11
    # yum --enablerepo=epel -y groups install "Xfce" 
    
  2. 完成安装后输入如下所示的命令:

    # echo "exec /usr/bin/xfce4-session" >> ~/.xinitrc 
    # startx
    
  3. 启动Xfce桌面环境。

centos,gui,desktop-environment,unix-linux

参考资料

本文由《纯净天空》出品。文章地址: https://vimsky.com/article/3604.html,未经允许,请勿转载。