Transcript
Contents Introduction
xix
Assessment Test
1
System Startup and Advanced System Management
Linux Kernel Configuration
45
Understanding the Kernel Obtaining and Installing a Kernel Reading Kernel Documentation Locating Kernel Binaries
46 46 48 49
TE
MA
D
TE
GH
RI
PY 2
3 4 6 6 9 11 11 12 13 14 19 20 21 23 23 24 26 29 30 32 33 34 35 35 37 41
CO Chapter
1
Exploring the Boot Process Booting Linux Configuring GRUB Configuring GRUB 2 Installing the GRUB Boot Loader Interacting with GRUB at Boot Time Customizing System Startup Understanding Runlevels Configuring SysV Startup Scripts Configuring Upstart Checking Your Runlevel Changing Runlevels on a Running System Compile and Install Programs from Source Understanding Source Code Issues Preparing Source Code Compiling Software Installing Software Uninstalling or Upgrading Software Notify Users of System-Related Issues Setting Login Messages Sending Users Messages in Real Time Summary Exam Essentials Review Questions Answers to Review Questions
RI
Chapter
The LPI 201 Exam (60 Weights)
AL
Part I
xxviii
x
Contents
Chapter
3
Preparing a Kernel Applying Kernel Patches Configuring the Kernel Source Compiling a Kernel Building a Kernel Installing a Kernel Binary Installing Kernel Modules Preparing an Initial RAM Disk Preparing a Kernel Package Adding a Kernel to GRUB Managing Kernel Modules at Runtime Obtaining Information About the Kernel and Its Modules Loading Kernel Modules Removing Kernel Modules Maintaining Kernel Modules Summary Exam Essentials Review Questions Answers to Review Questions
50 50 51 59 59 60 61 62 64 65 68 68 72 74 77 79 79 81 85
Basic Filesystem Management
89
Making Filesystems Available Identifying Filesystem Types Mounting a Filesystem Once Permanently Mounting Filesystems Using an Automounter Determining What Is Mounted Unmounting a Filesystem Maintaining Filesystems Creating Filesystems Checking Filesystems for Errors Tuning Filesystems Manipulating Swap Space Managing Optical Discs Linux Optical Disc Tools A Linux Optical Disc Example Creating Cross-Platform Discs Reading and Writing UDF Discs Managing Devices with udev Understanding udev Preparing to Create udev Rules Creating udev Rules Monitoring udev Activity
90 91 94 98 101 105 105 107 107 110 111 118 120 121 121 122 124 124 125 127 130 131
Contents
Summary Exam Essentials Review Questions Answers to Review Questions Chapter
4
Advanced Disk Management Partitioning Disks Understanding Partitions Creating Partitions Configuring RAID Understanding RAID Preparing a Disk for Software RAID Assembling a RAID Array Using a RAID Array Configuring Logical Volume Manager Understanding Logical Volume Manager Creating and Manipulating Physical Volumes Creating and Manipulating Volume Groups Creating and Manipulating Logical Volumes Using LVM Snapshots Tuning Disk Access Understanding Disk Hardware Identifying Disk Resource Use Testing Disk Performance Adjusting Disk Parameters Monitoring a Disk for Failure Backing Up and Restoring a Computer Choosing Backup Hardware Choosing Backup Software Planning a Backup Schedule Preparing for Disaster: Backup Recovery Summary Exam Essentials Review Questions Answers to Review Questions
Chapter
5
Networking Configuration Performing Basic Network Configuration Connecting to a Wireless Network Connecting to a Network with DHCP Connecting to a Network with a Static IP Address
xi
132 133 135 140 143 144 144 146 148 148 151 152 155 157 157 159 162 164 169 170 171 173 175 176 177 179 179 181 191 192 194 195 197 202 205 206 206 211 212
xii
Contents
Using GUI Configuration Tools Using the ifup and ifdown Commands Configuring Hostnames Checking Basic Connectivity Setting Additional Network Options Setting Advanced Router Options Using an All-In-One Networking Tool Configuring a VPN Monitoring Network Traffic Troubleshooting Network Issues Identifying Problem Spots Resolving Hostname Problems Resolving Connectivity Issues Resolving Routing Problems Resolving Security Problems Summary Exam Essentials Review Questions Answers to Review Questions Chapter
6
DNS Server Configuration Understanding the Role of DNS Running a Caching-Only Name Server Modifying the Main BIND Configuration File Modifying Zone Files Updating from Older BIND Versions Checking Changes Creating and Maintaining DNS Zones Adding New Zones Configuring Zone Files Testing Your Configuration Running a Slave Server Configuring a Slave Server Securing Zone Transfers Making Additional Security Improvements Running BIND in a Jail Configuring Split DNS Summary Exam Essentials Review Questions Answers to Review Questions
216 216 217 218 220 221 225 226 231 238 238 244 246 247 247 248 249 251 255 259 260 263 264 266 267 267 268 269 270 274 280 280 281 282 282 283 284 284 286 291
Contents
Part II Chapter
Chapter
7
8
xiii
The LPI 202 Exam (60 Weights)
295
Advanced Network Configuration
297
Configuring a DHCP Server When to Use DHCP Basic DHCP Installation Setting Network-Wide Options Configuring Delivery of Dynamic Addresses Configuring Delivery of Fixed Addresses Configuring a DHCP Relay Agent Managing LDAP Accounts What Does LDAP Do? Preparing a System to Use LDAP Tools Working with LDIF Files Adding Accounts Modifying Accounts Deleting Accounts Querying a Server About Accounts Configuring a Router Understanding Types of Routing Activating Routing Configuring Firewall Rules Configuring NAT Automatic Routing Configuration Configuring SSH SSH Basics Setting SSH Options for Your System SSH Security Considerations Summary Exam Essentials Review Questions Answers to Review Questions
298 299 300 302 305 306 309 310 310 311 311 314 315 317 317 319 319 320 320 330 331 334 334 336 344 345 346 348 353
Configuring File Servers
357
Understanding the Role of a File Server Configuring a Samba Server Setting Global Samba Options Configuring File Shares Configuring Printer Shares Checking Your Configuration and Running Samba Checking Samba Log Files Using Linux as an SMB/CIFS Client
358 360 360 366 368 370 372 372
xiv
Contents
Configuring an NFS Server Setting NFS Prerequisites Setting Basic Export Options Managing Exports on the Fly Improving NFS Security Using Linux as an NFS Client Configuring an FTP Server Selecting an FTP Server Understanding FTP Basics Configuring Pure-FTPd Configuring vsftpd Summary Exam Essentials Review Questions Answers to Review Questions Chapter
9
Configuring Web and Email Servers Understanding Web Servers Setting Basic Apache Options Configuring Apache to Host Your Site Setting the Apache User and Group Changing Web Page Locations Serving Virtual Domains Configuring Scripts Enabling Encryption Limiting Access to Apache Controlling Apache Using apache2ctl Managing Apache Log Files Implementing a Proxy Server Selecting a Proxy Server Configuring Squid Adjusting Access Rules Configuring Clients to Use a Proxy Server Understanding Email Configuring a Push Mail Server Configuring a Domain to Accept Mail Choosing an Email Server Running Sendmail Running Postfix Managing Email Checking Log Files
377 377 379 382 388 388 390 391 392 393 394 396 396 398 402 405 406 407 409 410 411 414 416 418 421 423 424 426 427 427 428 429 430 431 433 433 434 435 440 444 447
Contents
Configuring Procmail Understanding Mail Storage Formats Writing Procmail Rules Seeing Procmail in Action Configuring POP and IMAP Servers Selecting a POP or IMAP Server Configuring Courier Configuring Dovecot Summary Exam Essentials Review Questions Answers to Review Questions Chapter
Chapter
10
11
Security
xv
448 448 449 451 453 453 456 457 458 459 461 465 469
Authenticating Users with PAM Understanding PAM Principles Editing a PAM Stack Examining Example Configurations Adjusting the Name Service Switch Enabling TCP Wrappers Understanding TCP Wrappers Principles Restricting Access with TCP Wrappers Calling TCP Wrappers Using Similar Functionality in Other Programs Dealing with Ports and Packets Scanning for and Dealing with Open Ports Monitoring Network Traffic Keeping Up-to-Date with Security Issues Summary Exam Essentials Review Questions Answers to Review Questions
470 471 472 478 480 481 482 483 485 487 489 490 492 497 499 500 502 506
System Troubleshooting I: Boot and Kernel Problems
511
Approaching a Problem Troubleshooting Boot Problems Initializing Hardware Identifying Your Boot Loader Locating Boot Loader Files and Code Interpreting Boot Loader Error Messages Dealing with Initial RAM Disk Issues Fixing Problems Early in the OS Boot Stage
512 513 514 514 516 519 523 524
Contents
xvi
Troubleshooting Miscellaneous Problems Interpreting Boot-Time Displays Checking the Kernel Ring Buffer Identifying Hardware Identifying Loaded Kernel Modules Checking Log Files Tracing Software Problems Summary Exam Essentials Review Questions Answers to Review Questions Chapter
12
System Troubleshooting II: System Resources and the User Environment Troubleshooting System Initialization Managing the Initialization Process Dealing with Local Startup Scripts Managing Login Processes Adjusting Kernel Options Fixing Account Problems Dealing with Password Problems Adjusting User Shells Fixing User/Group Association Issues Adjusting UIDs and GIDs Adjusting Login Variables Troubleshooting Shells Investigating bash Login Scripts Using Unusual Shells Investigating Running Processes Finding Running Processes Checking Logging Options Dealing with Library Issues Dealing with Scheduled Processes Managing Scheduled Processes Investigating Problems Summary Exam Essentials Review Questions Answers to Review Questions
Appendix Glossary Index
About the Companion CD
524 525 525 530 539 542 548 552 553 555 559
563 564 564 568 569 572 574 574 576 576 577 579 579 579 581 582 582 585 590 592 593 596 597 597 600 604 609 615 637
Table of Exercises Exercise
2.1
Managing Kernel Modules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Exercise
3.1
Creating Filesystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Exercise
4.1
Creating and Using an LVM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Exercise
5.1
Configuring a Network Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Exercise
7.1
Configuring Logins Without Passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Exercise
8.1
Managing an NFS Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Exercise
9.1
Configuring Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Exercise
10.1
Using Fail2Ban. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Exercise
11.1
Identifying Your Own Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Exercise
12.1 Changing an Account’s UID Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577