This recipe shows you how to install the GNOME desktop environment, which provides a graphical user interface (GUI) for working with your CentOS system. Usually, such environments aren't installed on server systems, but it can be convenient sometimes to have one available. For example, an administrator might feel more comfortable updating a system's configuration using graphical programs.
Note
GNOME isn't the only GUI environment available —other popular environments include KDE, XFCE, and Fluxbox. If GNOME isn't your cup of tea, the next recipe shows you how to install KDE.
This recipe requires a CentOS system with a working network connection. Administrative privileges are also required by logging in with the root
account.
Follow these steps to install the GNOME desktop environment:
Install the
GNOME Desktop
package group withyum groupinstall
:yum groupinstall "GNOME Desktop"
Manually start the desktop environment using
startx
:startx
If more than one environment is installed, you'll need to specify the path to
gnome-session
:startx /usr/bin/gnome-session
When you're done using GNOME and log out of the desktop, you'll be returned to the console.
To configure the system to automatically start the graphical environment when it boots, set the default start up target to
graphical.target
:systemctl set-default graphical.target
This recipe uses yum
to install the GNOME desktop environment. All of the necessary components and dependencies are installed by the GNOME Desktop
package group. Package groups saves us time and hassle because they let us install a collection of packages for a common task at the same time instead of individual packages one at a time.
yum groupinstall "GNOME Desktop"
Unlike Windows, where the graphical desktop is part of its operating system, Linux systems delegate basic graphics and input handling to a graphics server. This approach is one reason why there are several desktop environments to choose from —it abstracts many of the specifics and provides a common platform on top of which any number of environments can run, both locally and across a network. CentOS's default graphics server is X Window System.
If GNOME is the only desktop environment installed, it'll be run by default when we launch X with startx
. However, if more than one desktop is installed, we need to tell X which one we want to run. For GNOME, we provide the path to gnome-session
:
startx /usr/bin/gnome-session
The systemd service manager is responsible for starting various servers and processes when the system boots. The systemctl
command is our interface to the service manager and can be used to set the default boot target. The default target dictates whether the system boots to a terminal or GUI-based login screen:
systemctl set-default graphical.target
When set to graphical, systemd starts X and the GNOME Display Manager when the system boots, which presents us with a graphical login to provide our account details. Once we're authenticated, the desktop session is initiated and we find ourselves at the GNOME desktop.
If you no longer want to boot to the graphical environment, you can set the default target back to multiuser and the system will boot to the terminal-based login screen again:
systemctl set-default multi-user.target
The following resources will provide you with more information about installing graphical desktop environments and using the GNOME desktop:
GNOME Library (https://help.gnome.org)
RHEL 7 Desktop Migration and Administration Guide (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Desktop_Migration_and_Administration_Guide)
Guild to X11/Starting Sessions (https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Sessions)
How to install desktop environments on CentOS 7 (http://unix.stackexchange.com/questions/181503/how-to-install-desktop-environments-on-centos-7/181504#181504)