Build a solid foundation in DevOps and Linux systems as well as advanced DevOps practices such as configuration, IAC, and CI/CD
Key Features
Master Linux basics, the command line, and shell scripting
Become a DevOps expert by mastering Docker, Git, monitoring, automation, and CI/CD
Implement networking, manage services, and leverage Infrastructure as Code (IaC)
Purchase of the print or Kindle book includes a free PDF eBook
Book Description
The Linux DevOps Handbook is a comprehensive resource that caters to both novice and experienced professionals, ensuring a strong foundation in Linux. This book will help you understand how Linux serves as a cornerstone of DevOps, offering the flexibility, stability, and scalability essential for modern software development and operations.
You’ll begin by covering Linux distributions, intermediate Linux concepts, and shell scripting to get to grips with automating tasks and streamlining workflows. You’ll then progress to mastering essential day-to-day tools for DevOps tasks. As you learn networking in Linux, you’ll be equipped with connection establishment and troubleshooting skills. You’ll also learn how to use Git for collaboration and efficient code management.
The book guides you through Docker concepts for optimizing your DevOps workflows and moves on to advanced DevOps practices, such as monitoring, tracing, and distributed logging. You’ll work with Terraform and GitHub to implement continuous integration (CI)/continuous deployment (CD) pipelines and employ Atlantis for automated software delivery. Additionally, you’ll identify common DevOps pitfalls and strategies to avoid them.
By the end of this book, you’ll have built a solid foundation in Linux fundamentals, practical tools, and advanced practices, all contributing to your enhanced Linux skills and successful DevOps implementation.
What you will learn
Understand how to manage infrastructure using Infrastructure as Code (IaC) tools such as Terraform and Atlantis
Automate repetitive tasks using Ansible and Bash scripting
Set up logging and monitoring solutions to maintain and troubleshoot your infrastructure
Identify and understand how to avoid common DevOps pitfalls
Automate tasks and streamline workflows using Linux and shell scripting
Optimize DevOps workflows using Docker
Who this book is for
This book is for DevOps Engineers looking to extend their Linux and DevOps skills as well as System Administrators responsible for managing Linux servers, who want to adopt DevOps practices to streamline their operations.You’ll also find this book useful if you want to build your skills and knowledge to work with public cloud technologies, especially AWS, to build and manage scalable and reliable systems.
Author(s): Damian Wojsław, Grzegorz Adamowicz
Publisher: Packt
Year: 2023
Language: English
Pages: 428
Cover
Title Page
Copyrights and credits
Contributors
Table of Contents
Preface
Part 1: Linux Basics
Chapter 1: Choosing the Right Linux Distribution
Technical requirements
What exactly is a Linux distribution?
What makes distributions different?
Introducing the distributions
Debian
Ubuntu Linux
Red Hat Enterprise Linux (RHEL)
Fedora Linux
CentOS
Rocky Linux
Alpine
Summary
Chapter 2: Command-Line Basics
Technical requirements
The Linux command line – shell
Getting to know your shell
I call to thee
The filesystem structure
Running a program
The command to teach you all commands
Know your environment
Where in the PATH am I?
Know your rights
Interacting with the system
Process this
Looking for something?
Let’s be manipulative
Summary
Exercises
Resources
Chapter 3: Intermediate Linux
Technical requirements
Globs
Automating repetitive tasks
Cron jobs
Systemd timer
Software installation
Debian and Ubuntu
CentOS, RHEL, and Fedora
Alpine Linux
Managing users
Adding users
Modifying users
Removing users
Managing groups
Secure Shell (SSH) protocol
Configuring OpenSSH
Creating and managing SSH keys
Summary
Exercises
Chapter 4: Automating with Shell Scripts
Technical requirements
Backing up a database
Understanding scripting
Understanding Bash built-ins and grammar
Variables
Parameters
Loops
Conditional execution – if statement
Understanding the backup script – first steps
Handling errors and debugging
Summary
Exercises
Part 2: Your Day-to-Day DevOps Tools
Chapter 5: Managing Services in Linux
Technical requirements
Understanding Linux services in detail
The history of Linux service management
systemd
OpenRC
SysV init
A few words about Upstart, an alternative
Summary
Chapter 6: Networking in Linux
Networking in Linux
ISO/OSI as a networking standard
Physical layer
Data link layer – MAC, VLAN
Network layer – IPv4 and IPv6
Transport layer – TCP and UDP
Session layer
Presentation layer – SSL and TLS
Application layer – HTTP and FTP
Firewalls
iptables
nftables
ufw
firewalld
Advanced topics
NAT
Port forwarding
Interface bonding
TCP multipath
BGP
Summary
Chapter 7: Git, Your Doorway to DevOps
Technical requirements
Basic Git commands
Configuring the local Git environment
Setting up a local Git repository
Local versus remote Git repositories
Interacting with remote repositories
What’s the git diff command?
Viewing the commit history
Branching
Squashing commits using an interactive rebase
Solving Git conflicts
GitFlow and GitHub Flow
Global git configuration – .gitconfig
Ignoring some files using a .gitignore configuration file
Summary
Chapter 8: Docker Basics
Technical requirements
Virtualization versus containerization
Virtualization
Containerization
Anatomy of Docker
OverlayFS
What is an image?
What is a container runtime?
cgroups
Docker commands
docker build
docker run
docker start
docker stop
docker ps
docker login
docker pull
docker push
docker image
docker exec
docker logs
docker rm
docker rmi
docker network
docker volume
Dockerfile
FROM
COPY and ADD
EXPOSE
ENTRYPOINT and CMD
RUN
LABEL
ENV and ARG
VOLUME
USER
WORKDIR
Docker image registries
Docker networking
None network
Bridge mode
Host mode
Overlay
Summary
Chapter 9: A Deep Dive into Docker
Docker advanced use cases
Running public images
Running a debugging container
Cleaning up unused containers
Docker volumes and bind mounts
Docker networking advanced use cases
Security features of Docker
Docker for CI/CD pipeline integration
Docker Compose
Advanced Dockerfile techniques
Multi-stage build
ADD command use cases
Secrets management
Docker orchestration
Docker Swarm
Kubernetes and OpenShift
Summary
Part 3: DevOps Cloud Toolkit
Chapter 10: Monitoring, Tracing, and Distributed Logging
Differences between monitoring, tracing, and logging
Cloud solutions
CloudWatch Logs and metrics
AWS X-Ray
Open source solutions for self-hosting
Prometheus
Grafana
SigNoz
New Relic Pixie
Graylog
Sentry
SaaS solutions
Datadog
New Relic
Ruxit
Splunk
Log and metrics retention
Full retention
Time-based retention
Event-based retention
Selective retention
Tiered retention
Summary
Chapter 11: Using Ansible for Configuration as Code
Technical requirements
CM systems and CaC
SaltStack
Chef
Puppet
CFEngine
Ansible
Basics of using Ansible
Tasks
Roles
Plays and playbooks
Ansible Galaxy
Handling secrets
Ansible Vault
SOPS
Other solutions
Ansible Tower and alternatives
Advanced topics
Debugging
Linting Ansible playbooks
Speeding up SSH connections
Dynamic inventory
Summary
Further reading
Chapter 12: Leveraging Infrastructure as Code
Technical requirements
What is IaC?
IaC versus Configuration as Code
IaC projects worth knowing
AWS CloudFormation
AWS Cloud Development Kit
Terraform
Cloud Development Kit for Terraform
Pulumi
Terraform
Terraform modules
Terraform state
Terraform CLI
HCL in depth
Variables
Comments
Terraform meta-arguments
Terraform examples with AWS
EC2 instance module
Summary
Exercises
Chapter 13: CI/CD with Terraform, GitHub, and Atlantis
Technical requirements
What is CI/CD?
An example of CI/CD pipelines
Continuously integrating and deploying your infrastructure
Integration testing
Deployment
CI/CD with Atlantis
Deploying Atlantis to AWS
Running Terraform using Atlantis
Summary
Exercises
Chapter 14: Avoiding Pitfalls in DevOps
Technical requirements
Too much or not enough automation
Repetitive tasks
Time-consuming tasks
Manual and error-prone tasks
Tasks with version control integration
Tasks with repeatable patterns
Tasks with well-defined APIs or interfaces
Tasks with clear and well-defined requirements
Not understanding the technology
Stay curious and proactive
Start with the basics
Hands-on learning
Collaborate and share knowledge
Stay updated
Failure to adopt a collaborative culture
Lack of leadership
Siloed organizational structure
Lack of trust and communication
Tool-centric approach
Neglecting testing and QA
Increased software defects
Deployment failures
Security vulnerabilities
Lack of documentation
Inadequate test coverage
Lack of continuous improvement
Poor monitoring and feedback loops
Real-time
Comprehensive
Scalable
Actionable
Continuously improving
Inadequate security and compliance measures
What are security measures?
Characteristics of good security measures
Lack of scalability and flexibility
DevOps is only for small teams or projects
Inability to scale infrastructure
Flexibility compromises stability
Lack of flexibility in release management
Lack of proper documentation and knowledge sharing
Technical documentation
API documentation
User documentation
Process documentation
Operational documentation
Release notes and changelogs
Overcoming resistance to change
Summary
Index
Other Books You May Enjoy