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

156k36270444
asked Jan 28 '15 at 7:02
Afshin Hamedi

2,74331027
 

2 Answers

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

156k36270444
answered Jan 28 '15 at 7:02
Afshin Hamedi

2,74331027
 
    
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

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

answered Feb 18 at 14:55
slm

156k36270444
 
    
Isn't it better to use Systemd commands to enable graphical mode rather than manually creating a symlink? See the Red Hat Systemd Targets Documentation – Mark Edington Feb 20 at 11:54
1  
@MarkEdington - agreed, updated. Thanks for pointing this out. Figured it was possible but hadn't dug deep enough to see how. – slm♦ Feb 20 at 14:05

protected by Community♦ Feb 10 at 1:03

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged centos gui desktop-environment or ask your own question.

CENTOS GUI的更多相关文章

  1. centos GUI界面与命令行的切换

    Linux 系统任何时候都运行在一个指定的运行级上,并且不同的运行级的程序和服务都不同,所要完成的工作和所要达到的目的都不同.Centos设置了如下表所示的运行级,并且系统可以在这些运行级别之间进行切 ...

  2. CentOS 7 安装各个桌面版本

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

  3. 记一次CentOS7进单用户模式修改密码的失败经历(faild to load SELinux policy freezing)

    背景:Cent SO7.4root用户密码忘记,根据https://www.linuxidc.com/Linux/2016-08/134034.htm提供的放法修改完密码之后系统启动后一直停留在转圈的 ...

  4. linux入门系列2--CentOs图形界面操作及目录结构

    上一篇文章"linux入门系列1--环境准备及linux安装"直观演示了虚拟机软件VMware和Centos操作系统的安装,按照文章一步一步操作,一定都可以安装成功.装好系统之后, ...

  5. CentOS 7安装Gnome GUI 图形界面

    当你安装centos服务器版本的时候,系统默认是不会安装 CentOS 的图形界面程序的,比如:gnome或者kde, 那么如果你想在图形界面下工作的话,可以手动来安装CentOS Gnome GUI ...

  6. [转载]CentOS 7安装Gnome GUI 图形界面

    原文链接:http://www.centoscn.com/image-text/config/2015/0528/5552.html 当你安装centos服务器版本的时候,系统默认是不会安装 Cent ...

  7. 芝麻HTTP:在无GUI的CentOS上使用Selenium+Chrome

    各位小伙伴儿的采集日常是不是被JavaScript的各种点击事件折腾的欲仙欲死啊?好不容易找到个Selenium+Chrome可以解决问题! 但是另一个▄█▀█●的事实摆在面前,服务器都特么没有GUI ...

  8. 小白学爬虫-在无GUI的CentOS上使用Selenium+Chrome

    爬虫代理IP由芝麻HTTP服务供应商提供各位小伙伴儿的采集日常是不是被JavaScript的各种点击事件折腾的欲仙欲死啊?好不容易找到个Selenium+Chrome可以解决问题! 但是另一个▄█▀█ ...

  9. 【转帖】远程显示(操作) 服务器 GUI 程序(图形化界面) (基于 X11 Forwarding + Centos + MobaXterm)

    远程显示(操作) 服务器 GUI 程序(图形化界面) (基于 X11 Forwarding + Centos + MobaXterm) https://zhuanlan.zhihu.com/p/310 ...

随机推荐

  1. Activity(活动)-再讲

    通过多天的学习,大家也了解了adb.exe 是用来进行 客户端(pc)-服务器端(android) 数据交互的. 用户可以使用工具Eclipse 中DDMS 隐示使用  adb.exe 进行连接,也可 ...

  2. 在windows 、linux下读取目录下所有文件名

    Windows要引入的头文件是<Windows.h> 主要是两个函数FindFirstFile.FindNextFile MSDN里是这么说的: FindFirstFile functio ...

  3. PHP使用mysqli操作MySQL数据库

    PHP的 mysqli 扩展提供了其先行版本的所有功能,此外,由于 MySQL 已经是一个 具有完整特性的数据库服务器 , 这为PHP 又添加了一些新特性 . 而 mysqli 恰恰也支持了 这些新特 ...

  4. 【LeetCode OJ】Reverse Words in a String

    Problem link: http://oj.leetcode.com/problems/reverse-words-in-a-string/ Given an input string, reve ...

  5. # 20145210 《Java程序设计》第05周学习总结

    教材学习内容总结 第八章 异常处理 8.1语法与继承架构 •使用 try.catch •Java中所有信息都会被打包为对象,如果愿意,可以尝试(try)捕捉(catch)代表错误的对象后做一些处理 • ...

  6. 怎么在手机浏览器上访问电脑本地的文件,局域网内,自建WiFi也可以

    首先,电脑要有Mysql+Apache+PHP环境,我直接用Wampsever,开启环境后手机和电脑要再同一个局域网内,然后电脑上打开win+R,输入cmd,再输入ipconfig,就可以看着这台的电 ...

  7. java学习第七天

    目标 1.  复合 2.  继承 3.  重写 4.  Super 5.  final 一.类与类的关系 参考: http://www.cnblogs.com/liuling/archive/2013 ...

  8. MINIX3 内核时钟分析

    MINIX3 内核时钟分析  4.1 内核时钟概要  先想想为什么 OS 需要时钟?时钟是异步的一个非常重要的标志,设想一下,如 果我们的应用程序需要在多少秒后将触发某个程序或者进程,我们该怎么做到? ...

  9. matlab自带princomp(PCA降维方式)

    matlab 中自带的函数就不必怀疑. princomp:principal componet analysis (PCA). [COEFF,SCORE,latent,tsquare]=princom ...

  10. 《more effective c++》条款26 限制类对象的个数

    问题: 如何限制类对象的个数?比如1个,10个等等. 方法(1): 将类的构造函数定义为private,那么就无法实例化这个类了.但是如何创建1个对象出来?方法有2种: 1.声明一个友元函数,那么在友 ...