+353-1-416-8900REST OF WORLD
+44-20-3973-8888REST OF WORLD
1-917-300-0470EAST COAST U.S
1-800-526-8630U.S. (TOLL FREE)

Mastering Linux System Administration. Edition No. 1

  • Book

  • 576 Pages
  • September 2021
  • John Wiley and Sons Ltd
  • ID: 5838689

Achieve Linux system administration mastery with time-tested and proven techniques

In Mastering Linux System Administration, Linux experts and system administrators Christine Bresnahan and Richard Blum deliver a comprehensive roadmap to go from Linux beginner to expert Linux system administrator with a learning-by-doing approach. Organized by do-it-yourself tasks, the book includes instructor materials like a sample syllabus, additional review questions, and slide decks.

Amongst the practical applications of the Linux operating system included within, you'll find detailed and easy-to-follow instruction on:

  • Installing Linux servers, understanding the boot and initialization processes, managing hardware, and working with networks
  • Accessing the Linux command line, working with the virtual directory structure, and creating shell scripts to automate administrative tasks
  • Managing Linux user accounts, system security, web and database servers, and virtualization environments

Perfect for entry-level Linux system administrators, as well as system administrators familiar with Windows, Mac, NetWare, or other UNIX systems, Mastering Linux System Administration is a must-read guide to manage and secure Linux servers.

Table of Contents

Introduction xxv

Part 1 Basic Admin Functions 1

Chapter 1 Understanding the Basics 3

What is Linux? 3

Looking into the Linux Kernel 4

The GNU Utilities 12

Linux User Interfaces 12

Linux Distributions 18

Core Linux Distributions 19

Specialized Linux Distributions 19

The Bottom Line 20

Chapter 2 Installing an Ubuntu Server 23

Pre-Installation Requirements 23

Hardware Requirements 24

Virtual Server Requirements 25

Finding the Software 26

Oracle VirtualBox 26

Ubuntu Server 26

Running the Installation 29

Oracle VirtualBox 29

Ubuntu Server 33

Checking the Installation 49

The Bottom Line 50

Chapter 3 Installing and Maintaining Software in Ubuntu 53

Exploring Package Management 53

Inspecting the Debian-Based Systems 54

Managing Packages with apt 54

Installing Software Packages with apt 56

Upgrading Software with apt 59

Uninstalling Software with apt 60

The apt Repositories 61

Using Snap Containers 62

Installing from Source Code 64

The Bottom Line 66

Chapter 4 Installing a Red Hat Server 69

Pre-Installation Requirements 69

Hardware Requirements 70

Virtual Server Requirements 71

Finding the Software 72

Oracle VirtualBox 72

CentOS 73

Running the Installation 76

Oracle VirtualBox 77

CentOS 77

Checking the Installation 96

The Bottom Line 97

Chapter 5 Installing and Maintaining Software in Red Hat 99

Exploring Red Hat Packages 99

Automated Package Management 100

Listing Installed Packages 100

Installing Software with dnf 102

Upgrading Software with dnf 104

Uninstalling Software with dnf 104

Handling Broken Dependencies 105

Working with RPM Repositories 106

Working Directly with Packages 107

Finding Package Files 107

Inspecting Package Files 108

Installing Package Files 109

Removing Package Files 110

Using Flatpak Containers 111

The Bottom Line 113

Chapter 6 Working with the Shell 115

Exploring the Shell 115

The Shell Prompt 116

The Shell Manual 117

Working with Commands 121

Entering Commands 121

Retrieving Past Commands 123

Redirecting Commands 125

Environment Variables 129

Global Environment Variables 129

User-Defined Environment Variables 131

The Bottom Line 133

Chapter 7 Exploring Linux File Management 135

Filesystem Navigation 135

The Linux Filesystem 135

Traversing Directories 138

Linux Files 139

Determining File Types 139

Filenames 140

Hidden Files 140

File Inodes 141

File and Directory Listing 142

Basic Listing 142

Modifying Listing Information 143

The Complete Parameter List 143

Directory Handling 146

Creating Directories 146

Deleting Directories 146

File Handling 147

Creating Files 147

Copying Files 148

Linking Files 150

Renaming Files 152

Deleting Files 152

File Features 154

Using Wildcards 154

Quoting 155

Case Sensitivity 156

Finding Files 156

The which Command 156

The locate Command 156

The whereis Command 157

The find Command 157

Archiving Files 159

