Virtual, hands-on learning labs allow you to apply your technical skills using live hardware and software hosted in the cloud. So Sybex has bundled CompTIA Linux+ labs from Practice Labs, the IT Competency Hub, with our popular CompTIA Linux+ Study Guide, Fourth Edition. Working in these labs gives you the same experience you need to prepare for the CompTIA Linux+ Exam XK0-004 that you would face in a real-life setting. Used in addition to the book, the labs are a proven way to prepare for the certification and for work in the IT and cybersecurity fields where Linux is fundamental to modern systems and security.
This is your one-stop resource for complete coverage of Exam XK0-004, covering 100% of all exam objectives. You'll prepare for the exam smarter and faster with Sybex thanks to superior content including, assessment tests that check exam readiness, objective map, real-world scenarios, hands-on exercises, key topic exam essentials, and challenging chapter review questions.
Linux is viewed by many organizations and companies as an excellent, low-cost, secure alternative to expensive OSs, such as Microsoft Windows and is crucial to today's server and cloud infrastructure. The CompTIA Linux+ exam tests a candidate's understanding and familiarity with the Linux. As the Linux server market share continues to grow, so too does demand for qualified and certified Linux administrators.
Building on the popular Sybex Study Guide approach, this book will provide 100% coverage of the NEW Linux+ Exam XK0-004 objectives. The book contains clear and concise information on all Linux administration topic, and includes practical examples and insights drawn from real-world experience.
- Hardware and System Configuration
- Systems Operation and Maintenance
- Security
- Linux Troubleshooting and Diagnostics
- Automation and Scripting
You'll also have access to an online test bank, including a bonus practice exam, electronic flashcards, and a searchable PDF of key terms.
And with this edition you also get Practice Labs virtual labs that run from your browser. The registration code is included with the book and gives you 6 months unlimited access to Practice Labs CompTIA Linux+ Exam XK0-004 Labs with 65 unique lab modules to practice your skills.
Table of Contents
Introduction xxix
Assessment Test xlii
Part I Gathering Your Tools 1
Chapter 1 Preparing Your Environment 3
Setting Up a Learning Space 4
Using That Old Laptop 4
Creating a Virtualized Environment 5
Jumping to the Cloud 7
Exploring Linux Distributions 8
Looking at CentOS 9
Looking at Ubuntu 10
Looking at openSUSE 12
Looking at Fedora 13
Locating a Terminal 14
Summary 14
Chapter 2 Sifting Through Services 15
What is a Linux Server? 16
Launching Services 17
Listening for Clients 18
Serving the Basics 19
Web Servers 20
Database Servers 21
Mail Servers 22
Serving Local Networks 24
File Servers 25
Print Servers 26
Network Resource Servers 26
Implementing Security 29
Authentication Server 29
Certificate Authority 30
Access Server (SSH) 31
Virtual Private Networks 31
Proxy Server 32
Monitoring 32
Improving Performance 32
Clustering 32
Load Balancing 33
Containers 33
Summary 33
Exam Essentials 34
Review Questions 35
Chapter 3 Managing Files, Directories, and Text 39
Handling Files and Directories 40
Viewing and Creating Files 40
Copying and Moving Files 45
Removing Files 52
Linking Files and Directories 55
Establishing a Hard Link 55
Constructing a Soft Link 57
Reading Files 59
Reading Entire Text Files 59
Reading Text File Portions 61
Reading Text File Pages 65
Finding Information 66
Exploring File Differences 67
Using Simple Pinpoint Commands 69
Using Intricate Pinpoint Commands 73
Summary 77
Exam Essentials 77
Review Questions 78
Chapter 4 Searching and Analyzing Text 83
Processing Text Files 84
Filtering Text 84
Formatting Text 89
Determining Word Count 93
Redirecting Input and Output 95
Handling Standard Output 95
Redirecting Standard Error 96
Regulating Standard Input 98
Piping Commands 100
Creating Here Documents 102
Creating Command Lines 103
Editing Text Files 105
Appreciating Text Editors 105
Learning About Stream Editors 110
Summary 116
Exam Essentials 117
Review Questions 118
Part II Starting Up and Configuring Your System 123
Chapter 5 Explaining the Boot Process 125
The Linux Boot Process 126
Following the Boot Process 126
Viewing the Boot Process 127
The Firmware Startup 128
The BIOS Startup 128
The UEFI Startup 129
Linux Bootloaders 130
GRUB Legacy 131
GRUB2 134
Alternative Bootloaders 136
System Recovery 137
Kernel Failures 137
Root Drive Failure 139
Summary 141
Exam Essentials 141
Review Questions 143
Chapter 6 Maintaining System Startup and Services 147
Looking at init 148
Managing systemd Systems 149
Exploring Unit Files 150
Focusing on Service Unit Files 152
Focusing on Target Unit Files 157
Looking at systemctl 159
Examining Special systemd Commands 162
Managing SysV init Systems 167
Understanding Runlevels 168
Investigating SysV init Commands 171
Digging Deeper into systemd 176
Looking at systemd Mount Units 176
Exploring Automount Units 178
Summary 179
Exam Essentials 179
Review Questions 181
Chapter 7 Configuring Network Connections 187
Configuring Network Features 188
Network Configuration Files 188
Graphical Tools 191
Command-Line Tools 193
Basic Network Troubleshooting 201
Sending Test Packets 201
Finding Host Information 202
Advanced Network Troubleshooting 205
The netstat Command 205
Examining Sockets 208
Summary 209
Exam Essentials 210
Review Questions 212
Chapter 8 Comparing GUIs 217
Focusing on the GUI 218
Getting to Know GNOME 219
Probing KDE Plasma 221
Considering Cinnamon 223
Making Acquaintance with MATE 225
Understanding Unity 227
Setting Up Accessibility 228
Serving Up the GUI 231
Figuring Out Wayland 232
Examining X11 234
Using Remote Desktops 235
Viewing VNC 236
Grasping Xrdp 238
Exploring NX 239
Studying SPICE 240
Forwarding 240
Local 242
Remote 243
Tunneling Your X11 Connection 244
Summary 245
Exam Essentials 245
Review Questions 247
Chapter 9 Adjusting Localization Options 253
Understanding Localization 254
Character Sets 254
Environment Variables 255
Setting Your Locale 256
Installation Locale Decisions 256
Changing Your Locale 257
Looking at Time 259
Working with Time Zones 259
Setting the Time and Date 260
Watching System Time 264
Summary 265
Exam Essentials 266
Review Questions 267
Part III Managing Your System 273
Chapter 10 Administering Users and Groups 275
Managing User Accounts 276
Adding Accounts 276
Maintaining Passwords 288
Modifying Accounts 290
Deleting Accounts 292
Managing Groups 294
Setting Up the Environment 297
Perusing Bash Parameters 298
Understanding User Entries 299
Grasping Global Entries 300
Querying Users 300
Exploring the whoami Utility 300
Understanding the who Utility 301
Identifying with the id Program 302
Displaying Access History with the last Utility 303
Managing Disk Space Usage 304
Summary 308
Exam Essentials 308
Review Questions 310
Chapter 11 Handling Storage 315
Storage Basics 316
Drive Connections 316
Partitioning Drives 317
Automatic Drive Detection 317
Partitioning Tools 318
Working with fdisk 318
Working with gdisk 320
The GNU parted Command 322
Graphical Tools 322
Understanding Filesystems 323
The Virtual Directory 324
Maneuvering Around the Filesystem 326
Formatting Filesystems 326
Common Filesystem Types 326
Creating Filesystems 328
Mounting Filesystems 329
Manually Mounting Devices 329
Automatically Mounting Devices 330
Managing Filesystems 331
Retrieving Filesystem Stats 331
Filesystem Tools 332
Storage Alternatives 333
Multipath 333
Logical Volume Manager 334
Using RAID Technology 336
Summary 338
Exam Essentials 338
Review Questions 340
Chapter 12 Protecting Files 343
Understanding Backup Types 344
Looking at Compression Methods 346
Comparing Archive and Restore Utilities 349
Copying with cpio 349
Archiving with tar 352
Duplicating with dd 357
Replicating with rsync 359
Securing Offsite/Off-System Backups 362
Copying Securely via scp 362
Transferring Securely via sftp 363
Checking Backup Integrity 366
Digesting an MD5 Algorithm 366
Securing Hash Algorithms 367
Summary 368
Exam Essentials 368
Review Questions 370
Chapter 13 Governing Software 373
Working with Source Code 374
Downloading Source Code 374
Bundling Source Code Packages 375
Compiling Source Code 379
Packaging Applications 380
Installing and Managing Packages 381
Understanding Repositories 385
Summary 392
Exam Essentials 393
Review Questions 394
Chapter 14 Tending Kernel Modules 397
Exploring Kernel Modules 398
Installing Kernel Modules 402
Removing Kernel Modules 404
Summary 405
Exam Essentials 405
Review Questions 407
Part IV Securing Your System 409
Chapter 15 Applying Ownership and Permissions 411
Looking at File and Directory Permissions 412
Understanding Ownership 412
Controlling Access Permissions 414
Exploring Special Permissions 417
Managing Default Permissions 418
Access Control Lists 420
Context-Based Permissions 422
Using SELinux 423
Using AppArmor 427
Understanding Linux User Types 430
Types of User Accounts 430
Escalating Privileges 430
Restricting Users 431
Summary 435
Exam Essentials 436
Review Questions 437
Chapter 16 Looking at Access and Authentication Methods 439
Getting to Know PAM 440
Exploring PAM Configuration Files 440
Enforcing Strong Passwords 444
Locking Out Accounts 447
Limiting Root Access 451
Exploring PKI Concepts 452
Getting Certificates 453
Discovering Key Concepts 453
Securing Data 454
Signing Transmissions 455
Using SSH 455
Exploring Basic SSH Concepts 456
Configuring SSH 458
Generating SSH Keys 460
Authenticating with SSH Keys 462
Authenticating with the Authentication Agent 464
Using SSH Securely 466
Using VPN as a Client 468
Summary 469
Exam Essentials 469
Review Questions 471
Chapter 17 Implementing Logging Services 473
Understanding the Importance of Logging 474
The syslog Protocol 474
The History of Linux Logging 476
Basic Logging Using rsyslog 477
Configuration 477
Making Log Entries 479
Finding Event Messages 479
Journaling with systemd-journald 480
Configuration 480
Viewing Logs 481
Summary 483
Exam Essentials 484
Review Questions 485
Chapter 18 Overseeing Linux Firewalls 487
Providing Access Control 488
Looking at Firewall Technologies 490
Familiarizing Yourself with firewalld 491
Investigating iptables 495
Understanding UFW 500
Forwarding IP Packets 505
Dynamically Setting Rules 506
DenyHosts 506
Fail2ban 506
IPset 507
Summary 508
Exam Essentials 508
Review Questions 510
Chapter 19 Embracing Best Security Practices 513
User Security 514
Authentication Methods 514
Multifactor Authentication 516
Unique User Accounts 517
Restricting the root Account 517
System Security 518
Separation of Data 518
Disk Encryption 519
Restricting Applications 520
Preventing Unauthorized Rebooting 520
Restricting Unapproved Jobs 522
Banners and Messages 523
Restricting USB Devices 523
Looking for Trouble 524
Auditing 524
Network Security 525
Denying Hosts 525
Disabling Unused Services 525
Changing Default Ports 526
Using Encryption on the Network 526
Summary 528
Exam Essentials 528
Review Questions 530
Part V Troubleshooting Your System 533
Chapter 20 Analyzing System Properties and Remediation 535
Troubleshooting the Network 536
Exploring Network Issues 536
Viewing Network Performance 540
Reviewing the Network’s Configuration 546
Troubleshooting Storage Issues 549
Running Out of Filesystem Space 549
Waiting on Disk I/O 550
Failing Disks 553
Troubleshooting the CPU 554
Troubleshooting Memory 556
Swapping 556
Running Out of Memory 560
Surviving a Lost root Password 560
Summary 562
Exam Essentials 562
Review Questions 563
Chapter 21 Optimizing Performance 567
Looking at Processes 568
Monitoring Processes in Real Time 570
Managing Processes 573
Setting Priorities 574
Stopping Processes 574
Summary 577
Exam Essentials 577
Review Questions 579
Chapter 22 Investigating User Issues 581
Troubleshooting Access 582
Local 582
Remote 586
Authentication 587
Examining File Obstacles 588
File Permissions 588
Directory Permissions 589
File Creation 590
Exploring Environment and Shell Issues 591
Summary 593
Exam Essentials 593
Review Questions 594
Chapter 23 Dealing with Linux Devices 597
Communicating with Linux Devices 598
Device Interfaces 598
The /dev Directory 600
The /proc Directory 601
The /sys Directory 604
Working with Devices 605
Finding Devices 605
Working with PCI Cards 608
Working with USB Devices 609
Supporting Monitors 610
Using Printers 611
Using Hot Pluggable Devices 613
Detecting Dynamic Devices 613
Working with Dynamic Devices 614
Summary 615
Exam Essentials 616
Review Questions 617
Chapter 24 Troubleshooting Application and Hardware Issues 619
Dealing with Storage Problems 620
Exploring Common Issues 620
Dealing with Specialized Issues 622
Uncovering Application Permission Issues 626
Analyzing Application Dependencies 628
Versioning 629
Updating Issues 629
Patching 630
Dealing with Libraries 630
Exploring Environment Variable Issues 631
Gaining GCC Compatibility 631
Perusing Repository Problems 632
Looking at SELinux Context Violations 633
Exploring Firewall Blockages 633
Unrestricting ACLs 633
Unblocking Ports 634
Unblocking Protocols 635
Troubleshooting Additional Hardware Issues 635
Looking at Helpful Hardware Commands 635
Investigating Other Hardware Problems 639
Summary 643
Exam Essentials 643
Review Questions 645
Part VI Automating Your System 649
Chapter 25 Deploying Bash Scripts 651
The Basics of Shell Scripting 652
Running Multiple Commands 652
Redirecting Output 653
Piping Data 654
The Shell Script Format 655
Running the Shell Script 656
Advanced Shell Scripting 657
Displaying Messages 657
Using Variables 658
Command-Line Arguments 661
The Exit Status 662
Writing Script Programs 663
Command Substitution 663
Performing Math 664
Logic Statements 666
Loops 669
Summary 673
Exam Essentials 674
Review Questions 675
Chapter 26 Automating Jobs 677
Running Scripts in Background Mode 678
Running in the Background 678
Running Multiple Background Jobs 679
Running Scripts Without a Console 680
Sending Signals 681
Interrupting a Process 682
Pausing a Process 682
Job Control 683
Viewing Jobs 683
Restarting Stopped Jobs 686
Running Like Clockwork 687
Scheduling a Job Using the at Command 687
Scheduling Regular Scripts 690
Summary 692
Exam Essentials 693
Review Questions 694
Chapter 27 Controlling Versions with Git 697
Understanding Version Control 698
Setting Up Your Git Environment 700
Committing with Git 703
Merging Versions 710
Summary 713
Exam Essentials 713
Review Questions 715
Part VII Realizing Virtual and Cloud Environments 717
Chapter 28 Understanding Cloud and Virtualization Concepts 719
Considering Cloud Services 720
What is Cloud Computing? 720
What Are the Cloud Services? 721
Understanding Virtualization 723
Hypervisors 723
Types of Hypervisors 725
Hypervisor Templates 726
Exploring Containers 727
What Are Containers? 727
Container Software 728
Container Templates 729
Exercise 729
Summary 730
Exam Essentials 731
Review Questions 732
Chapter 29 Inspecting Cloud and Virtualization Services 735
Focusing on VM Tools 736
Looking at libvirt 736
Viewing virsh 737
Managing with Virtual Machine Manager 738
Understanding Bootstrapping 740
Booting with Shell Scripts 740
Kick-Starting with Anaconda 741
Initializing with Cloud-init 744
Exploring Storage Issues 746
Considering Network Configurations 747
Virtualizing the Network 747
Configuring Virtualized NICs 748
Summary 750
Exam Essentials 751
Review Questions 752
Chapter 30 Orchestrating the Environment 755
Understanding Orchestration Concepts 756
Probing Procedures 757
Analyzing Attributes 758
Provisioning the Data Center 760
Coding the Infrastructure 761
Automating the Infrastructure 762
Comparing Agent and Agentless 762
Investigating the Inventory 763
Looking at Container Orchestration Engines 763
Embracing Kubernetes 763
Inspecting Docker Swarm 764
Surveying Mesos 764
Summary 765
Exam Essentials 765
Review Questions 766
Appendix Answers to Review Questions 769
Chapter 2: Sifting Through Services 770
Chapter 3: Managing Files, Directories, and Text 773
Chapter 4: Searching and Analyzing Text 777
Chapter 5: Explaining the Boot Process 781
Chapter 6: Maintaining System Startup and Services 784
Chapter 7: Configuring Network Connections 788
Chapter 8: Comparing GUIs 791
Chapter 9: Adjusting Localization Options 795
Chapter 10: Administering Users and Groups 798
Chapter 11: Handling Storage 801
Chapter 12: Protecting Files 803
Chapter 13: Governing Software 804
Chapter 14: Tending Kernel Modules 806
Chapter 15: Applying Ownership and Permissions 808
Chapter 16: Looking at Access and Authentication Methods 810
Chapter 17: Implementing Logging Services 811
Chapter 18: Overseeing Linux Firewalls 813
Chapter 19: Embracing Best Security Practices 815
Chapter 20: Embracing Best Security Practices 817
Chapter 21: Optimizing Performance 818
Chapter 22: Investigating User Issues 820
Chapter 23: Dealing with Linux Devices 822
Chapter 24: Troubleshooting Application and Hardware Issues 824
Chapter 25: Deploying Bash Scripts 826
Chapter 26: Automating Jobs 827
Chapter 27: Controlling Versions with Git 829
Chapter 28: Understanding Cloud and Virtualization Concepts 831
Chapter 29: Inspecting Cloud and Virtualization Services 832
Chapter 30: Orchestrating the Environment 834
Index 837