You are previewing Troubleshooting CentOS.
O'Reilly logo
Troubleshooting CentOS

Book Description

A practical guide to troubleshooting the CentOS 7 community-based enterprise server

In Detail

CentOS is the enterprise-grade Linux operating system built using the same source code as Red Hat Enterprise Linux (RHEL) to provide a free-to-use alternative to Red Hat's commercial Linux offering.

The purpose of this book is to build on your understanding of CentOS and to explore those mission-critical services you are entrusted to manage and maintain. Starting with a brief introduction to the overall subject of troubleshooting a CentOS server, this book will take you on a journey across the whole spectrum of issue-based problem solving, which includes active processes, the networking environment, package management, users, folders, files, shared resources, security, databases, and web-based services. By the end of the book, you will have expert-level competency in identifying and diagnosing the root causes of CentOS storage, network, and administration issues and resolving them.

What You Will Learn

  • Consider the need to understand, manipulate, and make use of the relevant system log files

  • Analyze, review, and make decisions regarding how and what to do with troublesome active processes on a CentOS server

  • Discover how to approach issues regarding the network environment

  • Approach issues regarding package management and learn how to make the necessary steps to diagnose and fix the problems found in relation to their YUM- and RPM-based needs

  • Diagnose and troubleshoot issues related to Samba, NFS, and various external storage methods

  • Diagnose and troubleshoot issues related to iptables, SELinux, some common firewalls, shell access, and SSH

  • 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 If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Troubleshooting CentOS
      1. Table of Contents
      2. Troubleshooting CentOS
      3. Credits
      4. About the Author
      5. About the Reviewers
        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. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Basics of Troubleshooting CentOS
        1. Installing some basic tools
        2. Gathering hardware information
        3. Understanding dmesg
        4. Understanding log files
        5. Reading log files and affecting the output
        6. Using tail to monitor log files
        7. Using cat, less, and more
        8. Using grep
        9. Using diff
        10. Using truncation
        11. Summary
        12. References
      9. 2. Troubleshooting Active Processes
        1. Tuning server performance with memory management and swap
        2. Managing memory with vmstat
        3. Checking the system load with the top command
        4. Monitoring disk I/O with iotop
        5. Checking processes with the ps command
        6. Checking performance with iostat and lsof
        7. Calculating the system load
        8. Discovering process IDs with pgrep and systemctl
        9. More about systemd
        10. Issuing the kill signal
        11. Dealing with an orphaned process
        12. Summary
        13. References
      10. 3. Troubleshooting the Network Environment
        1. Using ping, dig, host, traceroute, and mtr
          1. The ping command
          2. The dig and host commands
          3. The traceroute command
          4. The mtr command
        2. Monitoring network connections with the ss command
        3. Packet analysis with tcpdump
        4. Summary
        5. References
      11. 4. Troubleshooting Package Management and System Upgrades
        1. Gathering software information
        2. Using Yum plugins
        3. Fixing Yum operations
        4. Installing additional Yum repositories
          1. EPEL
          2. Remi
          3. The IUS repository
        5. Downloading an RPM package with Yum
        6. Diagnosing a corrupt RPM database
        7. Minor release upgrades
        8. Summary
        9. References
      12. 5. Troubleshooting Users, Directories, and Files
        1. Users
          1. Adding users and forcing a password change
          2. Deleting users
          3. Modifying a user
          4. Meet login.defs
        2. Monitoring user activity with utmpdump
        3. Resetting the root password and enhancing logging
        4. Recovering lost or deleted files with Scalpel
        5. Restoring file and directory permissions
        6. Working with and extending the XFS filesystem
        7. Running repairs on XFS
        8. Investigating fragmentation on XFS
        9. Auditing directories and files
        10. Visualizing directories and files
        11. Summary
        12. References
      13. 6. Troubleshooting Shared Resources
        1. Providing NFS shares on a CentOS 7 server
        2. About NFS exports
        3. Mounting NFS shares on a CentOS client
        4. Mounting an external drive with CIFS
        5. Using autofs to mount an external drive
        6. Summary
        7. References
      14. 7. Troubleshooting Security Issues
        1. Auditing SELinux with aureport and setroubleshoot
        2. SSH banners
        3. Tuning SSH
        4. Intrusion detection with Tripwire
        5. Firewalld – zone, service, and port management
        6. Removing Firewalld and returning to iptables
        7. Summary
        8. References
      15. 8. Troubleshooting Database Services
        1. Getting up-and-running with MariaDB
        2. Resetting and recovering a root password with MariaDB
        3. Tuning MariaDB and MySQL
        4. Obtaining metrics from MariaDB and MySQL
        5. Returning to MySQL
        6. Installing and configuring PostgreSQL 9
        7. Summary
        8. References
      16. 9. Troubleshooting Web Services
        1. Auditing the server with cURL
        2. Debugging Akamai headers with cURL
        3. Adding Varnish to Apache
        4. Testing Varnish with cURL
        5. Using cURL to access an FTP directory
        6. Enabling mod_status in Apache
        7. Summary
        8. References
      17. 10. Troubleshooting DNS Services
        1. Changing the hostname and managing the FQDN
        2. Performing system sanity checks with BIND
        3. Monitoring bandwidth with iftop
        4. Flushing the cache
        5. Summary
        6. References
      18. Index