Compressing Files 159

Creating Archive Files 160

Archiving Scenarios 161

The Bottom Line 163

Chapter 8 Working with Text Files 165

The vim Editor 165

Checking Your vim Editor Program 166

Using the vim Editor 167

The nano Editor 170

Working with Data Files 172

Sorting 172

Searching 175

Compressing 181

Archiving 182

The Bottom Line 187

Part 2 Intermediate Admin Functions 189

Chapter 9 Managing Hardware 191

Device Driver Modules 191

Listing Installed Modules 192

Installing New Modules 193

Removing Modules 196

Communicating with Devices 196

Device Interfaces 196

The /dev Directory 198

The /proc Directory 199

The /sys Directory 202

Working with Devices 203

Finding Devices 203

Working with PCI Cards 205

Working with USB Devices 206

Using Hot Pluggable Devices 207

Detecting Dynamic Devices 208

Working with Dynamic Devices 208

The Bottom Line 209

Chapter 10 Booting Linux 211

Understanding the Boot Process 211

Overview of the Boot Process 211

Watching the Boot Process 212

The Firmware Startup 212

The GRUB2 Bootloader 214

Configuring the GRUB2 Bootloader 215

Exploring the GRUB2 Configuration 215

Interacting with GRUB2 217

The systemd Initialization Process 219

Exploring Unit Files 220

Focusing on Service Unit Files 221

Focusing on Target Unit Files 225

Changing a Unit Configuration File 226

Changing the systemd Configuration File 227

Looking at systemctl 227

Jumping Targets 230

Analyzing with systemd 232

The Bottom Line 234

Chapter 11 Working with Storage Devices 235

Storage Basics 235

Drive Connections 235

Partitioning Drives 236

Automatic Drive Detection 236

Partitioning Tools 237

Working with fdisk 237

Working with gdisk 239

The GNU parted Command 241

Formatting Filesystems 243

Common Filesystem Types 243

Creating Filesystems 245

Mounting Filesystems 246

Manually Mounting Devices 246

Automatically Mounting Devices 247

Managing Filesystems 249

Retrieving Filesystem Stats 249

Filesystem Tools 250

Storage Alternatives 251

Multipath 251

Logical Volume Manager 251

Using RAID Technology 253

The Bottom Line 254

Chapter 12 Configuring Network Settings 255

Network Settings 255

Ubuntu Servers 256

Red Hat Servers 258

Using Network Command-Line Tools 260

NetworkManager Tools 260

Other Tools 262

Basic Network Troubleshooting 269

Sending Test Packets 269

Finding Host Information 271

Advanced Network Troubleshooting 273

The netstat Command 273

Examining Sockets 276

The Bottom Line 277

Chapter 13 Managing Users and Groups 279

Understanding Linux Permissions 279

Understanding Ownership 280

Controlling Access Permissions 282

Exploring Special Permissions 284

Managing Default Permissions 285

Using Access Control Lists 288

Managing User Accounts 290

Adding Accounts 290

Maintaining Accounts 298

Removing Accounts 301

Maintaining the Environment 302

Setting Environment Variables 302

Exploring User Entries 302

Exploring Global Entries 303

Managing Groups 304

Adding Groups 305

Removing Groups 306

The Bottom Line 307

Chapter 14 Working with Processes and Jobs 309

Looking at Processes 309

Monitoring Processes in Real Time 311

Managing Processes 314

Setting Priorities 314

Stopping Processes 315

Running Programs in Background Mode 317

Running in the Background 317

Running Multiple Background Jobs 318

Running Programs Without a Console 319

Job Control 320

Viewing Jobs 320

Restarting Stopped Jobs 322

Scheduling Jobs 323

Scheduling a Job Using the at Command 323

Scheduling Recurring Programs 326

The Bottom Line 328

Chapter 15 Managing Log Files 329

The systemd Journaling System 329

Configuring systemd-journald 330

Looking at Journal Files 331

Making the Journal Persistent 332

Viewing Journal Entries 332

Maintaining the Journal 335

Viewing Different Journal Files 337

Protecting Journal Files 337

Making Journal Entries 337

The rsyslog Legacy System 338

The syslog Protocol 338

Basic Logging Using rsyslogd 340

Layering Your Logging 342

Making Log Entries 343

Finding Event Messages 344

The Bottom Line 344

Chapter 16 Managing Printers 347

The Common Unix Printing System 347

Printer Drivers 347

