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. window 实用操作(结束已打开无法删除进程 内存占用)

    1.win7删除文件,文件夹或文件已在另一程序中打开:https://jingyan.baidu.com/article/e75057f2a41e88ebc91a8985.html 删除文件时,提示“ ...

  2. 解决百度地图Fragment切换黑屏问题

    https://blog.csdn.net/rentalphang/article/details/52076330 轻松解决啦!

  3. sql server剔除某列的汉字,函数。

    create function fun_del_chinese(@col varchar(1000))returns varchar(1000)ASbegin declare @returnchar ...

  4. linux的%用法

    转自:http://blog.csdn.net/wu020708/article/details/52387473 linux (%和%%)(#和##)贪婪匹配规则 先看一个案例,提取文件名: fil ...

  5. [LeetCode] Reverse Lists

    Well, since the head pointer may also be modified, we create a new_head that points to it to facilit ...

  6. FineReport----单元格元素(数据列、公式、斜线)

    一.绑定.插入数据列 数据集字段绑定 二.公式 1.单元 格计算 1.两个单元格(C7,I7)和 2.等于某单元格的值 D7等C7单元格的值 3.C7/8(除) 4.除数被除数为零.空的处理 http ...

  7. 巨蟒python全栈开发数据库前端5:JavaScript1

    1.js介绍&变量&基础数据类型 2.类型查询&运算符&if判断&for循环 3.while循环&三元运算符 4.函数 5.今日总结 1.js介绍&am ...

  8. window异常处理——except_handler4以及栈展开分析

    以前在15pb学习时候在看雪论坛发的一篇精华帖. 主要是分析在try块中发生嵌套异常时候堆栈是如何平衡的. 就不复制过来了,给个链接http://bbs.pediy.com/showthread.ph ...

  9. 使用 Python 编写 vim 插件

    使用 Python 编写 vim 插件 - 技术翻译 - 开源中国社区 code {margin: 0;padding: 0;white-space: pre;border: none;backgro ...

  10. 【我的Android进阶之旅】Android Studio如何轻松整理字符串到string.xml中

    使用Android Studio一段时间了,还有很多小技巧没有掌握.比如:平常将字符串整理到string.xml中,都是手动的去复制字符串到string.xml中,然后再回来修改引用该字符串的代码,这 ...