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. 一起talk C栗子吧(第一百二十七回:C语言实例--查看main函数的參数)

    各位看官们,大家好,上一回中咱们说的是static关键字的样例,这一回咱们说的样例是:查看main函数的參数.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们.我们在第五十七回中介绍过mai ...

  2. AVA 8 :从永久区(PermGen)到元空间(Metaspace)

    你注意到了吗?JDK 8早期可访问版本已经提供下载了,java 开发人员可以使用java 8 提供的新的语言和运行特性来做一些实验.其中一个特性就是完全的移除永久代(Permanent Generat ...

  3. Android 中替代 sharedpreferences 工具类的实现

    Android 中替代 sharedpreferences 工具类的实现 背景 想必大家一定用过 sharedpreferences 吧!就我个人而言,特别讨厌每次 put 完数据还要 commit. ...

  4. http协议详解(1)

    HTTP协议报文格式 接下来我们看看HTTP协议(Hypertext Transfer Protocol――超文本传输协议)浏览器端(客户端)向WEB服务器端访问页面的过程和HTTP协议报文的格式. ...

  5. github删除已经push到服务器上的commit的方法

    使用两条指令: git reset --hard <commit_id> git push origin HEAD --force 其中commit_id是你想回到的commit的id(即 ...

  6. JZOJ.5285【NOIP2017模拟8.16】排序

    Description

  7. centos7下搭建NFS服务器

    NFS是Network File System的缩写,即网络文件系统.客户端通过挂载的方式将NFS服务器端共享的数据目录挂载到本地目录下. nfs为什么需要RPC?因为NFS支持的功能很多,不同功能会 ...

  8. <2014 05 09> 程序员:从C++转到Java需注意的地方

    最近想玩玩Android的APP开发,从C++角度来学习Java.Java可以说是一个优化精简版的C++,去除了底层C的很多特性.找了这篇文章. --------------------------- ...

  9. 【转】Spring AOP 实现原理与 CGLIB 应用

    AOP(Aspect Orient Programming),作为面向对象编程的一种补充,广泛应用于处理一些具有横切性质的系统级服务,如事务管理.安全检查.缓存.对象池管理等.AOP 实现的关键就在于 ...

  10. unix_timestamp 和 from_unixtime 时间戳函数 区别

    1.unix_timestamp 将时间转化为时间戳.(date 类型数据转换成 timestamp 形式整数) 没传时间参数则取当前时间的时间戳 mysql> select unix_time ...