Web Interface 348

Command-Line Commands 348

Printer Sharing 349

Printer Classes 350

Installing and Configuring CUPS 350

Installing CUPS 351

Preparing the Server to Use CUPS 354

Using CUPS 356

Administration Functions 356

Managing Printers and Jobs in CUPS 360

The Bottom Line 361

Part 3 Advanced Admin Functions 363

Chapter 17 Exploring Ubuntu Security 365

Locking Down Root 365

Looking at Linux Account Types 366

Gaining Super User Privileges 367

Using OpenSSH on Ubuntu 369

Exploring Basic SSH Concepts 370

Configuring SSH 372

Generating SSH Keys 373

Authenticating with SSH Keys 374

The AppArmor System 376

Network Security Using Firewalls 380

Understanding UFW 380

Configuring UFW 381

The Bottom Line 385

Chapter 18 Exploring Red Hat Security 387

Working with Root Access 387

Keeping Track of Root Logins 388

Disabling Root Access from SSH 388

Enabling Automatic Logout 389

Blocking Root Access 390

Using SELinux 391

Enabling SELinux 391

Understanding Security Context 392

Using Policies 393

Network Security Using Firewalls 395

Red Hat Firewall Concepts 395

Checking the Firewall Status 397

Working with Zones 398

Working with Firewall Rules 399

The Bottom Line 401

Chapter 19 Writing Scripts 403

Beginning a Shell Script 403

Creating a Script File 403

Displaying Messages 405

Using Variables 407

Environment Variables 407

User Variables 408

Command Substitution 409

Exiting the Script with Status 410

Passing Parameters 411

Adding Conditional Expressions 414

Working with the if-then Statement 414

Using Compound Tests 417

Working with the if-then-else Statement 418

Trying the case Statement 419

Using Loops 420

Looking at the for Command 420

Working with the while Format 423

Using the until Command 424

Using Functions 427

Creating Functions 427

Calling Functions 427

The Bottom Line 430

Chapter 20 Managing Web Servers 433

Linux Web Servers 433

Apache 433

nginx 434

The Apache Web Server 435

Installing an Apache Server 435

Configuring the Apache Server 437

Hosting Dynamic Web Applications 445

Creating a Secure Web Server 447

The nginx Server 448

Installing nginx 448

Configuring nginx 449

The Bottom Line 451

Chapter 21 Managing Database Servers 453

Linux Database Servers 453

Organizing the Data 454

Querying the Data 455

Controlling the Data 456

Installing and Using MySQL/MariaDB 457

Conducting a MariaDB Installation 458

Accessing a MariaDB Database 462

Populating and Using MariaDB Database 466

Installing and Using PostgreSQL 471

Conducting a PostgreSQL Installation 471

Accessing a PostgreSQL Database 474

Populating and Using a PostgreSQL Database 477

The Bottom Line 478

Chapter 22 Exploring the Virtualization Environment 481

Hypervisors 481

Managing VMs 481

Creating a Virtual Machine 483

Integrating via Linux Extensions 485

Containers 486

Exploring Container Types 487

Looking at Container Software 487

Organizing Containers 489

Software Packaging 491

Looking at Ubuntu Snap 491

Looking at Flatpak 499

The Bottom Line 503

Appendix The Bottom Line 505

Chapter 1: Understanding the Basics 505

Chapter 2: Installing an Ubuntu Server 506

Chapter 3: Installing and Maintaining Software in Ubuntu 507

Chapter 4: Installing a Red Hat Server 509

Chapter 5: Installing and Maintaining Software in Red Hat 510

Chapter 6: Working with the Shell 512

Chapter 7: Exploring Linux File Management 513

Chapter 8: Working with Text Files 515

Chapter 9: Managing Hardware 516

Chapter 10: Booting Linux 517

Chapter 11: Working with Storage Devices 519

Chapter 12: Configuring Network Settings 520

Chapter 13: Managing Users and Groups 521

Chapter 14: Working with Processes and Jobs 523

Chapter 15: Managing Log Files 524

Chapter 16: Managing Printers 526

Chapter 17: Exploring Ubuntu Security 527

Chapter 18: Exploring Red Hat Security 528

Chapter 19: Writing Scripts 529

Chapter 20: Managing Web Servers 532

Chapter 21: Managing Database Servers 533

Chapter 22: Exploring the Virtualization Environment 535

Index 537

Authors

Christine Bresnahan Richard Blum