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
About the Author
About the Reviewers


Building a server can present a challenge. It is often difficult at the best of times and frustrating at the worst of times. They can represent the biggest of problems or give you a great sense of pride and achievement. Where the word "server" can describe many things, it is the intention of this book to lift the lid and expose the inner workings of this enterprise-class computing system with the intention of enabling you to build the professional server solution of choice.

CentOS is a community-based enterprise class operating system. It is available free of charge, and as a fully compatible derivative of Red Hat Enterprise Linux (RHEL) it represents the first choice operating system for organizations, companies, professionals, and home users all over the world who intend to run a server. It's widely respected as a very powerful and flexible Linux distribution and regardless as to whether you intend to run a web server, file server, FTP server, domain server, or a multi-role solution, it is the purpose of this book to deliver a series of turn-key solutions that will show you how quickly you can build a fully capable and comprehensive server system using the CentOS 6 operating system.

So with this in mind, you could say that this book represents more than just another introduction to yet another server-based operating system. This is a cookbook about an enterprise-class operating system that provides a step-by-step approach to making it work. So, regardless as to whether you are a new or an experienced user, there is something inside these pages for everyone, as this book will become your practical guide to getting things done and a starting point to all things CentOS.

What this book covers

Chapter 1, Installing CentOS, is a series of recipes that introduces you to the task of installing your server, updating, and enhancing the minimal install with additional tools and adding a desktop environment. It is designed to get you started and to provide a reference that shows you a number of ways to achieve the desired installation.

Chapter 2, Configuring CentOS, is designed to follow on from a successful installation to offer a helping hand and provide you with a number of recipes that will enable you to achieve the desired server configuration. From changing the time zone and updating the hardware clock to binding multiple IP addresses, you will not only learn how to resolve a fully qualified domain name but you will be shown how to work with multiple Ethernet devices and manage SELinux.

Chapter 3, Working with CentOS, provides the building blocks that will enable you to champion your server and take control of your environment. It is here to kick start your role as a server administrator, by disseminating a wealth of information that will walk you through a variety of steps that are required to develop a fully considered and professional server solution.

Chapter 4, Managing Packages with Yum, serves to introduce you to the definitive package manager for CentOS 6 server. From upgrading the system to finding, installing, removing, and enhancing your system with additional repositories, it is the purpose of this chapter to explain the open source command-line package management utility known as the Yellowdog Updater, Modified.

Chapter 5, Securing CentOS, discusses the need to implement a series of solutions that will deliver the level of protection you need to run a successful server solution. From escalating user privileges to preventing dictionary-based attacks, you will see how easy it is to build a server that not only considers the need to reduce risk from external attack but one that will provide additional protection for your users.

Chapter 6, Working with Samba, focuses on the power and simplicity of file sharing with Samba in order to provide CentOS 6 server with the ability to provide a sense of community within the workplace.

Chapter 7, Working with Domains, considers the steps required to implement domain names, domain resolution, and DNS queries on a CentOS 6 server. The domain name system is an essential role of any server and whether you are intending to support a home network or a full corporate environment, it is the purpose of this chapter to provide a series of solutions that will deliver the beginning of a future-proof solution.

Chapter 8, Working with Databases, provides a series of recipes that delivers instant access to MySQL and PostgreSQL with the intention of explaining the necessary steps required to deploy them on a CentOS 6 server.

Chapter 9, Providing Mail Services, introduces you to the process of enabling a domain-wide Mail Transport Agent to your CentOS 6 server. From building a local POP3/SMTP server to configuring SASL and dealing with SPAM, the purpose of this chapter is to provide the groundwork for all your future e-mail-based needs.

Chapter 10, Working with Apache, investigates the role of this well known server technology to full effect, and whether you are intending to run a development server or a live production server, this chapter provides you with the necessary steps to deliver the features you need to become the master of your web based publishing solution.

Chapter 11, Working with FTP, concentrates on the role of VSFTP with a series of recipes that will provide the guidance you need to install, configure and manage the File Transfer Protocol you want to provide on a CentOS 6 server.

What you need for this book

The requirements of this book are relatively simple and begin with the need to download the CentOS operating system. The software is free, but you will need a computer that is capable of fulfilling the role of a server, an Internet connection, some spare time, and a desire to have fun.

In saying that, many readers will be aware that you do not need a spare computer to take advantage of this book as the option of installing CentOS on virtualization software is always available. This approach is quite common and where the recipes contained within these pages remain applicable, you should be aware that the use of virtualization software is not considered by this book. For this reason any requests for support regarding this the use of this software should be directed towards the appropriate supplier.

Who this book is for

This is a practical guide for building a server solution, and rather than being about CentOS itself, this is a book that will show you how to get CentOS up and running. It is a book that has been written with the novice-to-intermediate Linux user in mind who is intending to use CentOS as the basis of their next server. However, if you are new to operating systems as a whole, then don't worry; this book will also serve to provide you with the step-by-step approach you need to build a complete server solution with plenty of tricks of the trade thrown in for good measure.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Again, if you experience any difficulties, simply check the logfile located at /var/log/maillog."

A block of code is set as follows:

include "/etc/named.rfc1912.zones";
zone "" IN {
type master;
file "/var/named/hostname.domainname.lan.db";
allow-update { none; }; 

Any command-line input or output is written as follows:

vi /etc/named.conf

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The second step is to choose the button labeled Configure Network (located in the lower-left portion of the screen) and use the resulting Network Connections dialog box to record any changes to your Ethernet settings."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.