http://unix.stackexchange.com/questions/181503/how-to-install-desktop-environments-on-centos-7

I have recently installed CentOS 7 (Minimal Install without GUI) and now I want to install a GUI environment in it.

How can I install Desktop Environments on previously installed CentOS7 without reinstalling it?

slm

180k47343514
asked Jan 28 '15 at 7:02
KasiyA

3,83051130
 

2 Answers

up vote164down voteaccepted

1. Installing GNOME-Desktop:

  1. Install GNOME Desktop Environment on here.

    # yum -y groups install "GNOME Desktop"
  2. Input a command like below after finishing installation:

    # startx
  3. GNOME Desktop Environment will start. For first booting, initial setup runs and you have to configure it for first time.

    • Select System language first.
    • Select your keyboard type.
    • Add online accounts if you'd like to.
    • Finally click "Start using CentOS Linux".
  4. GNOME Desktop Environments starts like follows.

How to use GNOME Shell?

The default GNOME Desktop of CentOS 7 starts with classic mode but if you'd like to use GNOME Shell, set like follows:

Option A: If you start GNOME with startx, set like follows.

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

Option B: set the system graphical login systemctl set-default graphical.target and reboot the system. After system starts

  1. Click the button which is located next to the "Sign In" button.
  2. Select "GNOME" on the list. (The default is GNOME Classic)
  3. Click "Sign In" and log in with GNOME Shell.

  1. GNOME shell starts like follows:

2. Installing KDE-Desktop:

  1. Install KDE Desktop Environment on here.

    # yum -y groups install "KDE Plasma Workspaces"
  2. Input a command like below after finishing installation:

    # echo "exec startkde" >> ~/.xinitrc
    # startx
  3. KDE Desktop Environment starts like follows:

3. Installing Cinnamon Desktop Environment:

  1. Install Cinnamon Desktop Environment on here.

    First Add the EPEL Repository (EPEL Repository which is provided from Fedora project.)
    Extra Packages for Enterprise Linux (EPEL)

    • How to add EPEL Repository?

      # 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
    • And now install the Cinnamon Desktop Environment from EPEL Repository:

      # yum --enablerepo=epel -y install cinnamon*
  2. Input a command like below after finishing installation:

    # echo "exec /usr/bin/cinnamon-session" >> ~/.xinitrc
    # startx
  3. Cinnamon Desktop Environment will start. For first booting, initial setup runs and you have to configure it for first time.

    • Select System language first.
    • Select your keyboard type.
    • Add online accounts if you'd like to.
    • Finally click "Start using CentOS Linux".
  4. Cinnamon Desktop Environment starts like follows.

4. Installing MATE Desktop Environment:

  1. Install MATE Desktop Environment on here.

    # yum --enablerepo=epel -y groups install "MATE Desktop"
  2. Input a command like below after finishing installation:

    # echo "exec /usr/bin/mate-session" >> ~/.xinitrc
    # startx
  3. MATE Desktop Environment starts.

5. Installing Xfce Desktop Environment:

  1. Install Xfce Desktop Environment on here.

    # yum --enablerepo=epel -y groups install "Xfce"
  2. Input a command like below after finishing installation:

    # echo "exec /usr/bin/xfce4-session" >> ~/.xinitrc
    # startx
  3. Xfce Desktop Environment starts.

slm

180k47343514
answered Jan 28 '15 at 7:02
KasiyA

3,83051130
 
    
I tried installing mate following your example. Got an error on groups in the yum command but continued to install. Copy/pasted your commands so there weren't any typos. xinit is giving up and not starting mate... what is happening? $ startx xauth: file /home/***/.serverauth.12401 does not exist – Jakke Dec 8 '15 at 1:53 
    
I downloaded the 7GB version of CentOS 7 and installed it on VirtualBox, and surprisingly, there is no GUI. 7GB as compared to Ubuntu's 1GB with GUI. And the step 1 in the answer gave me error "Cannot find a valid baseurl for repo"... oh well... P.S. I just found that it is defaulted to "Minimal installation" during the installation -- you just have to change it to GNOME or something else – 太極者無極而生 Dec 12 '15 at 17:02
    
@太極者無極而生 usually the base url error occurs due to network client not running. If your virtual box network is configured properly the simple give command "dhclient" – Ravi Shekhar Jul 26 '16 at 9:49 
    
I did the XFCE install on a new CentOS 7 VM and it didn't put in the X11 files, so you may also need to run # yum groupinstall X11 That did the trick for me. – Mark Fidell Sep 29 '16 at 10:46 
1  
@KasiyA, can you please update your answer to include that using dhclient works on virtual box for network client not running.. and yum groupinstall X11 is needed, at least for XFCE install... your answer helped a lot, thanks :) – Sundeep Oct 7 '16 at 10:42

Did you find this question interesting? Try our newsletter

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

Rather than make use of the hacking of a startx command into a .xinitrc file, it's probably better to tell Systemd that you want to boot into a graphical GUI vs. the terminal.

To accomplish this simply do the following:

$ sudo yum groupinstall "GNOME Desktop"
$ ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

Then simply reboot.

The last bit will associate the runlevel 5 target as your default with respect to Systemd.

Doing it with Systemd

You can also use Systemd to accomplish this. This is arguably the better method since you're managing the state of the system directly through Systemd and its CLIs.

You can see what your current default target is:

$ sudo systemctl get-default
multi-user.target

And then change it to graphical:

