Linux in Action
David Clinton
  • August 2018
  • ISBN 9781617294938
  • 384 pages
  • printed in black & white

An essential guide to understanding Linux—with plenty of real-world examples.

Dario Victor Durán, HiQ Stockholm

Linux in Action is a task-based tutorial that will give you the skills and deep understanding you need to administer a Linux-based system. This hands-on book guides you through 12 real-world projects so you can practice as you learn. Each chapter ends with a review of best practices, new terms, and exercises.

Table of Contents detailed table of contents

1: Welcome to Linux

1.1 What makes Linux different from other operating systems

1.2 Basic survival skills

1.2.1 The Linux file system

1.2.2 Getting around: Linux navigation tools

1.2.3 Getting things done: Linux file management tools

1.2.4 Keyboard tricks

1.2.5 Pseudo file systems

1.2.6 Showing ’em who’s boss: sudo

1.3 Getting help

1.3.1 Man files

1.3.2 Info

1.3.3 The internet

2: Linux virtualization: Building a Linux working environment

2.1 What is virtualization?

2.2 Working with VirtualBox

2.2.1 Working with Linux package managers

2.2.2 Defining a virtual machine (VM)

2.2.3 Installing an operating system (OS)

2.2.4 Cloning and sharing a VirtualBox VM

2.3 Working with Linux containers (LXC)

2.3.1 Getting started with LXC

2.3.2 Creating your first container

3: Remote connectivity: Safely accessing networked machines

3.1 The importance of encryption

3.2 Getting started with OpenSSH

3.3 Logging in to a remote server with SSH

3.4 Password-free SSH access

3.4.1 Generating a new key pair

3.4.2 Copying the public key over a network

3.4.3 Working with multiple encryption keys

3.5 Safely copying files with SCP

3.6 Using remote graphic programs over SSH connections

3.7 Linux process management

3.7.1 Viewing processes with the ps command

3.7.2 Working with systemd

4: Archive management: Backing up or copying entire file systems

4.1 Why archive?

4.1.1 Compression

4.1.2 Archives: Some important considerations

4.2 What to archive

4.3 Where to back up

4.4 Archiving files and file systems using tar

4.4.1 Simple archive and compression examples

4.4.2 Streaming file system archives

4.4.3 Aggregating files with find

4.4.4 Preserving permissions and ownership…​and extracting archives

4.5 Archiving partitions with dd

4.5.1 dd operations

4.5.2 Wiping disks with dd

4.6 Synchronizing archives with rsync

4.7 Planning considerations

Answer key

5: Automated administration: Configuring automated offsite backups

5.1 Scripting with Bash

5.1.1 A sample script for backing up system files

5.1.2 A sample script for changing filenames

5.2 Backing up data to AWS S3

5.2.1 Installing the AWS command-line interface (CLI)

5.2.2 Configuring your AWS account

5.2.3 Creating your first bucket

5.3 Scheduling regular backups with cron

5.4 Scheduling irregular backups with anacron

5.4.1 Running the S3 sync job

5.5 Scheduling regular backups with systemd timers

Answer key

6: Emergency tools: Building a system recovery device

6.1 Working in recovery/rescue mode

6.1.1 The GRUB bootloader

6.1.2 Using recovery mode on Ubuntu

6.1.3 Using rescue mode on CentOS

6.1.4 Finding command-line rescue tools

6.2 Building a live-boot recovery drive

6.2.1 System rescue images

6.2.2 Writing live-boot images to USB drives

6.3 Putting your live-boot drive to work

6.3.1 Testing system memory

6.3.2 Damaged partitions

6.3.3 Recovering files from a damaged file system

6.4 Password recovery: Mounting a file system using chroot

Answer key

7: Web servers: Building a MediaWiki server

7.1 Building a LAMP server

7.2 Manually setting up an Apache web server

7.2.1 Installing the Apache web server on Ubuntu

7.2.2 Populating your website document root

7.3 Installing an SQL database

7.3.1 Hardening SQL

7.3.2 SQL administration

7.4 Installing PHP

7.4.1 Installing PHP on Ubuntu

7.4.2 Testing your PHP installation

7.5 Installing and configuring MediaWiki

7.5.1 Troubleshooting missing extensions

7.5.2 Connecting MediaWiki to the database

7.6 Installing the Apache web server on CentOS

7.6.1 Understanding network ports

7.6.2 Controlling network traffic

7.6.3 Installing MariaDB on CentOS

7.6.4 Installing PHP on CentOS

Answer key

8: Networked file sharing: Building a Nextcloud file-sharing server

8.1 Enterprise file sharing and Nextcloud

8.2 Installing Nextcloud using snaps

8.3 Installing Nextcloud manually

8.3.1 Hardware prerequisites

8.3.2 Building a LAMP server

8.3.3 Configuring Apache

8.3.4 Downloading and unpacking Nextcloud

8.4 Nextcloud administration

8.5 Using AWS S3 as the primary Nextcloud storage

9: Securing your web server

9.1 The obvious stuff

9.2 Controlling network access

9.2.1 Configuring a firewall

9.2.2 Using nonstandard ports

9.3 Encrypting data in transit

9.3.1 Preparing your website domain

9.3.2 Generating certificates using Let’s Encrypt

9.4 Hardening the authentication process

9.4.1 Controlling file system objects with SELinux

9.4.2 Installing and activating SELinux

9.4.3 Applying SELinux policies

9.4.4 System groups and the principle of least privilege

9.4.5 Isolating processes within containers

9.4.6 Scanning for dangerous user ID values

9.5 Auditing system resources

9.5.1 Scanning for open ports

9.5.2 Scanning for active services

9.5.3 Searching for installed software

Answer key

10: Securing network connections: Creating a VPN or DMZ

10.1 Building an OpenVPN tunnel

