Book Image

CentOS 6 Linux Server Cookbook

By : Jonathan Hobson
Book Image

CentOS 6 Linux Server Cookbook

By: Jonathan Hobson

Overview of this book

CentOS is a community-based enterprise class operating system and this book will provide a series of practical solutions that will not only show you how to install and maintain CentOS as a server, but to explore this well-known Linux distribution with the intention of tackling many common issues by providing some tricks of the trade in order to simplify the task of building a server."CentOS 6 Linux Server Cookbook" is a practical guide to installation, configuration, administration, and maintenance. This is a one-stop-shop to all things CentOS, so regardless as to whether you need a mail server, web server, database server, domain server or a file sharing platform, this book provides a comprehensive series of starting points that will give you direct access to the inner workings of this open source, community-based enterprise server."CentOS 6 Linux Server Cookbook" is a practical guide to the complete installation, configuration, administration, and maintenance of one of the world's most popular community-based enterprise servers.From installation to configuration, this book of recipes will take you on a journey to explore inner workings of CentOS server. Within this book you will learn how to install CentOS in variety of settings, enhance your installation with the correct tools of the trade and prepare your server to fulfil almost any role you could ever need.By discovering more about time, networking, package management, system management and security, this book will serve to show you how to get the very best from this freely available, open source server by presenting a series of solutions that will enable you to master the art of building your very own web, database, mail, domain name, file sharing services.CentOS 6 Linux Server Cookbook is a hands-on approach to installing, configuring and managing this ever popular community based enterprise server. By taking you from installation to customization this book will serve all Linux professionals and enthusiasts alike by providing you with a practical guide to using CentOS as a world-class server solution that is capable of delivering your mail, web, ftp, domain and file sharing services.
Table of Contents (18 chapters)
CentOS 6 Linux Server Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.

  1. 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"
    
  2. 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
    
  3. Now scroll down towards the bottom of this file and locate the following line:

    id:3:initdefault:
  4. Change this line to read:

    id:5:initdefault:
  5. 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"
    
  6. 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.