You are previewing The Definitive Guide to CentOS.
O'Reilly logo
The Definitive Guide to CentOS

Book Description

Author Peter Membrey provides the first definitive reference for CentOS, the workhorse Linux distro that does the heavy lifting in small and medium-size enterprises without drawing too much attention to itself.

Table of Contents

  1. Copyright
  2. Foreword
  3. About the Authors
  4. About the Technical Reviewer
  5. Acknowledgments
  6. Introduction
    1. Who This Book Is For
    2. How the Book Is Laid Out
  7. 1. Getting Started with CentOS
    1. 1. Introducing CentOS
      1. 1.1. What Is Enterprise Linux?
        1. 1.1.1. Extended Support
        2. 1.1.2. Low-Risk Security Updates
        3. 1.1.3. ABI/API Stability
        4. 1.1.4. Regular Updates and Bug Fixes
        5. 1.1.5. Certification
        6. 1.1.6. Summary of Enterprise Linux's Benefits
      2. 1.2. What Is CentOS?
      3. 1.3. How to Read This Book
    2. 2. Installing CentOS
      1. 2.1. Hardware Requirements
      2. 2.2. Getting CentOS
        1. 2.2.1. Checking the Checksums
        2. 2.2.2. Burning the ISOs
      3. 2.3. Performing a Super-Quick CentOS Install
      4. 2.4. Setting Other Installation Options
        1. 2.4.1. Securely Erasing Your Disks
        2. 2.4.2. Creating a Custom Partition Layout
        3. 2.4.3. Using Software RAID
        4. 2.4.4. Setting IP Manually
      5. 2.5. Summary
    3. 3. Getting Started with CentOS
      1. 3.1. CentOS Filesystem Layout
        1. 3.1.1. Relative and Absolute Paths
        2. 3.1.2. Filesystem Layout
        3. 3.1.3. /
        4. 3.1.4. /root
        5. 3.1.5. /etc
        6. 3.1.6. /proc
        7. 3.1.7. /var
        8. 3.1.8. /boot
        9. 3.1.9. /bin and /sbin
        10. 3.1.10. /dev
        11. 3.1.11. /home
        12. 3.1.12. /lib
        13. 3.1.13. /lost+found
        14. 3.1.14. /media
        15. 3.1.15. /mnt
        16. 3.1.16. /usr
        17. 3.1.17. /opt
        18. 3.1.18. /srv
        19. 3.1.19. /sys
        20. 3.1.20. /tmp
        21. 3.1.21. Getting Your Hands on a Command Prompt
      2. 3.2. Getting an SSH Client
      3. 3.3. Using SSH
      4. 3.4. You're Logged In; Now What?
      5. 3.5. First, the Prompt
      6. 3.6. Important Commands
        1. 3.6.1. pwd
        2. 3.6.2. ls
        3. 3.6.3. mkdir
        4. 3.6.4. cd
        5. 3.6.5. rmdir
        6. 3.6.6. rm
        7. 3.6.7. touch
        8. 3.6.8. nano
        9. 3.6.9. cat
      7. 3.7. Summary
    4. 4. Using Yum
      1. 4.1. What Are RPMs?
      2. 4.2. What Are Yum Repositories?
      3. 4.3. CentOS Repositories
        1. 4.3.1. Official CentOS Repositories
          1. 4.3.1.1. [base]
          2. 4.3.1.2. [updates]
          3. 4.3.1.3. [addons]
          4. 4.3.1.4. [contrib]
          5. 4.3.1.5. [centosplus]
          6. 4.3.1.6. [extras]
          7. 4.3.1.7. [testing]
        2. 4.3.2. Third-Party Repositories
      4. 4.4. Getting Started with Yum
        1. 4.4.1. Updating Your Server
        2. 4.4.2. Installing a Package
          1. 4.4.2.1. Dependencies Resolved
        3. 4.4.3. Installing a Group of Packages
          1. 4.4.3.1. Updating Individual Packages
          2. 4.4.3.2. Updating a Package Group
          3. 4.4.3.3. Removing a Package with Yum
          4. 4.4.3.4. Removing a Package Group
        4. 4.4.4. Searching for Packages
          1. 4.4.4.1. RPM Package Names
          2. 4.4.4.2. Doing a Simple Search
          3. 4.4.4.3. Using Wildcards
          4. 4.4.4.4. A More Useful Search
      5. 4.5. Adding a Custom Repository
        1. 4.5.1. Setting It Up with RPM
        2. 4.5.2. How to Do It Without an RPM
      6. 4.6. Yumex
      7. 4.7. Summary
  8. 2. Going into Production
    1. 5. Using Apache
      1. 5.1. How Does the Server Work?
        1. 5.1.1. A Brief Introduction to SSL
      2. 5.2. Why Run Your Own Server?
        1. 5.2.1. What It Involves
        2. 5.2.2. When to Let Someone Else Do It
        3. 5.2.3. What Is a Virtual Private Server (VPS)?
        4. 5.2.4. Picking a Web Server
      3. 5.3. Installing Apache
        1. 5.3.1. Configuring the Firewall
        2. 5.3.2. Making Sure Apache Starts Each Time the Server Reboots
        3. 5.3.3. Starting Up and Testing Apache
      4. 5.4. Configuring Apache
        1. 5.4.1. Where Is Everything?
        2. 5.4.2. Getting Started
        3. 5.4.3. Configuring ServerAdmin
        4. 5.4.4. Configuring ServerName
        5. 5.4.5. Saving the Configuration File
        6. 5.4.6. Testing Your New Configuration File
        7. 5.4.7. Restarting Apache
      5. 5.5. .htaccess
        1. 5.5.1. Enabling .htaccess
        2. 5.5.2. How to Password Protect a Directory
        3. 5.5.3. Configuring Password Protection
        4. 5.5.4. Creating User Accounts
      6. 5.6. Improving Performance
        1. 5.6.1. Compression
        2. 5.6.2. Enabling Compression in Apache
        3. 5.6.3. Why You Don't Compress Everything
      7. 5.7. Improving Server Performance
        1. 5.7.1. Things to Watch Out For
        2. 5.7.2. Log Files
      8. 5.8. Setting Up Virtual Hosts
        1. 5.8.1. Getting Started with Virtual Hosts
        2. 5.8.2. Creating Your First Virtual Host
        3. 5.8.3. Using vhosts.d
      9. 5.9. Using SSL
        1. 5.9.1. Installing mod_ssl
      10. 5.10. Getting Your Shiny New Certificate
        1. 5.10.1. Signing Your Own Certificate
        2. 5.10.2. What to Do with an Intermediary Certificate
        3. 5.10.3. Putting Your New Certificate to Work
        4. 5.10.4. Removing the Password Protection from the Key
      11. 5.11. Summary
    2. 6. Setting Up Mail
      1. 6.1. How Do Mail Servers Work?
        1. 6.1.1. Why Run Your Own Mail Server?
        2. 6.1.2. Caveats
        3. 6.1.3. When Not to Run Your Own Mail Server
        4. 6.1.4. Which Mail Server to Choose
      2. 6.2. Installing the Mail Server
        1. 6.2.1. Configuring the Firewall
        2. 6.2.2. Making Sure Postfix Starts During Boot
      3. 6.3. Configuring Postfix
        1. 6.3.1. Configuring Your System to Send Mail
          1. 6.3.1.1. Sending Mail Directly
          2. 6.3.1.2. Sending Mail via a Smart Host
        2. 6.3.2. Configuring Your System to Receive Mail
        3. 6.3.3. Setting Up Users to Receive Mails
        4. 6.3.4. Taking a Few Antispam Measures
        5. 6.3.5. Receiving Mails for Several Domains
      4. 6.4. Authenticating Users
        1. 6.4.1. Encrypted Connections
        2. 6.4.2. Usernames, Passwords, and Such
      5. 6.5. Retrieving Mails
        1. 6.5.1. Configuring Your Firewall
        2. 6.5.2. Configuring Dovecot
      6. 6.6. Using Webmail
      7. 6.7. Summary
    3. 7. Understanding DNS
      1. 7.1. What Is DNS?
        1. 7.1.1. DNS Was Born
        2. 7.1.2. The WHOIS System
        3. 7.1.3. The Root DNS Servers
        4. 7.1.4. The Resolver
        5. 7.1.5. The Hosts File
        6. 7.1.6. nsswitch
      2. 7.2. NSCD
      3. 7.3. What Is BIND?
        1. 7.3.1. Primary and Secondary Name Servers
          1. 7.3.1.1. Primary Name Server
          2. 7.3.1.2. Secondary Name Server
        2. 7.3.2. Installing BIND
      4. 7.4. Setting Up a Caching Name Server
        1. 7.4.1. Making DNS Available to Other Machines
        2. 7.4.2. Configuring BIND to Host Domains
        3. 7.4.3. A Records
        4. 7.4.4. CNAME Records
        5. 7.4.5. MX Records
        6. 7.4.6. NS Records
        7. 7.4.7. Quick Round-Up
      5. 7.5. Creating a Master Server
      6. 7.6. Creating a Slave Zone
      7. 7.7. Allowing Zone Transfers
      8. 7.8. Gotchas
        1. 7.8.1. Forgetting to Increment the Serial Number
        2. 7.8.2. Forgetting the Dot in the Record
      9. 7.9. Summary
    4. 8. Setting Up DHCP
      1. 8.1. How Does DHCP Work?
      2. 8.2. DHCP and CentOS
      3. 8.3. Installing DHCP
        1. 8.3.1. Configuring the Firewall
      4. 8.4. Configuring DHCP
        1. 8.4.1. A Minimal Configuration
          1. 8.4.1.1. Starting and Stopping the DHCP Daemon
        2. 8.4.2. Extended Configuration
        3. 8.4.3. Defining Static IP Addresses
        4. 8.4.4. Grouping Statements
        5. 8.4.5. Shared Networks
        6. 8.4.6. Relaying DHCP Requests
      5. 8.5. PXE Booting
        1. 8.5.1. Configuring dhcpd for PXE Boot
      6. 8.6. DHCP Integration with DNS
      7. 8.7. Summary
    5. 9. Sharing Files with Samba
      1. 9.1. Windows Networking Basics
        1. 9.1.1. The Basic Protocols
        2. 9.1.2. Workgroups
        3. 9.1.3. Windows Domains
        4. 9.1.4. Active Directory
      2. 9.2. Samba and CentOS Basics
      3. 9.3. Preparing to Set Up Samba
      4. 9.4. Installing Samba
      5. 9.5. Configuring Samba
        1. 9.5.1. Example Configuration
        2. 9.5.2. Minimal Stand-Alone Samba Setup
        3. 9.5.3. Shares and Security
        4. 9.5.4. Extended Stand-Alone Example
        5. 9.5.5. Samba As a Domain Member
      6. 9.6. Summary
    6. 10. Setting Up Virtual Private Networks
      1. 10.1. What Is a Virtual Private Network?
      2. 10.2. Using SSH for Virtual Private Networks
      3. 10.3. Using IPSec
        1. 10.3.1. IPSec Explained
        2. 10.3.2. Virtual Private Networks with IPSec
      4. 10.4. Configuring OpenVPN
        1. 10.4.1. Looking at an Example
        2. 10.4.2. Configuring the Server Side
        3. 10.4.3. Configuring the Client
        4. 10.4.4. Some Security Considerations
        5. 10.4.5. Doing It the Even Easier Way
      5. 10.5. Summary
  9. 3. Enterprise Features
    1. 11. Using Core Builds
      1. 11.1. What Are Core Builds?
        1. 11.1.1. What Can't Core Builds Do?
        2. 11.1.2. Why Create a Core Build?
      2. 11.2. What Are Kickstart Files?
        1. 11.2.1. Anatomy of a Kickstart File
        2. 11.2.2. The Command Section
          1. 11.2.2.1. install
          2. 11.2.2.2. cdrom
          3. 11.2.2.3. lang
          4. 11.2.2.4. keyboard
          5. 11.2.2.5. xconfig
          6. 11.2.2.6. network
          7. 11.2.2.7. rootpw
          8. 11.2.2.8. firewall
          9. 11.2.2.9. authconfig
          10. 11.2.2.10. selinux
          11. 11.2.2.11. timezone
          12. 11.2.2.12. bootloader
          13. 11.2.2.13. part
        3. 11.2.3. %packages Section
        4. 11.2.4. The Scripts Section
          1. 11.2.4.1. %pre Scripts
          2. 11.2.4.2. %post Scripts
        5. 11.2.5. Using a Kickstart File on a Web Server
        6. 11.2.6. Dynamically Creating Kickstart Files
      3. 11.3. Installing CentOS over HTTP
      4. 11.4. Updating Your Kickstart File to Install CentOS via HTTP
      5. 11.5. Summary
    2. 12. Using High Availability
      1. 12.1. Clustering and High Availability
      2. 12.2. Theory of HA
        1. 12.2.1. Split Brain and Fencing
        2. 12.2.2. Resources
        3. 12.2.3. Service or Virtual IP Address
      3. 12.3. HA Cluster Suite Components
      4. 12.4. HA Clustering with CentOS
      5. 12.5. Preparing Your Cluster
        1. 12.5.1. Installing CCS
        2. 12.5.2. Installing HPS
      6. 12.6. Configuring CCS
      7. 12.7. Configuring HPS
      8. 12.8. Building Clusters Using CCS
        1. 12.8.1. Creating a Basic Cluster with CCS
        2. 12.8.2. Advanced Configurations Using CCS
        3. 12.8.3. Advanced Example with CCS
      9. 12.9. Building Clusters Using HPS
        1. 12.9.1. Creating a Basic Cluster with HPS
        2. 12.9.2. Advanced Configurations Using HPS
        3. 12.9.3. Advanced Setup with HPS
      10. 12.10. Summary
    3. 13. Monitoring Your Network Using Nagios
      1. 13.1. How Nagios Works
      2. 13.2. Installing Nagios
      3. 13.3. Initial Setup of Nagios
      4. 13.4. Nagios Configuration Overview
      5. 13.5. Objects and Templates
      6. 13.6. Basic Nagios Configuration
      7. 13.7. Contacts and Notifications
      8. 13.8. Advanced Nagios Configuration
      9. 13.9. Summary