You are previewing CentOS 7 Linux Server Cookbook - Second Edition.
O'Reilly logo
CentOS 7 Linux Server Cookbook - Second Edition

Book Description

Over 80 recipes to get up and running with CentOS 7 Linux server

About This Book

  • A practical guide to install, configure, administer and maintain CentOS 7 servers

  • An in-depth guide to the CentOS 7 operating system, exploring its various new features and changes in server administration

  • Presents tricks and solutions to tackle common server issues with the help of practical examples and real-life scenarios

  • Who This Book Is For

    This book is targeted at beginner and more experienced system administrators alike who want to use CentOS as their server solution. Readers do not need much pre-knowledge or experience at all to work with this book.

    What You Will Learn

  • Install and configure CentOS 7 Linux server system from scratch using normal and advanced methods

  • Maintain a performance-based and secure server solution by deploying expert configuration advice and managing software packages

  • Monitor, manage and develop your server's file system to maintain a stable performance

  • Gain best practice methods on sharing files and resources through a network

  • Install and configure common standard services such as web, mail, FTP, database and domain name server technologies

  • Introduce you to the world of operating-system-level virtualization using the Docker platform.

  • Understand the fundamentals of the Security-Enhanced Linux access control architecture

  • Monitor your IT infrastructure using Nagios

  • In Detail

    This book will provide you with a comprehensive series of starting points that will give you direct access to the inner workings of the latest CentOS version 7 and help you trim the learning curve to master your server.

    You will begin with the installation and basic configuration of CentOS 7, followed by learning how to manage your system, services and software packages. You will then gain an understanding of how to administer the file system, secure access to your server and configure various resource sharing services M42such as file, printer and DHCP servers across your network. Further on, we cover advanced topics such as FTP services, building your own DNS server, running database servers, and providing mail and web services. Finally, you will get a deep understanding of SELinux and you will learn how to work with Docker operating-system virtualization and how to monitor your IT infrastructure with Nagios.

    By the end of this book, you will have a fair understanding of all the aspects of configuring, implementing and administering CentOS 7 Linux server and how to put it in control.

    Style and approach

    This book is a practical reference guide with hands-on examples and solutions to real-world administration problems. It covers in-depth and comprehensive information on CentOS 7 and its new features.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. CentOS 7 Linux Server Cookbook Second Edition
      1. Table of Contents
      2. CentOS 7 Linux Server Cookbook Second Edition
      3. Credits
      4. About the Authors
      5. About the Reviewer
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Installing CentOS
        1. Introduction
        2. Downloading CentOS and confirming the checksum on Windows or OS X
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Creating USB installation media on Windows or OS X
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Performing an installation of CentOS using the graphical installer
          1. Getting ready
          2. How to do it...
          3. How it works…
        5. Running a netinstall over HTTP
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Installing CentOS 7 using a kickstart file
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Getting started and customising the boot loader
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Troubleshooting the system in rescue mode
          1. Getting ready
          2. How to do it...
            1. Reaching rescue mode
            2. Accessing the filesystem
            3. Accessing the filesystem
            4. Re-install the CentOS boot loader
          3. How it works...
        9. Updating the installation and enhancing the minimal install with additional administration and development tools
          1. Getting ready
          2. How to do it...
          3. How it works...
      9. 2. Configuring the System
        1. Introduction
        2. Navigating text files with less
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Introduction to Vim
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Speaking the right language
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        5. Synchronizing the system clock with NTP and the chrony suite
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Setting your hostname and resolving the network
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Building a static network connection
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Becoming a superuser
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Customizing your system banners and messages
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        10. Priming the kernel
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      10. 3. Managing the System
        1. Introduction
        2. Knowing and managing your background services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Troubleshooting background services
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Tracking system resources with journald
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Configuring journald to make it persistent
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Managing users and their groups
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Scheduling tasks with cron
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Synchronizing files and doing more with rsync
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Maintaining backups and taking snapshots
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Monitoring important server infrastructure
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Taking control with GIT and Subversion
          1. Getting ready
          2. How to do it...
          3. How it works
          4. There's more...
      11. 4. Managing Packages with YUM
        1. Introduction
        2. Using YUM to update the system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Using YUM to search for packages
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Using YUM to install packages
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Using YUM to remove packages
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Keeping YUM clean and tidy
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Knowing your priorities
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Using a third-party repository
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Creating a YUM repository
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        10. Working with the RPM package manager
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      12. 5. Administering the Filesystem
        1. Introduction
        2. Creating a virtual block device
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Formatting and mounting a filesystem
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
        4. Using disk quotas
          1. Getting ready
          2. How to do it...
            1. Enabling user and group quotas
            2. Enabling project (directory) quotas
          3. How it works...
          4. There's more...
        5. Maintaining a filesystem
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Extending the capacity of the filesystem
          1. Getting ready
          2. How to do it...
          3. How it works...
      13. 6. Providing Security
        1. Introduction
        2. Locking down remote access and hardening SSH
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Changing the SSH port number of your server
            2. Limiting SSH access by user or group
        3. Installing and configuring fail2ban
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Working with a firewall
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Forging the firewall rules by example
          1. Getting ready
          2. How to do it...
            1. To change an existing firewalld service (ssh)
            2. To create your own new service
          3. How it works...
          4. There's more...
        6. Generating self-signed certificates
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Using secure alternatives to FTP
          1. Getting ready
          2. How to do it...
            1. Securing your vsftpd server with SSL–FTPS
            2. Securing your vsftpd server using SSH – SFTP
          3. How it works...
          4. There's more...
      14. 7. Building a Network
        1. Introduction
        2. Printing with CUPS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to add a network printer to the CUPS server
            2. How to share a local printer to the CUPS server
        3. Running a DHCP server
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Using WebDAV for file sharing
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Installing and configuring NFS
          1. Getting ready
          2. How to do it...
            1. Installing and configuring the NFS server
            2. Creating an export share
          3. How it works...
        6. Working with NFS
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Securely sharing resources with Samba
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      15. 8. Working with FTP
        1. Introduction
        2. Installing and configuring the FTP service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Working with virtual FTP users
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Customizing the FTP service
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Troubleshooting users and file transfers
          1. Getting ready
          2. How to do it...
          3. How it works...
      16. 9. Working with Domains
        1. Introduction
        2. Installing and configuring a caching-only nameserver
          1. Getting ready
          2. How to do it...
            1. Configuring a caching-only Unbound DNS server
            2. Configuring a forwarding only DNS server
          3. How it works...
          4. There's more...
        3. Setting up an authoritative-only DNS server
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Creating an integrated nameserver solution
          1. Getting ready
          2. How to do it...
          3. How it works
          4. There's more...
        5. Populating the domain
          1. Getting ready
          2. How to do it...
          3. How it works…
        6. Building a secondary (slave) DNS server
          1. Getting ready
          2. How to do it...
            1. Changes to the primary DNS server
            2. Changes to the secondary DNS server(s)
          3. How it works...
      17. 10. Working with Databases
        1. Introduction
        2. Installing a MariaDB database server
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Managing a MariaDB database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Reviewing and revoking permissions or dropping a user
        4. Allowing remote access to a MariaDB server
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Installing a PostgreSQL server and managing a database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Configuring remote access to PostgreSQL
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Installing phpMyAdmin and phpPgAdmin
          1. Getting ready
          2. How to do it...
            1. Installing and configuring phpMyAdmin
            2. Installing and configuring phpPgAdmin
          3. How it works...
      18. 11. Providing Mail Services
        1. Introduction
        2. Configuring a domain-wide mail service with Postfix
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Changing an e-mail's appearing domain name
            2. Using TLS- (SSL) encryption for SMTP communication
            3. Configure BIND to use your new mailserver
        3. Working with Postfix
          1. How to do it...
            1. Connecting mailx to a remote MTA
            2. Reading your local mails from the mailbox
          2. How it works...
        4. Delivering the mail with Dovecot
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Setting up e-mail software
        5. Using Fetchmail
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Configuring Fetchmail with gmail.com and outlook.com e-mail accounts
            2. Automating Fetchmail
      19. 12. Providing Web Services
        1. Introduction
        2. Installing Apache and serving web pages
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Enabling system users and building publishing directories
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Implementing name-based hosting
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Implementing CGI with Perl and Ruby
          1. Getting ready
          2. How to do it...
            1. Creating your first Perl CGI script
            2. Creating your first Ruby CGI script
          3. How it works...
          4. There's more...
        6. Installing, configuring, and testing PHP
          1. Getting ready
          2. How to do it...
          3. How to do it...
        7. Securing Apache
          1. Getting ready
          2. How to do it...
            1. Configuring httpd.conf to provide better security
            2. Removing unneeded httpd modules
            3. Protecting your Apache files
          3. How it works...
        8. Setting up HTTPS with Secure Sockets Layer (SSL)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      20. 13. Operating System-Level Virtualization
        1. Introduction
        2. Installing and configuring Docker
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Downloading an image and running a container
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Stopping and starting a container
            2. Attaching and interacting with your container
        4. Creating your own images from Dockerfiles and uploading to Docker Hub
          1. Getting ready
          2. How to do it...
            1. Uploading your image to the Docker Hub
          3. How it works...
        5. Setting up and working with a private Docker registry
          1. Getting ready
          2. How to do it...
            1. Steps to be done on our Docker registry server (192.168.1.100)
            2. Steps to be done on every client needing access to our registry
          3. How it works...
      21. 14. Working with SELinux
        1. Introduction
        2. Installing and configuring important SELinux tools
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Working with SELinux security contexts
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Working with policies
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Troubleshooting SELinux
          1. Getting ready
          2. How to do it...
          3. How it works...
      22. 15. Monitoring IT Infrastructure
        1. Introduction
        2. Installing and configuring Nagios Core
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Setting up NRPE on remote client hosts
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Monitoring important remote system metrics
          1. Getting ready
          2. How to do it...
          3. How it works...
      23. Index