Linux Server Cookbook (Gonzalez, Alberto) (z-library.sk, 1lib.sk, z-lib.sk)
Linux
No Description
9
Views
0
Downloads
0.00
Total Donations
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
(This page has no text content)
Page
2
(This page has no text content)
Page
3
Linux Server Cookbook Get Hands-on Recipes to Install, Configure, and Administer a Linux Server Effectively Alberto Gonzalez www.bpbonline.com
Page
4
Copyright © 2023 BPB Online All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor BPB Online or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. BPB Online has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, BPB Online cannot guarantee the accuracy of this information. First published: 2023 Published by BPB Online WeWork 119 Marylebone Road London NW1 5PU UK | UAE | INDIA | SINGAPORE ISBN 978-93-5551-360-1 www.bpbonline.com
Page
5
Dedicated to To the best person I have met in my life: Elizabeth Wangari.
Page
6
About the Author Alberto Gonzalez is a Principal Architect at Red Hat with more than 20 years’ experience in the IT sector, with his main focus being Cloud and Infrastructure, and mainly open-source software. He is currently teaching and creating content on Hybrid Cloud technologies. Alberto has previously written two books in Spanish, one about Ansible and another about Docker.
Page
7
About the Reviewer Harshal Lakare is a Linux administrator with over 11 years of experience in the field. He has a strong background in system administration and has expertise in a variety of Linux distributions. Harshal is skilled in troubleshooting, problem-solving, and has a keen eye for detail. He is also a team player and enjoys collaborating with others to achieve common goals. In his spare time, Harshal enjoys reading and keeping up with the latest trends in the field. Overall, Harshal is a talented and dedicated Linux administrator who is committed to delivering high-quality work and helping his team succeed.
Page
8
Acknowledgements My gratitude goes to the team at BPB Publication for helping me during the writing process. Not being native in English is a challenge, but they helped during the whole process to create a book that I am proud to have written. They were supportive during the whole process, understanding the changes proposed and new topics added during the writing process. I want to say thanks to my family and friends; they understood that writing a book requires to dedicate multiple hours which I should have dedicated to them. This book is the result of that effort.
Page
9
Preface This book covers how to administer a Linux server from basic tasks to advanced ones., starting with the installation of popular Linux distributions, going through administration users and software, to the installation and administration of advanced services such as databases and file sharing. This book will guide you through new technologies related to automation, containers and DevOps philosophy. Public and Private Clouds are covered, as well as why Hybrid Cloud is an important concept for enterprises. Chapter 1 is the introduction to Linux. This chapter explains the history of the Operating System, the usage of Linux in most of the devices available and the IT sectors where Linux is the main operating system. This chapter also covers the latest features available and discusses the promising future of Linux. Chapter 2 covers the Linux installation. It describes the different support levels available for the popular distributions. It also details the installation methods available and guides step-by-step how to install the popular Linux distributions available. Chapter 3 introduces the Command Line Interface, a main component when a user is operating or administrating a Linux system. This chapter covers basic commands and concepts related to the input and output of the commands. Commands to identify the resources of the system are detailed with different examples. Chapter 4 shows how to manage users and software on Linux. It describes how users and groups work on Linux. With multiple examples, this chapter describes how to install software on systems such as Ubuntu Server or Red Hat Enterprise Linux. Chapter 5 covers how to manage files, directories and processes. It describes the directory structure on Linux, the permissions and how to access to the files. This chapter also covers the special characters and the regular expressions, as well as the important concepts working on the
Page
10
terminal. Popular editors and file managers are also described. The last part of the chapter focuses on the process management and the priorities. Chapter 6 explains how to monitor the resources in the system. Commands to query the usage of CPU, Memory, Disk and Network are described with several examples. This chapter covers quotas and limits to limit the usage of the resources available. Chapter 7 covers the basics of the networking in general and explains how to configure the networking on Linux system. It also discusses commands to manage the IP addresses, and the routes are shown with different examples. In addition, advanced network configuration, such as bonding, bridges and virtual switches are also covered. Chapter 8 focuses on the security part on a Linux system. It discusses the different firewall solution available and how to ensure that the services are correctly protected against unwanted access. Different tools are described to monitor the traffic and the changes in the system. Chapter 9 details the popular network services available on Linux and the software associated to offer the services. Services such as DHCP, DNS and SSH are detailed with examples and the commands associated. Chapter 10 is about File Sharing solutions available on Linux. It describes NFS, SMB and FTP protocols and the software to provide the services and the client tools. Chapter 11 covers the popular databases available on Linux system. This chapter describes the difference between relational databases and NoSQL databases. Different solutions such as MySQL and MariaDB are detailed for the relational databases and MongoDB is described for the NoSQL database. Chapter 12 details about what is Automation and the importance in these days. This chapter explains how to perform automation with shell scripting and developing, with a programming language such as Python. The popular tool Ansible is detailed to perform simple and advanced automation tasks. Chapter 13 details the containers and the modernization of applications. Software to run containers, such as Docker and podman are also explained with several examples of usage. A basic introduction to Kubernetes is
Page
11
explained. New practices such as Continuous Integration and Continuous Delivery (CI/CD) are explained and the software available for these practices are described with different examples. Chapter 14 explains about the Backup and Restore and the importance in the enterprise level. Different open-source solutions are described. Installation, usage and examples of open-source software solutions called Bacula and Relax and Recover (ReaR) are covered. Chapter 15 covers a new concept: Multi Cloud Management. This chapter describes the popular public cloud available, such as AWS, GCP and Azure, as well as the services offered. The concept Infrastructure as code and the software Terraform for managing multiple clouds is also detailed with multiple examples. Chapter 16 is about Infrastructure as a Service. It details the components of a Private cloud and how a Hybrid Cloud operates. The popular IaaS solution called OpenStack is explained with detail and with several examples.
Page
12
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/372e55 The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Linux-Server-Cookbook. In case there's an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family. Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.bpbonline.com and as a print book
Page
13
customer, you are entitled to a discount on the eBook copy. Get in touch with us at: business@bpbonline.com for more details. At www.bpbonline.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on BPB books and eBooks.
Page
14
Piracy If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at business@bpbonline.com with a link to the material. If you are interested in becoming an author If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Reviews Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com.
Page
15
Table of Contents 1. Introduction to Linux Introduction Structure The magnitude of Linux Linux on key sectors of the IT industry Software Devices and infrastructures Information technology and business services Emerging technologies Telecommunications services Latest features in Linux Linux versus other operating systems Promising future of Linux Conclusion Key facts Questions Answers 2. Linux Installation Introduction Structure Linux support types Red hat enterprise Linux long-term support Ubuntu server long-term support SUSE Linux enterprise server long-term support Oracle Linux long-term support Installation methods Common installation steps Advanced installation steps Debian GNU/Linux Installation menu
Page
16
Select a language Select the location Configure the keyboard Configure the network Set up users and passwords Configure the clock Partition disks Install the base system and install software Install the GRUB boot loader Ubuntu server Installation menu Select installation language Keyboard configuration The base for the installation Network connections Configure the Ubuntu archive mirror Guided storage configuration Profile setup SSH setup Featured server snaps Red Hat Enterprise Linux Installation menu Select a language Installation summary Connect to Red Hat Installation destination Software selection Root password User creation Installation progress CentOS and CentOS stream Rocky Linux and Alma Linux SUSE Linux enterprise server and openSUSE Other popular distributions Conclusion Key facts
Page
17
Questions Answers 3. Using the Command Line Interface Introduction Structure Linux console and the prompt Use of basic first CLI commands Command pwd Command whoami Command hostname Command man Command cd Command history Command uptime CLI commands to identify resources Command lscpu Command lshw Command free Command df Commands lspci, lsusb, and lsblk CLI commands to list elements Command ls Command find Explanation of standard streams CLI commands for data stream Command echo Command read Command tee Conclusion Key facts Questions Answers 4. User Administration and Software Management
Page
18
Introduction Structure Introduction to users and groups Best practices for user accounts Commands to administrate users Command id Commands useradd and adduser Command usermod Command lslogins Commands who and w Command userdel Command passwd Command chage Command last Commands to manipulate groups Command groupadd Command groups Command groupmod Command groupdel Command gpasswd Command newgrp Introduction to RPM and DEB package formats Commands to operate with RPM packages Command rpm Commands yum and dnf Commands to operate with DEB packages Command dpkg Command apt-get, apt-cache, and apt-file Introduction to services Conclusion Key facts Questions Answers 5. Managing Files, Directories, and Processes
Page
19
Introduction Structure Linux directory structure Directories storing applications Directories storing user files Directories storing configurations Directories storing libraries Directories storing variable data Directories storing data for users Directories storing system data information and boot files Permissions Access to files and understanding files on Linux Commands chown and chgrp Command chmod Command cat Commands head and tail Special characters Regular expressions Commands grep Commands awk Formatting the output File editors and file managers Processes management Operate with processes priorities Conclusion Key facts Questions Answers 6. Monitoring System Resources Introduction Structure Monitoring CPU resources Obtaining CPU(s) information Understanding the system load and load average
Page
20
Command uptime and file /etc/loadavg Command top Commands atop and htop Command mpstat Command sar Command iostat Monitoring memory resources Command vmstat Commands top, htop, and atop Command sar Memory usage for each process Out of memory management Monitoring disk usage and available space Command iostat Command iotop Command atop Command smartctl Commands fio and hdparm Commands df and LVM commands Monitoring network resources Command ethtool Command nmon Commands traceroute, tracepath, and mtr Quotas and limits Quotas Limits Conclusion Key facts Questions Answers 7. Network Configuration Introduction Structure Network introduction
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
# Linux Server Cookbook — Reading Guide
## 【One-Line Pitch】
A practical, hands-on reference for Linux administrators who want to master server management from installation through advanced networking, security, and DevOps practices — ideal for sysadmins preparing for certification or managing real-world Linux deployments.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces the DevOps landscape and why Linux dominates enterprise servers, then walks through Debian installation step-by-step — from boot menu and language selection through GRUB boot loader setup.
- **Early (~10%–23%)**: Covers command-line fundamentals — user/group administration, hardware inspection (lscpu, lshw, free), data streams (echo, read, tee), and package management with both DEB (dpkg/apt) and RPM (rpm/dnf) ecosystems.
- **Early (~23%–32%)**: Explains file permissions in depth — umask defaults, special permissions (setuid/setgid/sticky bit), shell special characters, and transitions into system resource monitoring with CPU, memory, and disk tools.
- **Middle (~32%–48%)**: Moves into monitoring and networking — interpreting /proc/meminfo, LVM commands (pvdisplay, lvdisplay), network configuration across Red Hat (NetworkManager) and Ubuntu (Netplan) systems, plus advanced topics like bonding, bridges, and VLANs.
- **Middle (~48%–60%)**: Covers security hardening — firewall management (Firewalld vs. ufw, nftables backend), AppArmor profiles, and network services including DHCP, DNS, and SSH with public/private key authentication.
- **Late (~60%–100%)**: Expands into file sharing (NFS, Samba, FTP, TFTP), CI/CD practices with container platforms (Docker, Kubernetes), backup solutions (Bacula, ReaR), and multi-cloud management with Terraform and OpenStack.
## 【Key Takeaways】
- **DevOps stages map to specific toolchains** (Early): CI/CD, configuration management (Ansible, Puppet), and monitoring (Prometheus, Grafana) form the modern Linux server workflow — understanding this ecosystem helps you position where each tool fits.
- **Hardware inspection commands reveal system capabilities** (Early): lscpu shows CPU topology, lshw lists all hardware with HTML/XML/JSON output options, and free displays memory with human-readable flags — essential first steps for capacity planning.
- **Package management differs fundamentally between DEB and RPM systems** (Early): dpkg operates on local .deb files with options like -L (list files) and -S (search), while rpm/dnf handle Red Hat packages — knowing both ecosystems is critical for multi-distribution environments.
- **File permissions extend beyond rwx with special bits** (Early): setuid (4) runs executables as the owner, setgid (2) affects group inheritance on directories, and sticky bit (1) restricts deletion — umask defaults (typically 002) determine new file permissions (664/775).
- **Resource monitoring requires understanding kernel interfaces** (Middle): /proc/meminfo provides raw memory data, CPU load averages span 1/5/15-minute intervals, and LVM commands (pvdisplay, lvdisplay) track logical volumes — these low-level tools predict issues before they cause downtime.
- **Network configuration is distribution-specific** (Middle): Red Hat derivatives use NetworkManager, Ubuntu relies on Netplan with YAML files, and advanced setups require bonding (LACP for high availability), bridges (for VMs), and VLANs — modern firewalls use nftables as the backend replacing iptables.
- **Security is layered across services and system** (Middle): Firewalld/ufw provide front-end management, AppArmor enforces application profiles (complain vs. enforce modes), and SSH can disable root login or require key-based authentication — defense-in-depth is the operating principle.
- **Backup and cloud management are enterprise essentials** (Late): Bacula and ReaR offer open-source backup/restore, while Terraform enables Infrastructure as Code across AWS, GCP, and Azure — multi-cloud and private cloud (OpenStack) strategies are covered for hybrid environments.
## 【Reading Tips】
- **Skim the installation chapter** (~0%–10%) if you already have Linux deployed — the Debian installer walkthrough is thorough but only relevant for fresh setups.
- **Deep-read the permission and monitoring sections** (~23%–32%) — umask calculations and /proc/meminfo interpretation are foundational skills that appear throughout the rest of the book.
- **Pay special attention to distribution differences** in networking (~39%–48%) — the Red Hat vs. Ubuntu configuration split (NetworkManager vs. Netplan) is a common source of confusion; bookmark the relevant sections for reference.
- **Use the chapter-end questions and answers** as self-assessment checkpoints — they test practical command knowledge (e.g., systemctl enable vs. start) that mirrors real admin tasks.
- **Treat the later chapters as reference material** (~60%+): CI/CD, backup, and cloud sections are better skimmed for tool awareness than memorized — return when you need to implement a specific solution.
## 【Coverage Limits】
This guide synthesizes the first ~48% of the book in detail (installation through network services and security). Later chapters on file sharing, CI/CD, backup, and cloud management are noted from the table of contents but not deeply excerpted in the source material.
##
Passage locations
Excerpt 1
e: After the verification stage, the release is ready to be deployed in a system with similar characteristics than production; this environment is called sta...
View in text
Excerpt 2
tions listed previously is illustrated as follows: Figure 4.1: Output examples using command id Commands useradd and adduser The command useradd is a command...
View in text
Excerpt 3
virtual address space and is isolated from other processes. Memory mapping, where the content of a file is linked to a virtual address of the process. Fair a...
View in text
Excerpt 4
ts app list and obtain information using app info. Figure 8.13 shows the example of usage: Figure 8.13: Listing applications and obtaining information on ufw...
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
Loading recommended books...
Failed to load, please try again later
Tip the Site
Scan the WeChat Pay or Alipay code to tip. No login required.
WeChat Pay
Alipay