For over a decade, the CentOS project has provided the community with a free, enterprise-grade operating system through the rebranding and recompilation of the Red Hat Enterprise Linux source. Since CentOS users rely almost exclusively on the community for their support needs, I was keen to write this book when Packt approached me about the project's latest release, CentOS 7. The recipes we chose cover a wide range of topics, from getting started to managing many common web services, and hopefully administrators of any skill level will find something of interest.
However, writing a book is a huge undertaking. Because of this, I want to thank the staff at Packt, my family, and my friends, for their support. The dog needs to be taken for a walk, family engagements need attending, and emergencies arise at the workplace. Without the understanding and encouragement of those around me and the editorial staff, you wouldn't be reading this book.
The recipes presented in this book aim to make even the most difficult configuration tasks easy by providing step-by-step instructions and discussion. Here's a quick rundown of what you can expect from each of the 12 chapters.
Chapter 1, Getting Started with CentOS, contains recipes for installing CentOS using graphical, text-based, and kick-start approaches. How to set up a CentOS platform for projects running Docker and on Amazon Web Services is also discussed.
Chapter 2, Networking, contains recipes to help you complete common networking tasks, such as how to set up a static IP address, assign multiple addresses to a single network interface, bond multiple interfaces with the same address, and configure the system's firewall using FirewallD and iptables. It also presents recipes for configuring network services such as DHCP, NFS, and Samba.
Chapter 3, User and Permission Management, shows you how to increase the security of your system by enforcing password restrictions, adjusting the default permissions given to newly created files and directories, and the use of sudo to avoid circulating the root password. How to work with SELinux is also discussed.
Chapter 4, Software Installation Management, provides recipes focused on working with software repositories and installing software. You'll learn how to register the EPEL and Remi repositories, prioritize the repositories packages are installed from, and update your software automatically. You'll also learn how to compile and install software from source code.
Chapter 5, Managing Filesystems and Storage, presents recipes that show you how to set up and work with RAID and with LVM. These services leverage your system's storage to maintain availability, increase reliability, and to keep your data safe against inevitable disk failures.
Chapter 6, Allowing Remote Access, aims to help you provide remote access to your CentOS system in a secure manner. Its recipes cover using SSH, configuring a chroot jail, and tunneling VNC connections through an encrypted SSH tunnel.
Chapter 7, Working with Databases, collects recipes that provide you with the necessary steps to get started with various database services such as MySQL, MongoDB, and OpenLDAP. You'll also learn how to provide backup and redundancy for these services.
Chapter 8, Managing Domains and DNS, takes us into the world of DNS. The recipes show you how to set up a resolving DNS server to decrease latency caused by domain lookups and how to manage your own domain with an authoritative DNS server.
Chapter 9, Managing E-mails, will help you set up your own mail server. The recipes discuss configuring Postfix to provide SMTP services, configuring Dovecot to provide IMAP and POP3 services, and securing these services with TLS. You'll also find instructions on how to set up SpamAssassin to help reduce unsolicited bulk e-mails.
Chapter 10, Managing Web Servers, contains recipes about configuring Apache to server web content. You'll learn how to set up name-based virtual hosting, server pages over HTTPS, and perform URL rewriting. How to set up NGINX as a load balancer is also discussed.
Chapter 11, Safeguarding Against Threats, contains recipes to help protect the investment you've made in your CentOS server. They cover logging, threat monitoring, virus and rootkits, and network backups.
Chapter 12, Virtualization, shows you how CentOS can function as a host operating system to one or more virtualized guests. This allows you to take better advantage of your hardware resources by running multiple operating systems on the same physical system.
To follow the recipes in this book, first and foremost you'll need a system capable of running CentOS 7. The minimum requirements (and maximum capabilities) are documented in the Red Hat Enterprise Linux knowledge base available online at https://access.redhat.com/articles/rhel-limits. In brief, you'll need a system that has the following:
x86_64 processor (RHEL/CentOS 7 does not support x86)
1 GB RAM
8 GB Disk capacity
Apart from a system to install CentOS on, you'll also need a copy of the CentOS installation media and a working network connection. You can download a copy directly from https://www.centos.org/download/ or using BitTorrent.
This book is for Linux professionals with basic Unix/Linux functionality experience, perhaps even having set up a server before, who want to advance their knowledge in administering various services.
In this book, you will find several headings that appear frequently (Getting ready, How to do it..., How it works..., There's more..., and See also).
To give clear instructions on how to complete a recipe, we use these sections as follows.
This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.
This section usually consists of a detailed explanation of what happened in the previous section.
This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.
In this book, you will find a number of text styles 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: "The repositories' configuration files are found in the /etc/yum.repos.d
directory."
A block of code is set as follows:
[sshd] enabled=true bantime=86400 maxretry=5
Any command-line input or output is written as follows:
firewall-cmd --zone=public --permanent --add-service=dns
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Select your desired language and click on Continue."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected], and mention the book's title in 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 at www.packtpub.com/authors.
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 could 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 http://www.packtpub.com/submit-errata, 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 to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted 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 [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.