10.1.1 Configuring an OpenVPN server

10.1.2 Configuring an OpenVPN client

10.1.3 Testing your VPN

10.2 Building intrusion-resistant networks

10.2.1 Demilitarized zones (DMZs)

10.2.2 Using iptables

10.2.3 Creating a DMZ using iptables

10.2.4 Creating a DMZ using Shorewall

10.3 Building a virtual network for infrastructure testing

Answer key

11: System monitoring: Working with log files

11.1 Working with system logs

11.1.1 Logging with journald

11.1.2 Logging with syslogd

11.2 Managing log files

11.2.1 The journald way

11.2.2 The syslogd way

11.3 Consuming large files

11.3.1 Using grep

11.3.2 Using awk

11.3.3 Using sed

11.4 Monitoring with intrusion detection

11.4.1 Setting up a mail server

11.4.2 Installing Tripwire

11.4.3 Configuring Tripwire

11.4.4 Generating a test Tripwire report

Answer key

12: Sharing data over a private network

12.1 Sharing files through Network File System (NFS)

12.1.1 Setting up the NFS server

12.1.2 Setting up the client

12.1.3 Mounting an NFS share at boot time

12.1.4 NFS security

12.2 Sharing files with Windows users using Samba

12.2.1 Testing your Samba configuration

12.2.2 Accessing a Samba server from Windows

Answer key

13: Troubleshooting system performance issues

13.1 CPU load problems

13.1.1 Measuring CPU load

13.1.2 Managing CPU load

13.1.3 Making trouble (simulating CPU load)

13.2 Memory problems

13.2.1 Assessing memory status

13.2.2 Assessing swap status

13.3 Storage availability problems

13.3.1 Inode limits

13.3.2 The solution

13.4 Network load problems

13.4.1 Measuring bandwidth

13.4.2 Solutions

13.4.3 Shaping network traffic with tc

13.5 Monitoring tools

13.5.1 Aggregating monitoring data

13.5.2 Visualizing your data

Answer key

14: Troubleshooting network issues

14.1 Understanding TCP/IP addressing

14.1.1 What’s NAT addressing?

14.1.2 Working with NAT addressing

14.2 Establishing network connectivity

14.3 Troubleshooting outbound connectivity

14.3.1 Tracking down the status of your network

14.3.2 Assigning IP addresses

14.3.3 Configuring DNS service

14.3.4 Plumbing

14.4 Troubleshooting inbound connectivity

14.4.1 Internal connection scanning: netstat

14.4.2 External connection scanning: netcat

Answer key

15: Troubleshooting peripheral devices

15.1 Identifying attached devices

15.2 Managing peripherals with Linux kernel modules

15.2.1 Finding kernel modules

15.2.2 Manually loading kernel modules

15.3 Manually managing kernel parameters at boot time

15.3.1 Passing parameters at boot time

15.3.2 Passing parameters via the file system

15.4 Managing printers

15.4.1 Basics of lp

15.4.2 Managing printers using CUPS

Answer key

16: DevOps tools: Deploying a scripted server environment using Ansible

16.1 What deployment orchestrators can do for you

16.2 Ansible: Installation and setup

16.2.1 Setting up passwordless access to hosts

16.2.2 Organizing Ansible hosts

16.2.3 Testing connectivity

16.3 Authentication

16.4 Ansible playbooks

16.4.1 Writing a simple playbook

16.4.2 Creating multi-tiered, role-powered playbooks

16.4.3 Managing passwords in Ansible

Answer key

Conclusion

What you’ve learned

Virtualization

Connectivity

Encryption

Networking

Image management

System monitoring

What’s next

Resources

Appendixes

Appendix A: chapter-by-chapter, command-line review

1 Welcome to Linux

2 Linux virtualization: Building a Linux working environment

3 Remote connectivity: Safely accessing networked machines

4 Archive management: Backing up or copying entire file systems

5 Automated administration: Configuring automated offsite backups

6 Emergency tools: Building a system recovery device

7 Web servers: Building a MediaWiki server

8 Networked file sharing: Building a Nextcloud file-sharing server

9 Securing your web server

10 Securing network connections: Creating a VPN or DMZ

11 System monitoring: Working with log files

12 Sharing data over a private network

13 Troubleshooting system performance issues

14 Troubleshooting network issues

15 Troubleshooting peripheral devices

16 DevOps tools: Deploying a scripted server environment using Ansible

About the Technology

You can’t learn anything without getting your hands dirty—including Linux. Skills like securing files, folders, and servers, safely installing patches and applications, and managing a network are required for any serious user, including developers, administrators, and DevOps professionals. With this hands-on tutorial, you’ll roll up your sleeves and learn Linux project by project.

About the book

Linux in Action guides you through 12 real-world projects, including automating a backup-and-restore system, setting up a private Dropbox-style file cloud, and building your own MediaWiki server. You’ll try out interesting examples as you lock in core practices like virtualization, disaster recovery, security, backup, DevOps, and system troubleshooting. Each chapter ends with a review of best practices, new terms, and exercises.

What's inside

  • Setting up a safe Linux environment
  • Managing secure remote connectivity
  • Building a system recovery device
  • Patching and upgrading your system

About the reader

No prior Linux admin experience is required.

About the author

David Clinton is a certified Linux Server Professional, seasoned instructor, and author of Manning’s bestselling Learn Amazon Web Services in a Month of Lunches.


placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks

Teaches a wide variety of Linux features that will make your life that much easier. Practical.

Jens Christian B. Madsen, IT Relation

The go-to book for Linux system administration.

Gustavo Patino, Oakland University William Beaumont School of Medicine

Everything you need to start maintaining Linux. It’s not about how to use Linux, but how to take care of it.

Maciej Jurkowski, Grupa Pracuj