Mastering Linux System Administration
Реклама. ООО «ЛитРес», ИНН: 7719571260.
Оглавление
Richard Blum. Mastering Linux System Administration
Table of Contents
List of Tables
List of Illustrations
Guide
Pages
Mastering Linux® System Administration
Acknowledgments
About the Authors
About the Technical Editor
Introduction
Who Should Read This Book
What You Will Learn
What You Need
The Mastering Series
How to Contact Wiley or the Authors
Part 1 Basic Admin Functions
Chapter 1 Understanding the Basics
What Is Linux?
Looking into the Linux Kernel
SYSTEM MEMORY MANAGEMENT
Real World Scenario. LOOKING AT MEMORY
SOFTWARE PROGRAM MANAGEMENT
Real World Scenario. EXAMINING PROCESSES
HARDWARE MANAGEMENT
FILESYSTEM MANAGEMENT
The GNU Utilities
Linux User Interfaces
THE X WINDOW SOFTWARE
THE KDE PLASMA DESKTOP
THE GNOME DESKTOP
GNOME CONTROVERSY
OTHER DESKTOPS
THE COMMAND‐LINE INTERFACE
Linux Distributions
Core Linux Distributions
Specialized Linux Distributions
THE LINUX LiveDVD
The Bottom Line
Chapter 2 Installing an Ubuntu Server
Pre‐Installation Requirements
UNDERSTANDING BASIC VIRTUALIZATION TERMS
Hardware Requirements
Virtual Server Requirements
Finding the Software
Oracle VirtualBox
Ubuntu Server
Real World Scenario. CHECKING THE UBUNTU SERVER ISO IMAGE FILE
PREPARING FOR A HARDWARE INSTALLATION
Running the Installation
Oracle VirtualBox
Real World Scenario. INSTALLING ORACLE VIRTUALBOX ON WINDOWS 10
Ubuntu Server
Real World Scenario. SETTING UP AN UBUNTU SERVER CONFIGURATION WITHIN ORACLE VirtualBox
Real World Scenario. INSTALLING UBUNTU SERVER AS A VM
Checking the Installation
The Bottom Line
Chapter 3 Installing and Maintaining Software in Ubuntu
Exploring Package Management
Inspecting the Debian‐Based Systems
Managing Packages with apt
Installing Software Packages with apt
Real World Scenario. INSTALLING SOFTWARE USING APT
Upgrading Software with apt
UPDATING A NEW INSTALLATION
Uninstalling Software with apt
The apt Repositories
SOFTWARE VERSIONS
Using Snap Containers
Real World Scenario. INSTALLING SOFTWARE SNAPS
Installing from Source Code
Real World Scenario. INSTALLING SOFTWARE FROM SOURCE CODE
THE CORE LINUX PROGRAMMING LANGUAGES
The Bottom Line
Chapter 4 Installing a Red Hat Server
Pre‐Installation Requirements
UNDERSTANDING RED HAT CHARGES FOR RHEL
UNDERSTANDING BASIC VIRTUALIZATION TERMS
Hardware Requirements
Virtual Server Requirements
Finding the Software
Oracle VirtualBox
CentOS
Real World Scenario. Understanding an ISO Image File
ENDURING A POTENTIALLY PAINFUL DOWNLOAD OF AN ISO FILE
UNDERSTANDING HASHING
Real World Scenario. CHECKING THE CentOS ISO IMAGE FILE
PREPARING FOR A HARDWARE INSTALLATION
Running the Installation
Oracle VirtualBox
CONSIDERING THE INSTALLATION OF ORACLE VIRTUALBOX
CentOS
Real World Scenario. SETTING UP A CentOS CONFIGURATION WITHIN ORACLE VirtualBox
Real World Scenario. INSTALLING CentOS AS A VM
Checking the Installation
The Bottom Line
Chapter 5 Installing and Maintaining Software in Red Hat
Exploring Red Hat Packages
Automated Package Management
Listing Installed Packages
Installing Software with dnf
Real World Scenario. INSTALLING SOFTWARE USING DNF
ROOT PRIVILEGES
Upgrading Software with dnf
Uninstalling Software with dnf
Handling Broken Dependencies
Working with RPM Repositories
ROGUE REPOSITORIES
Working Directly with Packages
Finding Package Files
Inspecting Package Files
LISTING INSTALLED PACKAGES
Installing Package Files
Real World Scenario. MANUALLY INSTALLING RPM PACKAGES
Removing Package Files
Using Flatpak Containers
Real World Scenario. INSTALLING FLATPAK
The Bottom Line
Chapter 6 Working with the Shell
Exploring the Shell
REACHING A VIRTUAL CONSOLE
SWITCHING TO A DIFFERENT VIRTUAL CONSOLE
The Shell Prompt
The Shell Manual
GETTING HELP WITH THE MAN PAGES
GETTING ADDITIONAL HELP
Real World Scenario. FINDING HELP INFORMATION
Working with Commands
Entering Commands
DETERMINING WHETHER A COMMAND IS A PROGRAM BUILT INTO THE SHELL
Real World Scenario. USING COMMAND COMPLETION FOR SPEED
Retrieving Past Commands
Redirecting Commands
REDIRECTING STDOUT
REDIRECTING STDERR
REDIRECTING THROUGH PIPES
SPLITTING THE REDIRECTION
Environment Variables
Global Environment Variables
User‐Defined Environment Variables
THE GLOBALIZATION OF VARIABLES
Real World Scenario. REDEFINING DEFAULT ENVIRONMENT VARIABLES
The Bottom Line
Chapter 7 Exploring Linux File Management
Filesystem Navigation
The Linux Filesystem
SLASHES IN LINUX
Traversing Directories
ABSOLUTE FILEPATHS
RELATIVE FILEPATHS
Linux Files
Determining File Types
Filenames
CASE SENSITIVITY
Hidden Files
File Inodes
File and Directory Listing
Basic Listing
Modifying Listing Information
The Complete Parameter List
Directory Handling
Creating Directories
Deleting Directories
DELETION QUERIES
File Handling
Creating Files
Copying Files
Linking Files
HARD LINKS AND PARTITIONS
HANDLING LINKED FILES
Renaming Files
Deleting Files
Real World Scenario. WORKING WITH FILES
File Features
Using Wildcards
Quoting
Case Sensitivity
Finding Files
The which Command
The locate Command
The whereis Command
The find Command
Archiving Files
Compressing Files
Creating Archive Files
Archiving Scenarios
Real World Scenario. WORKING WITH FILE ARCHIVES
The Bottom Line
Chapter 8 Working with Text Files
The vim Editor
LOOKING AT A LITTLE VIM EDITOR HISTORY
Checking Your vim Editor Program
Using the vim Editor
The nano Editor
Real World Scenario. CREATING AND MODIFYING A FILE WITH THE NANO TEXT EDITOR
Working with Data Files
Sorting
Searching
LOCATING FILES
FINDING LOCATE
FINDING FILES
SEARCHING FOR AND THROUGH FILES
REGULAR EXPRESSIONS
Compressing
Archiving
Real World Scenario. TRYING THE TAR COMMAND
The Bottom Line
Part 2 Intermediate Admin Functions
Chapter 9 Managing Hardware
Device Driver Modules
Listing Installed Modules
Real World Scenario. VIEWING THE INSTALLED MODULES
Installing New Modules
USING INSMOD
LISTING 9.1: Kernel Module Files on an Ubuntu Server
USING MODPROBE
Removing Modules
Communicating with Devices
Device Interfaces
PCI BOARDS
THE USB INTERFACE
USING USB DEVICES IN LINUX
The /dev Directory
LISTING 9.2: Partial Output from the /dev Directory
The /proc Directory
INTERRUPT REQUESTS
LISTING 9.3: Listing System Interrupts from the /proc Directory
I/O PORTS
LISTING 9.4: Displaying the I/O Ports on a System
DIRECT MEMORY ACCESS
The /sys Directory
LISTING 9.5: The Contents of the /sys Directory
Working with Devices
Finding Devices
THE LSBLK COMMAND
LISTING 9.6: The Output from the lsblk Command
THE DMESG COMMAND
LISTING 9.7: Partial Output from the dmesg Command
Working with PCI Cards
LISTING 9.8: Using the lspci Command
Working with USB Devices
Real World Scenario. ADDING A USB STORAGE DEVICE TO THE LINUX SYSTEM
Using Hot Pluggable Devices
Detecting Dynamic Devices
Working with Dynamic Devices
The Bottom Line
Chapter 10 Booting Linux
Understanding the Boot Process
Overview of the Boot Process
Watching the Boot Process
The Firmware Startup
THE BIOS STARTUP
THE UEFI STARTUP
The GRUB2 Bootloader
Configuring the GRUB2 Bootloader
Exploring the GRUB2 Configuration
DETERMINING YOUR SYSTEM'S GRUB2 LOCATIONS AND COMMANDS
Interacting with GRUB2
DISPLAYING THE BOOT MENU
Real World Scenario. EXPLORING THE GRUB2 KEY SETTINGS AND MENU
The systemd Initialization Process
Exploring Unit Files
Focusing on Service Unit Files
Real World Scenario. LOOKING AT SERVICE UNIT FILES
Focusing on Target Unit Files
Changing a Unit Configuration File
Changing the systemd Configuration File
Looking at systemctl
Jumping Targets
Analyzing with systemd
Real World Scenario. ANALYZING SYSTEM INITIALIZATION
The Bottom Line
Chapter 11 Working with Storage Devices
Storage Basics
Drive Connections
Partitioning Drives
Automatic Drive Detection
Partitioning Tools
Working with fdisk
Working with gdisk
CONVERTING DRIVES AND FIRMWARE
The GNU parted Command
Real World Scenario. PARTITIONING A NEW STORAGE DEVICE
Formatting Filesystems
Common Filesystem Types
LINUX FILESYSTEMS
NON‐LINUX FILESYSTEMS
Creating Filesystems
NO GOING BACK!
Real World Scenario. FORMATTING A NEW STORAGE DEVICE
Mounting Filesystems
Manually Mounting Devices
MOUNTING USING SPECIAL FEATURES
Automatically Mounting Devices
LISTING 11.1: The /etc/fstab File
USING ENCRYPTED FILESYSTEMS
Real World Scenario. MOUNTING A PARTITION
Managing Filesystems
Retrieving Filesystem Stats
DISK SPACE VS. INODES
Filesystem Tools
Storage Alternatives
Multipath
Logical Volume Manager
LISTING 11.2: Creating, Formatting, and Mounting a Logical Volume
Using RAID Technology
The Bottom Line
Chapter 12 Configuring Network Settings
Network Settings
Ubuntu Servers
LISTING 12.1: Sample Ubuntu Server Network Configuration
Red Hat Servers
LISTING 12.2: Sample CentOS Network Interface Configuration Settings
Using Network Command‐Line Tools
NetworkManager Tools
LISTING 12.3: The Default Output of the nmcli Command
Other Tools
The ethtool Command
LISTING 12.4: Output from the ethtool Command
THE IFCONFIG COMMAND
THE IP COMMAND
LISTING 12.5: The ip address Command Output
THE IWCONFIG COMMAND
THE ROUTE COMMAND
THE BOND COMMAND
NETWORK BRIDGING
USING DHCP TOOLS
RUNNING YOUR OWN DHCP SERVER
Real World Scenario. DETERMINING THE NETWORK ENVIRONMENT
Basic Network Troubleshooting
Sending Test Packets
USING PING TO TROUBLESHOOT WITH REMOTE HOSTS
Finding Host Information
Advanced Network Troubleshooting
The netstat Command
Examining Sockets
Real World Scenario. WATCHING FOR NETWORK CONNECTIONS
The Bottom Line
Chapter 13 Managing Users and Groups
Understanding Linux Permissions
Understanding Ownership
CHANGING FILE OR DIRECTORY OWNERSHIP
CHANGING THE FILE OR DIRECTORY GROUP
Controlling Access Permissions
Exploring Special Permissions
Managing Default Permissions
Real World Scenario. EXPLORING THE EFFECT OF THE USER MASK ON PERMISSIONS
Using Access Control Lists
Managing User Accounts
Adding Accounts
THE /ETC/LOGIN.DEFS FILE
THE /ETC/DEFAULT/USERADD FILE
THE /ETC/SKEL/ DIRECTORY
THE /ETC/PASSWD FILE
THE /ETC/SHADOW FILE
CREATING AN ACCOUNT
Maintaining Accounts
MANAGING PASSWORDS
MODIFYING ACCOUNTS
Removing Accounts
Maintaining the Environment
Setting Environment Variables
Exploring User Entries
Exploring Global Entries
Real World Scenario. DETERMINING THE EXISTENCE OF SYSTEM ENVIRONMENT FILES
Managing Groups
Adding Groups
Removing Groups
The Bottom Line
Chapter 14 Working with Processes and Jobs
Looking at Processes
ATTACK OF THE ZOMBIES
Monitoring Processes in Real Time
Managing Processes
Setting Priorities
Stopping Processes
THE KILL COMMAND
WATCH OUT FOR OPEN FILES
THE PKILL COMMAND
Real World Scenario. MANAGING A RUNNING PROCESS
Running Programs in Background Mode
Running in the Background
Running Multiple Background Jobs
Running Programs Without a Console
Job Control
Viewing Jobs
Restarting Stopped Jobs
Scheduling Jobs
Scheduling a Job Using the at Command
THE AT COMMAND FORMAT
RETRIEVING JOB OUTPUT
LISTING PENDING JOBS
REMOVING JOBS
Scheduling Recurring Programs
THE CRON TABLE
BUILDING THE CRON TABLE
CRON DIRECTORIES
The Bottom Line
Chapter 15 Managing Log Files
The systemd Journaling System
Configuring systemd‐journald
Looking at Journal Files
Making the Journal Persistent
Viewing Journal Entries
Real World Scenario. EXPLORING THE USE OF THE JOURNALCTL UTILITY
Maintaining the Journal
Viewing Different Journal Files
Protecting Journal Files
Making Journal Entries
Real World Scenario. ADDING ENTRIES TO THE JOURNAL
The rsyslog Legacy System
The syslog Protocol
Basic Logging Using rsyslogd
Layering Your Logging
Real World Scenario. LOOKING AT THE RSYSLOG CONFIGURATION FILES
Making Log Entries
Finding Event Messages
The Bottom Line
Chapter 16 Managing Printers
The Common Unix Printing System
Printer Drivers
Web Interface
Command‐Line Commands
LISTING 16.1: Printing from the Command Line in Linux
Printer Sharing
Printer Classes
SHARING NETWORKED PRINTERS
Installing and Configuring CUPS
Installing CUPS
LISTING 16.2: Installing CUPS on a CentOS Server
Preparing the Server to Use CUPS
CONFIGURATION FILE CHANGES
USER ACCOUNT CHANGES
FIREWALL CHANGES
Using CUPS
Administration Functions
SERVER SETTINGS
PRINTER SETTINGS
Real World Scenario. CREATING A TEST PRINTER
Managing Printers and Jobs in CUPS
The Bottom Line
Part 3 Advanced Admin Functions
Chapter 17 Exploring Ubuntu Security
Locking Down Root
Looking at Linux Account Types
Gaining Super User Privileges
LOOKING AT THE SU COMMAND
Real World Scenario. DETERMINING YOUR PRIVILEGE ELEVATION STATUS
Using OpenSSH on Ubuntu
Exploring Basic SSH Concepts
INTERPRETING OpenSSH MESSAGES
Real World Scenario. USING OpenSSH TO LOG INTO A SYSTEM
Configuring SSH
Generating SSH Keys
Authenticating with SSH Keys
The AppArmor System
Network Security Using Firewalls
Understanding UFW
Configuring UFW
Real World Scenario. VIEWING AND CONFIGURING UFW
The Bottom Line
Chapter 18 Exploring Red Hat Security
Working with Root Access
Keeping Track of Root Logins
LISTING 18.1The aulast Command Output
Disabling Root Access from SSH
Enabling Automatic Logout
Real World Scenario. TESTING THE TIMEOUT FEATURE
Blocking Root Access
Changing root Features
Using SELinux
Enabling SELinux
Understanding Security Context
Using Policies
LISTING 18.2 Using the -a Option with the getsebool Command
Network Security Using Firewalls
Red Hat Firewall Concepts
Checking the Firewall Status
Working with Zones
Working with Firewall Rules
The Bottom Line
Chapter 19 Writing Scripts
Beginning a Shell Script
Creating a Script File
USING OTHER SHELLS
Displaying Messages
Using Variables
Environment Variables
User Variables
Command Substitution
Exiting the Script with Status
Passing Parameters
Real World Scenario. WRITING A SIMPLE SHELL SCRIPT WITH VARIABLES
Adding Conditional Expressions
Working with the if-then Statement
Using Compound Tests
Working with the if-then-else Statement
Trying the case Statement
Using Loops
Looking at the for Command
Working with the while Format
Using the until Command
Real World Scenario. ADDING CONDITIONAL EXPRESSIONS AND LOOPS TO A SHELL SCRIPT
Using Functions
Creating Functions
Calling Functions
The Bottom Line
Chapter 20 Managing Web Servers
IN THIS CHAPTER, YOU'LL LEARN HOW TO
Linux Web Servers
Apache
APACHE SERVER VERSIONS
nginx
The Apache Web Server
Installing an Apache Server
ADVANCED FEATURES
Configuring the Apache Server
MULTIPLE CONFIGURATION FILES
BASIC SETUP
APACHE LOGS
USER WEB HOSTING
WEB DIRECTORY PERMISSIONS
VIRTUAL WEB HOSTING
ACCESS RESTRICTION
Hosting Dynamic Web Applications
THE COMMON GATEWAY INTERFACE
PROGRAMMING MODULES
PROGRAMMING SUPPORT WARNINGS
Creating a Secure Web Server
The nginx Server
Installing nginx
RUNNING MULTIPLE WEB SERVERS
Configuring nginx
Real World Scenario. TESTING YOUR WEB SERVER FROM THE COMMAND LINE
The Bottom Line
Chapter 21 Managing Database Servers
Linux Database Servers
Organizing the Data
Querying the Data
Controlling the Data
Installing and Using MySQL/MariaDB
UNDERSTANDING THE DIFFERENCE BETWEEN MYSQL AND MARIADB
Conducting a MariaDB Installation
Real World Scenario. INSTALLING THE MARIADB SERVER ON YOUR UBUNTU SYSTEM
Real World Scenario. INSTALLING THE MARIADB SERVER ON YOUR RED HAT–BASED SYSTEM
Accessing a MariaDB Database
Populating and Using MariaDB Database
Real World Scenario. CREATING A DATABASE WITH MARIADB
Installing and Using PostgreSQL
Conducting a PostgreSQL Installation
Accessing a PostgreSQL Database
Populating and Using a PostgreSQL Database
The Bottom Line
Chapter 22 Exploring the Virtualization Environment
Hypervisors
Managing VMs
Creating a Virtual Machine
Integrating via Linux Extensions
Containers
Exploring Container Types
Looking at Container Software
Real World Scenario. TRYING OUT DOCKER ON YOUR LINUX SYSTEM
Organizing Containers
EMBRACING KUBERNETES
INSPECTING DOCKER SWARM
SURVEYING MESOS
Software Packaging
Looking at Ubuntu Snap
EXPLORING THE SNAP PACKAGE SYSTEM
INSTALLING THE SNAP FRAMEWORK
USING BASIC COMMANDS
VIEWING THE SNAP DIRECTORIES
Real World Scenario. USING SNAP ON YOUR LINUX SYSTEM
Looking at Flatpak
EXPLORING THE FLATPAK PACKAGE SYSTEM
INSTALLING THE FLATPAK FRAMEWORK
USING BASIC COMMANDS
The Bottom Line
Appendix The Bottom Line
Chapter 1: Understanding the Basics
Chapter 2: Installing an Ubuntu Server
Chapter 3: Installing and Maintaining Software in Ubuntu
Chapter 4: Installing a Red Hat Server
Chapter 5: Installing and Maintaining Software in Red Hat
Chapter 6: Working with the Shell
Chapter 7: Exploring Linux File Management
Chapter 8: Working with Text Files
Chapter 9: Managing Hardware
Chapter 10: Booting Linux
Chapter 11: Working with Storage Devices
Chapter 12: Configuring Network Settings
Chapter 13: Managing Users and Groups
Chapter 14: Working with Processes and Jobs
Chapter 15: Managing Log Files
Chapter 16: Managing Printers
Chapter 17: Exploring Ubuntu Security
Chapter 18: Exploring Red Hat Security
Chapter 19: Writing Scripts
Chapter 20: Managing Web Servers
Chapter 21: Managing Database Servers
Chapter 22: Exploring the Virtualization Environment
Index
WILEY END USER LICENSE AGREEMENT
Отрывок из книги
Christine Bresnahan
Richard Blum
.....
The X Window software is a low‐level program that works directly with the video card and monitor in the PC and controls how Linux applications can present fancy windows and graphics on your computer.
Linux isn't the only operating system that uses X Window; there are versions written for many different operating systems. In the Linux world, there are a few different software packages that can implement it. There are two X Window packages that are most commonly used in Linux:
.....