Install MATE or XFCE on CentOS 7

Which desktop environment you prefer is very personal. Each of them has its advantages and, unfortunately, also its disadvantages.

Recently, I started to like MATE since it’s lightweight and customizable in a way I personally like. Before, I was a fan of XFCE for similar reasons but somehow I got a little tired and irritated of it’s shortcomings.

This post covers how to install any of those on top of a minimal install since this means it can be installed on top of almost every type of installation in regards to package selection and dependencies.

Installation is quite simple since both Desktop environments are available in the EPEL repository. Basically, it comes down to installing the repo, installing the X-window system and then install the desktop environment of your choice. If you want to, you can install multiple environments to decide which one you like less/more.

This post has been completely reviewed and updated where needed on 08/2017 to make sure everything is still working and is correct.

Installing EPEL and the X window system:

Both XFCE and MATE can be found in the EPEL-repositories. So before we take any action, we need to install the repository.  More information and a recent download-link can be found here: http://fedora.cu.be/epel/7/x86_64/repoview/epel-release.html

To install the EPEL repository and make the packages available:

[jensd@cen7 ~]$ sudo yum install epel-release -y
...
Complete!

Before we start, we need to install the X-window system. These packages do not require EPEL. Of course it doesn’t bother if it’s already installed.

[jensd@cen7 ~]$ sudo yum groupinstall "X Window system" -y
...
Complete!

Now you have a minimally installed X without any desktop environment so let’s change that.

Install MATE

Since we already installed the EPEL-repo, the only thing that’s left to do is a groupinstall for MATE.

To first have a look at what exactly will be installed, we can execute yum with the groupinfo-command:

[jensd@cen7 ~]$ yum groupinfo "MATE Desktop"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.noction.com
 * elrepo: elrepo.org
 * epel: fedora-mirror01.rbc.ru
 * extras: mirrors.supportex.net
 * updates: mirrors.supportex.net

Environment Group: MATE Desktop
 Environment-Id: mate-desktop-environment
 Description: MATE Desktop is based on GNOME 2 and provides a powerful graphical user interface for users who seek a simple easy to use traditional desktop interface.
 Mandatory Groups:
   +admin-tools
   +base-x
   +core
   +dial-up
   +fonts
   +guest-desktop-agents
   +hardware-support
   +input-methods
   +mate-desktop
   +multimedia
   +printing
   +standard
 Optional Groups:
   +3d-printing
   +libreoffice

When you are happy with the result, you can install the group as follows:

[jensd@cen7 ~]$ sudo yum groupinstall "MATE Desktop" -y
...
Complete!

Install XFCE

Similar to installing MATE, we can install XFCE. MATE and XFCE are alternatives to each other so most likely you will only use one of these in practice. To get familiar with both or just to try it out, there is no problem in installing them both.

[jensd@cen7 ~]$ sudo yum groupinstall xfce -y

Starting the graphical environment

After the installation of one or more desktop environments, you need to tell your system to start the graphical components (X window-system and display manager). Since CentOS version 7, this is done by systemd and it’s targets. In the past, this was done by switching runlevels. The target for a graphical system is conveniently called graphical.target and is similar to what runlevel 5 was in the past.

To switch to graphical target, do the following:

[jensd@cen7 ~]$ sudo systemctl isolate graphical.target

This should start all what is needed in order to present you with a GUI on the system. Depending on which display manager was installed (lightdm for MATE and gdm for XFCE), you are presented with one of the following login screens:

GDM: 

LightDM:

After login, you should get your familiar desktop and you can start working with the GUI:

MATE:


XFCE:

Start the GUI on boot

After a reboot, the system will start with it’s default target (multi-user) so in order to make the change permanent and always start your system with a GUI, you can change the default target to the graphical one:

[jensd@cen7 ~]$ sudo systemctl set-default graphical.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'

Change the default display manager

When you installed both XFCE and MATE on one system, you can choose which one of them to start for your desktop session on the login screen.

For GDM, this can be done here:

mate_xfce-gdm-session

For LightDM, this can be done here:

mate_xfce-lightdm-session

Depending on which one of them you installed first, your default display manager (lightdm or gdm) is started with the graphical.target. This basically means that you will be presented with a different login screen and some other options.

To see which display manager is started with the grahpical target or the system, do the following:

[jensd@cen7 ~]$ ls -l /etc/systemd/system/display-manager.service

When lightdm is the default one, you should get something like this:

[jensd@cen7 ~]$ ls -l /etc/systemd/system/display-manager.service
lrwxrwxrwx. 1 root root 39 Aug  1 09:38 /etc/systemd/system/display-manager.service -> /usr/lib/systemd/system/lightdm.service