$ sudo systemctl set-default
graphical.target

Targets

In Systemd the targets runlevel5.target and graphical.target are identical. So too are runlevel2.target and multi-user.target.

Runlevel    Target Units                          Description
0 runlevel0.target, poweroff.target Shut down and power off the system.
1 runlevel1.target, rescue.target Set up a rescue shell.
2 runlevel2.target, multi-user.target Set up a non-graphical multi-user system.
3 runlevel3.target, multi-user.target Set up a non-graphical multi-user system.
4 runlevel4.target, multi-user.target Set up a non-graphical multi-user system.
5 runlevel5.target, graphical.target Set up a graphical multi-user system.
6 runlevel6.target, reboot.target Shut down and reboot the system.

References

CentOS 7 安装各个桌面版本的更多相关文章

  1. CentOS如何安装linux桌面?

    CentOS如何安装linux桌面? 以前默认安装分centos没有图形界面,今天想用下, yum groupinstall "GNOME Desktop" "Graph ...

  2. 【转】Linux(CentOS) vps安装xfce桌面+VNC

    以前我发过一篇文章利用vnc远程连接VPS桌面,其中用到的是kde桌面,后来知道xfce总体来说比kde占得内存还小些,因为xfce轻便.简单,今天因为一些原因需要在我的vps上搭建用户桌面,所以就试 ...

  3. centos下安装lnmp各个版本的几种方法

    首先我们用一种yum的方法安装,我们需要rpm源 默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案: 1.检查当前安装的PHP包 yum list installed | g ...

  4. CentOS下安装python3.x版本

    现在python都到了3.x版本,但是centos中自带的python仍然是2.7版本的,所以想把python换成3.x版本的. 但是这个地方有个坑,你要是直接编译安装了python3.x之后,估计你 ...

  5. centos在安装apache2.4版本的时候遇到ARP not found解决办法

    今日编译apache时出错: #./configure --prefix……检查编辑环境时出现: checking for APR... noconfigure: error: APR not fou ...

  6. Centos 7 安装GNOME桌面环境

    第一步:列出可安装的桌面环境 [root@local ~]# yum grouplist 第二步:安装GNOME及相应桌面管理工具 [root@local ~]# yum group info &qu ...

  7. Centos下安装git高版本2.1.2

    安装依赖软件 # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc # yum in ...

  8. Centos 7 安装nginx指定版本

    官方版本列表:http://nginx.org/download/ 1.安装 wget http://nginx.org/download/nginx-1.10.3.tar.gz tar -zxvf ...

  9. Windows Server 2012 R2的安装(GUI桌面版本)

    镜像:cn_windows_server_2012_r2_x64_dvd_2707961.iso 1.将安装光盘插入服务器,开机会读取到Windows安装程序,点击下一步 2.点击现在安装     3 ...

随机推荐

  1. 线程池ThreadPool详解

    http://www.cnblogs.com/kissdodog/archive/2013/03/28/2986026.html 一.CLR线程池 管理线程开销最好的方式: 尽量少的创建线程并且能将线 ...

  2. CNBlog客户端--第一阶段记录

    开始 五一小长假由于没有出去玩,所以我就用来继续写我的 CNBlog Android 客户端!首先呢!先上图!让大家看看,我做到哪儿了!! 不知道大家看了是什么感觉哈!有意见请评论哦!! 完成度以及遇 ...

  3. RecyclerView上拉隐藏Toolbar,下拉显示

    RecyclerView下拉隐藏Toolbar,上拉显示效果图 先说个事:最近我准备做个开源的博客园android客户端!符合Google最新的material design设计风格的!不知道有没有小 ...

  4. std::stringstream(2)

    stringstream本身的复制构造函数是私有的,无法直接用,于是带来了一些复杂的问题 网上,流传着几种办法,如streamA.str(streamB.str()),但这种办法,复制的仅仅是初始化时 ...

  5. Django - admin后台、auth权限

    admin后台 一.创建一个管理员用户 (1).设置时区.语言(可选步骤) 打开settings.py,改成下面那样 LANGUAGE_CODE = 'zh-Hans' TIME_ZONE = 'As ...

  6. Windows按名称排序问题

    偶然发现一个按名称排序的文件夹内,文件顺序是混乱的,例如: 在一个文件夹内建立如下三个文件: 0F.txt 1A.txt 02.txt 按名称/升序排列, 将得到上述结果,0F在最前,02在最后. 百 ...

  7. 不固定宽度的div居中显示

    对于div的居中 ,如果是有固定宽高的,可以加margin:auto;水平垂直居中,但如果是不固定宽高,又想让div居中的话,这种方式都可能不奏效,达不到想要的效果. 有两种方法:1.加display ...

  8. Tika a content analysis toolkit

    Apache Tika - a content analysis toolkit The Apache Tika™ toolkit detects and extracts metadata and ...

  9. <2014 08 28> 大学学习小结

    大一:哲学.物理(科普).瞎玩 大二:机械.力学.继续哲学 大三:电子电路.计算机.编程 大四:毕业项目(机器人等) 研一:物理.数学(常熟) 研二:AGV.TUM实习 研三:写论文.实习程序员.申请 ...

  10. 【转】清空mysql一个库中的所有表的数据

    方法1:重建库和表 用mysqldump --no-data把建表SQL导出来,然后drop database再create database,执行一下导出的SQL文件: 方法2:生成清空所有表的SQ ...