ebook img

Mastering Linux Administration: A comprehensive guide to installing, configuring, and maintaining Linux systems in the modern data center PDF

772 Pages·2021·33.19 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Mastering Linux Administration: A comprehensive guide to installing, configuring, and maintaining Linux systems in the modern data center

Mastering Linux Administration A comprehensive guide to installing, configuring, and maintaining Linux systems in the modern data center Alexandru Calcatinge Julian Balog BIRMINGHAM—MUMBAI Mastering Linux Administration Copyright © 2021 Packt Publishing 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(s), nor Packt Publishing 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. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Group Product Manager: Wilson D'souza Associate Publishing Product Manager: Preet Ahuja Senior Editor: Rahul D'souza Content Development Editor: Nihar Kapadia Technical Editor: Nithik Cheruvakodan Copy Editor: Safis Editing Project Coordinator: Ajesh Devavaram Proofreader: Safis Editing Indexer: Tejal Soni Production Designer: Nilesh Mohite First published: June 2021 Production reference: 1190521 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78995-427-2 www.packt.com Contributors About the authors Alexandru Calcatinge is an open-minded architect with a background in computer science and mathematics, and is constantly eager to learn new things. He is a senior university lecturer with a PhD in urban planning and regional development. With 13 years of experience in architectural programming and development, Alex teaches students about smart cities, big data, and open source technologies. He has authored four books and numerous scientific articles on urban and regional planning, with an emphasis on open source technologies in urban and rural development. Alex started using Linux in 2009 and never looked back. He has also been a certified Linux trainer since 2017 and teaches Ubuntu Server administration to students in Bucharest, Romania. Alex loves the DevOps philosophy and the possibilities that cloud technologies bring to the future. He is a certified programming analyst, computer network administrator, trainer, and designer. For my wife, Rodica. You always stand by my side and offer me support, compassion, and guidance. For my sister and my parents. In memory of Bogdan Paul, who left too early to read the book. Julian Balog is a senior software engineer with more than 15 years of experience in the industry. His primary work currently focuses on application delivery controllers, containerized workflows, networking, and security. With a never-ending passion for Linux and open source technologies, Julian is always in pursuit of learning new things while solving problems and making things work through simple, efficient, and practical engineering. He lives with his wife, two children, and an Aussie-doodle in the greater Seattle area, Washington. For Adelina, Anouk, and Indio. You graciously endured my absence while I was working on the book. Remembering Eduard, who sparked my love for Linux. The authors would like to thank the wonderful editorial and production team at Packt for their professional leadership, dedication, and guidance throughout the writing of this book. We are indebted to Neil D'mello, Nihar Kapadia, Preet Ahuja, Hemangi Lotlikar, Rahul D'souza, Sulagna Mohanti, for many helpful suggestions and the comprehensive revision of the drafts. We are also grateful to Marcus Patman for his thorough reviews and critical comments. We could not hope for a better team and support. About the reviewer Marcus Patman is a senior systems engineer with over 20 years' experience as an IT professional. He has worked in many environments, ranging from small startups to large enterprises with thousands of production servers. During this time, he has worked with multiple platforms, including Linux, Windows, AWS, and Azure. He currently manages an enterprise Linux environment for a non-profit, providing automation and management of their on-premises and cloud systems. Thanks to all my colleagues past and present for allowing me to do what I do best. Love to my friends Mary and Jay for encouraging me pursue a career in technology. I couldn't have done it without you. Table of Contents Preface Section 1: Linux Basic Administration 1 Installing Linux Technical requirements 4 Installing Linux graphical The Linux operating system 4 user interfaces 28 Linux distributions 5 GNOME 28 KDE 30 Choosing the right Linux distribution 6 Setting up and using the Common Linux distributions 9 Linux workstation 34 Linux distributions – a practical guide 10 Installing Ubuntu Desktop 34 Default software packages 35 Installing Linux – the basics 13 Additional software packages 37 How to install Linux 13 Managing software packages with APT 40 Installing Ubuntu 17 Installing CentOS 20 Summary 43 Questions 44 The Windows Subsystem for Linux (WSL) 25 2 The Linux Filesystem Technical requirements 45 The command-line prompt 53 Introducing the Linux shell 46 Shell command types 53 Command structure 54 Bash shell features 47 Help from the manual 55 The shell connection 51 ii Table of Contents The Linux filesystem 55 Commands for file properties 71 Directory structure 56 Using text editors to create and edit files 85 Working with files and directories 57 Summary 88 Questions 89 Understanding file paths 58 Basic file operations 59 Further reading 90 Commands for file viewing 69 3 Linux Software Management Technical requirements 92 Application streams in CentOS 8 113 Linux software package types 92 Building a package from source 113 The DEB and RPM package types 92 The source code file 114 The snap and flatpak package types 95 Preparing the source code 117 Managing software packages 97 Setting up the environment 118 Managing DEB packages 97 Summary 121 Managing RPM packages 103 Questions 121 Using snap and flatpak packages 106 Further reading 122 4 Managing Users and Groups Technical requirements 124 Creating, modifying, and deleting groups 138 Managing users 124 Understanding sudo 125 Managing permissions 152 Creating, modifying, and deleting users 126 File and directory permissions 153 Managing groups 137 Summary 166 Questions 166 5 Working with Processes, Daemons, and Signals Technical requirements 168 Understanding process types 168 Introducing processes 168 The anatomy of a process 176 Table of Contents iii Working with processes 182 Exploring interprocess communication 198 The ps command 182 The pstree command 186 Shared storage 198 The top command 187 Shared memory 199 The kill and killall commands 190 Unnamed pipes 200 The pgrep and pkill commands 192 Named pipes 201 Message queues 203 Working with daemons 193 Sockets 204 Working with SysV daemons 194 Working with signals 206 Working with systemd daemons 195 Summary 210 Questions 211 Section 2: Advanced Linux Server Administration 6 Working with Disks and Filesystems Technical requirements 215 Understanding disks and partitions 224 Understanding devices in Linux 216 Linux abstraction layers 216 Common disk types used 224 Partitioning disks 225 Device files and naming conventions 218 Understanding filesystem Logical Volume Management types in Linux 220 in Linux 235 LVM snapshots 238 The Ext4 filesystem features 221 The XFS filesystem features 222 Summary 241 The btrfs filesystem features 222 7 Networking with Linux Technical requirements 244 TCP/IP protocols 251 Exploring basic networking 244 IP addresses 254 Sockets and ports 259 Computer networks 244 Linux network configuration 260 The OSI model 246 The TCP/IP model 250 iv Table of Contents Working with networking Remote access 285 services 268 Understanding network DHCP servers 268 security 293 DNS servers 270 VPNs 294 Authentication servers 275 Working with VPNs 294 File sharing 276 Setting up OpenVPN 295 Printer servers 278 File transfer 279 Summary 302 Mail servers 280 Questions 303 NTP servers 283 8 Configuring Linux Servers Technical requirements 306 Questions 306 GitHub 306 Further reading 306 9 Securing Linux Technical requirements 308 Introducing netfilter 345 Understanding Linux security 308 Working with iptables 346 Introducing nftables 352 Introducing SELinux 310 Using firewall managers 357 Working with SELinux 310 Summary 371 Introducing AppArmor 332 Questions 372 Working with AppArmor 332 Further reading 372 Final considerations 341 Working with firewalls 341 10 Disaster Recovery, Diagnostics, and Troubleshooting Technical requirements 374 Risk calculation 376 Planning for disaster recovery 374 Designing a disaster recovery plan 378 A very short introduction to risk management 374 Table of Contents v Backing up and restoring system issues 390 the system 379 Tools for troubleshooting Disk cloning solutions 380 network issues 402 Tools for troubleshooting Introducing common hardware issues 411 Linux diagnostic tools for troubleshooting 388 Summary 413 Exercises 414 Tools for troubleshooting boot issues 388 Tools for troubleshooting general Further reading 414 Section 3: Cloud Administration 11 Working with Containers and Virtual Machines Technical requirements 418 Understanding the underlying container technology 441 Introduction to virtualization on Linux 418 Understanding Docker 444 Efficiency in resource usage 418 Working with Docker 447 Introduction to hypervisor 420 Which Docker version to choose? 447 Understanding VMs 420 Installing Docker CE 447 Choosing the hypervisor 421 Using the Docker commands 451 Understanding Linux Managing Docker containers 453 containers 440 Deploying a containerized application with Docker 456 Containers versus VMs 440 Summary 458 Further reading 459 12 Cloud Computing Essentials Technical requirements 462 Knowing the key features of cloud computing 471 Introduction to cloud technologies 462 Short introduction to Understanding the need for cloud OpenStack 471 computing standards 463 Introducing IaaS solutions 475 Knowing the architecture of the cloud 466 Amazon EC2 475

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.