When gdm is the default one, it should look like this:

[jensd@cen7 ~]$ ls -l /etc/systemd/system/display-manager.service
lrwxrwxrwx. 1 root root 35 Jul 22 10:32 /etc/systemd/system/display-manager.service -> /usr/lib/systemd/system/gdm.service

To change from one to another, simply disable the current default and enable the one you would like to set as the new default. With systemd, you can do that with the following commands:

[jensd@cen7 ~]$ sudo systemctl disable lightdm && sudo systemctl enable gdm
Removed symlink /etc/systemd/system/display-manager.service.
Created symlink from /etc/systemd/system/display-manager.service to /usr/lib/systemd/system/gdm.service.

To reload the graphical target and activate your changes:

[jensd@cen7 ~]$ sudo systemctl isolate graphical.target

That should be all you need to get going with XFCE or MATE on a fresh CentOS 7 system. As with most of the CEntOS-related stuff, this should work on RHEL 7 as well.

27 thoughts on “Install MATE or XFCE on CentOS 7

  1. Hello, it works fine on a fresh installation of CEntOs 7 with gnome 3

    Bonjour, cela fonctionne parfaitement avec une installation de CEntOs 7 et un environnement graphique Gnome 3.

    Merci, thank’s

  2. Hi
    Thanks for your guide, it works without problem.
    But, can we also install tiger VNC on xfce ?
    I can run it fine on gnome, but witch the same setting on xfce, I cannot log into.. ?
    If you may have tried.. or perhaps it’s another tutorial.
    Thanks

  3. FYI – the epel-release package is in the basic CentOS 7 distribution and can be installed directly. This is not the case for RHEL 7 where you need to use the link you provided.

  4. hi,
    nice article. I’ve just setup centos 7 minimal on my vps. then I tried installing xfce based on your article. I only installed xfce so I skip “MATE desktop”.
    after success installing, I tried to connect via vnc client (tight vnc). the connection is success, but I got error on gdm with error message “Oh no! Something has gone wrong. bla… bla… bla…”.
    any suggestion how to fix it?

    thank you.

    • Hi,

      I assume that you installed a VNC server? TigerVNC or one of it’s alternatives should do.
      Some things you can check:
      – Did you start X before you started the VNC-server or connection?
      – Are the permissions on .Xauthority in your homedir ok?
      – Can you log in with the same userid not over VNC?
      – Check your logfiles and try to disable SELinux for testing.

      If I find some time, I’ll test how to set up VNC on XFCE after following this tutorial.

      • Some things you can check:
        – Did you start X before you started the VNC-server or connection?
        I use tigervnc, in Xorg.0.log I got this message:
        [code]
        sudo tail /var/log/Xorg.0.log
        [ 1.664] (EE)
        [ 1.664] (EE)
        Please consult the The X.Org Foundation support
        at http://wiki.x.org
        for help.
        [ 1.664] (EE) Please also check the log file at “/var/log/Xorg.0.log” for additional information.
        [ 1.664] (EE)
        [ 1.664] (WW) xf86CloseConsole: KDSETMODE failed: Invalid argument
        [ 1.664] (WW) xf86CloseConsole: VT_GETMODE failed: Invalid argument
        [ 1.664] (EE) Server terminated with error (1). Closing log file.
        [/code]
        – Are the permissions on .Xauthority in your homedir ok?
        oke
        – Can you log in with the same userid not over VNC?
        i can
        – Check your logfiles and try to disable SELinux for testing.
        still not sure to do it.

        anyway, is this gdm problem or vncserver problem?
        i’ve also tried installed lightdm, but got the same result.

        thank you.

  5. Pingback: Install the Cinnamon desktop environment on CentOS 7 | Jensd's I/O buffer

  6. Wow …
    Was looking for this solution since eternity.
    Thanks for sharing the article
    It worked like a charm

    Thanks
    -Hemanth

  7. Pingback: CentOS 7 Minimal++ (Virtual) Setup – All the Pages Are My Days

  8. It doesn’t work the interface wont start.
    But if I install X Windows before EPEL then it works fine.

  9. Hi – thanks for this blog. There is one piece, however, that I’m looking for that doesn’t seem to be covered here. Under “Change the default display manager” that change is applied at the *user* level. How can I change the *system* default, so that any user logging in through GDM gets MATE as the default desktop environment (unless they select otherwise in the GDM Session drop-down box)?

  10. Pingback: 使用X Manager远程CentOS 7服务器(XDMCP) - 算法网

Leave a Reply to jensd Cancel reply

Your email address will not be published. Required fields are marked *