Adding the GNOME desktop environment, changing the runlevel, and installing additional software
In this recipe we will learn how to simplify access to your server by providing you with the option to add the GNOME desktop, change the runlevel in order that the desktop can be seen on boot, and enhance your system with an array of additional software packages typically associated with such an environment.
Adding a desktop environment is not a requirement of running a server and in many respects you can consider this action to be entirely optional. Members of the server community at large may frown with regard to the relevance of this feature, and if you are intending to run a standalone web server or mail server, then there is no reason for needing one, but the reality is, many people do find the practice of running a graphical user interface a welcome addition and in certain circumstances it really can save a huge amount of time depending on the nature and purpose of your server.
Getting ready
To complete this recipe, you will require a minimal installation of the CentOS 6 operating system with root privileges, a console-based text editor of your choice, and a connection to the Internet in order to facilitate the download of additional packages. The system should also have a computer display, a keyboard, and a mouse.
How to do it...
Before we begin, 64-bit users should be aware that the desktop environment will result in your system using a mixture of 32-bit and 64-bit software. This may change over time, but at the time of writing this book, most desktop applications are still 32-bit.
To install the GNOME desktop environment, log in as root and type the following command to install the necessary packages and dependencies:
yum groupinstall "Desktop" "X Window System" "Fonts" "Desktop Platform"
The preceding action will install around 530 MB of packages, but for you to begin using the desktop environment at boot, you will need to change the runlevel. A runlevel is a preset operating state that determines which programs are executed at system startup. In this case, we are intending to execute the desktop environment and to do this, simply open the following configuration file by typing:
vi /etc/inittab
Now scroll down towards the bottom of this file and locate the following line:
id:3:initdefault:
Change this line to read:
id:5:initdefault:
Now save your work. But before we finish, it is important to consider the need to add some software in order to enhance your enjoyment of the desktop environment. To do this, return to your console and type:
yum groupinstall "General Purpose Desktop" "Graphical Administration Tools"
Finally, you will need to reboot your computer in order to allow the changes to take immediate effect. To do this, type:
reboot
How it works...
During the course of this recipe, you have not only learned how to install the GNOME desktop environment, but have also successfully reconfigured the runlevel of your server and installed some additional software packages that will enhance your overall enjoyment of CentOS.
So what have we learned from this experience?
We began by installing the GNOME desktop environment by introducing ourselves to the Yum Package Manager's ability to install package groups. Yum is something we will return to later in this book, but in this instance we were required to install all the necessary components needed by a typical desktop, and we achieved this by typing:
yum groupinstall "Desktop" "X Window System" "Fonts" "Desktop Platform"
Having completed this initial step, we were then asked to reconfigure the runlevel of the server in order that the desktop environment would be initiated during the boot process. Without completing this step, the server will continue to boot in console mode.
Note
If you would prefer not to see the desktop at startup, simply leave the current runlevel as is (at level 3), and having accessed your system, you can always type the StartX
command to initiate the desktop environment.
As described in this recipe, a runlevel is a preset operating state that determines which programs are executed at system startup. In this case, we are only considering the needs of X Window System
and where a console-based server will typically start at runlevel 3
, we need to modify this in order to activate the desktop environment that functions at runlevel 5
.
To do this, we opened the main configuration file by typing:
vi /etc/inittab
You were then asked to scroll down towards the bottom of this file and find the following line:
id:3:initdefault:
Having found it, you were then asked to replace it with the following:
id:5:initdefault:
Finally, and last but not least, with a desktop environment everyone wants software, and by typing the following command, you were given the opportunity to enhance your system with a variety of tools that would make you feel at home:
yum groupinstall "General Purpose Desktop" "Graphical Administration Tools"
Note
Remember, if you have not created an administrative user (see the appropriate recipe in this book) at this stage, then you should consider running Firstboot (see the appropriate recipe in this chapter) in order to run the desktop setup agent
. Without completing either of these steps, you will be required to log in as the root user, which is not advisable for a desktop environment.
To complete this recipe, you were then required to reboot the server and having accessed your desktop environment, you can now navigate to System | Administration | Add/Remove Software to manage new and existing packages.