- •About the Author
- •Credits
- •How This Book Is Organized
- •Part I: Linux Basics
- •Part II: Installation
- •Part III: Configuration
- •Part IV: Administration
- •Part V: Maintaining the Linux System
- •How Each Chapter Is Structured
- •How to Use This Book
- •Conventions Used in This Book
- •What is Linux?
- •The origin of UNIX
- •Who started Linux?
- •Understanding Open Source
- •Understanding Closed Source
- •Understanding Artistic License
- •Is Freeware really free?
- •Is Shareware never free?
- •A comparison and contrast of licensing methods
- •The Growth of Linux
- •Linux on a Personal Computer
- •Graphical installation
- •Hardware detection
- •Graphical user interface
- •Linux limitations on the PC
- •Linux succeeds on the PC
- •Linux on workstations
- •Linux on servers
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux Kernel
- •Kernel versions
- •Kernel availability
- •Linux Distributions
- •Beehive
- •BlueCat
- •Caldera OpenLinux
- •Debian
- •Corel
- •DragonLinux
- •Elfstone
- •Gentoo
- •Hard Hat Linux
- •KRUD
- •LinuxPPC
- •Mandrake
- •Phat Linux
- •Slackware
- •StormLinux
- •SuSE
- •TurboLinux
- •Yellow Dog Linux
- •Mini and Specialty Distributions
- •Astaro
- •KYZO
- •FlightLinux
- •NetMAX
- •Packages and Packaging Solutions
- •Red Hat Package Manager
- •Debian Package Management System
- •Tarball
- •Linux Resources
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux In the Real World
- •Word Processing
- •Spreadsheets and databases
- •Web browsing
- •File transfer
- •More, more, and more applications
- •The Server and DNS
- •A Linux Web server
- •Linux e-mail server
- •File servers
- •Proxy, news, and search servers
- •FTP servers
- •Firewalls
- •Determining Linux Roles and Services
- •Comparing Linux with other operating systems
- •Hardware compatibility
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Installing Linux
- •Final Preparations for Installation
- •Verification
- •Package selection
- •Final hardware verification
- •Pre-installation partitioning planning
- •Installing Linux
- •Text or GUI installation
- •Basic setup of Linux
- •Selecting the machine type
- •Partitioning the hard disk drive
- •Installing a boot manager
- •Creating the Boot Diskette
- •Networking
- •Additional installation information
- •Accounts and passwords
- •Additional packages to install
- •GUI installation
- •Obtaining video card information
- •Configuring the X windows system
- •Selecting the windows manager or desktop environment
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Answers to Assessment Questions
- •Scenarios
- •Alternative to the GUI Installation
- •Command Line installation
- •Install the Linux system
- •Network installations of Linux
- •Review of a Linux Installation
- •Installation media
- •Initial selections
- •Installation type or class
- •Disk partitioning and formatting
- •Installing LILO
- •Network configuration
- •User accounts
- •Authentication methods
- •Package selection and installation
- •A Dual-Boot Installation of Linux
- •Linux with Microsoft Windows
- •Linux with Microsoft Windows NT and 2000
- •Linux and Solaris
- •Linux and other operating systems
- •Installing Additional Software with gzip and tar
- •Installing Additional Software with RPM
- •Removing software with RPM
- •Upgrading software with RPM
- •Query the RPM software
- •Verify the RPM software
- •Verify the package files
- •Upgrading the Kernel
- •Upgrading a Linux Kernel
- •System Log Files
- •The Final Test of the Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What is the X Window System?
- •The X Window System
- •X Client and Server communications
- •X Window Manager
- •Configuring X Window Systems
- •Custom X Window System Programs
- •Manual Configuration of the X Window System
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic Network Services
- •TCP/IP Protocol Suite
- •Connection protocols needed
- •Other network protocols
- •Configuring Basic Network Services
- •Host name
- •IP addressing
- •DHCP
- •Netmask
- •Hardware resources
- •Routing and gateways
- •PPP, SLIP and PLIP connections
- •Server Tasks with
- •IP aliases for virtual hosts
- •Apache Web Server
- •Samba File Server
- •Home directories
- •Disk shares
- •Configuring Client Services
- •SMB/CIFS
- •NIS client configuration
- •NFS client configuration
- •Configuring Internet Services
- •Web browser
- •POP and SMTP
- •TFTP
- •SNMP
- •Remote Access
- •Rlogin
- •Telnet
- •OpenSSH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Adding Hardware
- •Memory
- •Swap
- •Adding a hard drive
- •Video and monitor
- •Printers
- •Configuration files
- •Setting environment variables
- •BASH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic User and Group Administration
- •What are users and groups?
- •Creating users
- •Change user information
- •Deleting users
- •Creating groups
- •Getting Around Linux
- •Navigating Linux
- •Common file and directory commands
- •Setting File and Directory Permissions
- •Mounting and Managing File Systems
- •Mount
- •Umount
- •Mounted file systems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Multi-User Environment
- •The creation of Virtual Consoles
- •The Linux Terminal Server Project
- •Configurations for remote systems
- •Monitoring remote connections
- •Common Shell Commands
- •Basic shell scripts
- •Caution using root access
- •Navigating the GUI interface
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Runlevels
- •init
- •Shutting down Linux
- •Managing Linux Services
- •Configuring Linux Printing
- •lpd daemon
- •/etc/printcap
- •Printing management
- •Using the vi Editor
- •vi operation modes
- •Editing text files
- •Using the
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disk and File System Management
- •Repairing Partitions
- •System Automation and Scheduling
- •cron
- •Core Dumps
- •Analyzing core dumps
- •GNU Debugger
- •Managing Networking Interfaces
- •Installing System Packages and Patches
- •Compressed archive
- •Debian Package Installer
- •Slackware Package Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Processes
- •Core services versus non-critical services
- •Process administration
- •Process control
- •Monitoring Log Files
- •Maintaining Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Security
- •Securing the Environment
- •Location
- •Environment
- •System Security
- •System/user files
- •Permissions
- •Log auditing
- •Backups
- •Linux Security Best Practices
- •Network security
- •Firewall
- •System security
- •Securing a Web server
- •Securing an FTP server
- •FTP program version
- •FTP configuration files
- •Process security
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disaster Recovery Planning
- •Types of data
- •Frequency and Scheduling
- •Storage and media types
- •Recovering data
- •Offsite storage
- •Linux Backup Tools and Commands
- •Third party tools
- •Tape devices
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Identifying the Problem
- •Methodology and Best Practices
- •Troubleshooting Resources
- •Documentation resources
- •Internet resources
- •System Log Files
- •Tools for Log Files
- •Output to another file
- •Locating files
- •Process Configuration and Management
- •Stopping, Starting, and Restarting Processes
- •Configuration Files
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Examining the Startup Process
- •Boot process steps
- •Analyzing Boot Process Errors
- •Common Boot Problems
- •Using System Status Tools
- •File System Check
- •System Resource Commands
- •Using the System Boot Disk
- •Types of boot disks
- •Creating a boot disk
- •Creating a rescue/utility disk
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Common User Problems
- •Login problems
- •File and directory permissions
- •Printing problems
- •Mail problems
- •Software Package Problems
- •Package dependencies
- •Software and version conflicts
- •Backup and Restore Errors
- •Backup hardware
- •Backup software
- •File restore errors
- •Application Failures
- •Log files
- •Process and daemon errors
- •Web server errors
- •Telnet
- •Mail services
- •Basic Networking Troubleshooting
- •Networking connectivity
- •Network hardware problems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Mainboard Components
- •BIOS
- •System memory
- •System Resources
- •I/O addresses
- •Direct memory access
- •Laptop Considerations
- •PCMCIA
- •Linux Peripheral Configuration
- •Installing and Configuring SCSI Devices
- •SCSI definitions
- •SCSI technologies
- •SCSI cabling and termination
- •SCSI device configuration
- •Linux SCSI devices
- •ATA/IDE Devices
- •IDE drive configuration
- •Linux ATA/IDE Drive configuration
- •Linux Support for Other Devices
- •IEEE 1394 (Firewire)
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Microsoft Windows
- •Using the CD with Linux
- •Microsoft Windows applications
- •Linux applications
- •Troubleshooting
- •Sample Exam
- •Exam Questions
- •Exam Answers
- •Taking a CompTIA Exam
- •How to register for an exam
- •What to expect at the testing center
- •Your exam results
- •If you don’t receive a passing score
- •About the Linux + Exam
- •Preparing for the Linux+ Exam
- •For More Information
- •Preamble
- •No Warranty
- •Glossary
- •Index
Chapter 12 Study Guide 405
6.Use the ifconfig command to enable the interface again: ifconfig eth0 up
You should be able to ping the address from another machine again.
Lab 12-2 Configuring Cron to Automate Tasks
The objective for this hands-on lab is to gain experience in using cron to automate tasks. You should be able to use any default Linux installation for this exercise.
1.Logged in as the root user, check your current crontab file: crontab-l
2.Unless you have configured jobs before, it should be empty. Create a simple task that will run each day. Schedule a task for 5 minutes from the current time. So if your time is currently 1:00 p.m., set it to check the local disk space at 1:05 p.m.
crontab -e
Now use vi to enter the cron command:
5 13 * * * df -kl
3.Wait five minutes, and then check your root mail file by using the following command:
You should have an e-mail with the output of the df -kl command.
4.Delete your crontab file so that it is empty again by using the following command:
crontab -r
Check to see that the job was removed by using the following command: crontab -l
Answers to Chapter Questions
Chapter Pre-test
1.Cron is used to schedule recurring jobs. You can set it to run a program or script at any time you choose.
2.A file with a tar.gz extension is a file archive created by tar. Compress this file by using the gzip command.
406 Chapter 12 Study Guide
3.The ifconfig command shows you information about the configuration of your network interfaces, including addresses, and packets transmitted and received.
4.The command to create a file system is mkfs. This command invokes another command specific for that file system, such as mke2fs for Linux file systems.
5.Analyze core dumps to find out why a program crashed. It may give you important information that can help you find what bug is causing the program to fail.
6.A program patch is an update to an application or service that was created to fix an existing bug, or to enhance security or functionality for a program.
7.The at command differs from cron in that it can only be used to schedule a job to run at one time. The cron command allows you to set up a job that will run at recurring times.
8.The fsck utility (File System Check) can scan your disk for errors, and actually fix them as it checks. This is helpful in recovering corrupted file systems that won’t mount or boot.
9.Any system upgrades or patches should be performed in off-hours, so that it won’t affect users currently logged into the system. If the system needs to be rebooted, you won’t have any files still open by users, which may cause them to be corrupted.
10.The fdisk command is used to create partitions on a hard drive.
Assessment Questions
1.D. By invoking the mkfs command, you actually run a program specific to the file system that you are creating, such as mke2fs to format using the Linux ext2 file system. For review, see the “Disk and File System Management” section.
2.B. By analyzing the resulting core file from an application, the administrator may be able to debug the application and find out why the program is crashing. For review, see the “Core Dumps” section.
3.A. The administrator can select the loopback interface to configure by using the ifconfig lo command. The IP address for any loopback interface is 127.0.0.1. For review, see the “Managing Network Interfaces” section.
4.C. The proper format for cron entries is minute/hour/day/month/day of week (0-Sunday, 6-Saturday). For review, see the “System Automation and Scheduling” section.
5.D. To store and compress most file archives, a number of files are stored in a tar archive. To compress that archive, use the gzip command. For review, see the “Installing System Packages and Patches” section.
Chapter 12 Study Guide 407
6.A. The correct command is ifconfig eth0 192.168.1.5 netmask 255.255.255.0. The eth0 option can be any Ethernet interface. The loopback interface must always use 127.0.0.1 for an IP address. For review, see the “Managing Network Interfaces” section.
7.B. Within the fdisk utility, the “p” command will print the partition table. This command does not “print” to a printer; the command displays the partition table on the terminal screen. For review, see the “Disk and File System Management” section.
8.D. The GNU debugger is the most popular tool for analyzing core dump files. You can use it to walk step-by-step through a program to identify bugs. For review, see the “Core Dumps” section.
9.A. The cron command allows you to create recurring tasks. The at command only allows you to execute a scheduled task at one particular time. For review, see the “System Automation and Scheduling” section.
10.C. The rpm -U command will update a currently existing package to the new version. If the program doesn’t exist, rpm will install the package. For review, see the “Installing System Packages and Patches” section.
11.B. To enable an interface, use the ifconfig eth0 up command. If you need to disable the interface, use ifconfig eth0 down. For review, see the “Managing Network Interfaces” section.
12.A. The proper command is tar -zxvf filename. You can also complete the operation by using two separate commands, tar to extract the archive and gunzip to decompress the file. For review, see the “Installing System Packages and Patches” section.
13.C. The core file will tell you what exactly caused the program to crash. In this case, the program crashed because of a segmentation fault in memory. For review, see the “Core Dumps” section.
14.A. The first ATA/IDE hard drive is hda, so the correct command is fdisk /dev/hda. For review, see the “Disk and File System Management” section.
15.B. If you have no intention of keeping these files for debugging purposes, they should be deleted because they are wasting valuable disk space, and may cause your system to run out of space. For review, see the “Core Dumps” section.
16.D. Programs and applications should be kept up-to-date with the latest releases because the newest version will always have the latest security updates, bug fixes, and additional functionality. For review, see the “Installing System Packages and Patches” section.
17.A. The Linux swap file is used for virtual memory to store additional information that can’t fit into current memory. This swap file allows information to be cached on disk, and can be retrieved very quickly. Heavy use of the swap file indicates a low memory condition. For review, see the “Disk and File System Management” section.
408 Chapter 12 Study Guide
18.C. A kernel panic indicates that a kernel process has crashed. This is a very serious error that causes the entire Linux system to crash. These core dumps should be analyzed carefully to find the root cause of the problem. For review, see the “Core Dumps” section.
19.A. The second ethernet interface is called eth1, so the proper command is ifconfig eth1 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.254. For review, see the “Managing Network Interfaces” section.
20.B. Because you are only running this job once at the specified time, you only need to use the at command. The cron command is more useful for setting up recurring jobs. The correct syntax is at 23:59. For review, see the “System Automation and Scheduling” section.
Scenarios
1.Because this must be a recurring task, the at command won’t be an efficient method for performing the task in this situation. It is much easier to set up cron to run a script that will check the disk space daily at 1:00 p.m. The output will be e-mailed to the root account. You can compare the results from day to day to analyze disk space usage.
Your cron file should look similar to the following:
* 13 * * * df -kl
2.The crash of the Web server should create a core dump file in the Web server home directory. The administrator can save that file, and either debug it himself using the GNU debugger tool (gdb), or pass it along to the programmer who created the Perl code so that they can debug the program and remove the bugs that are causing the Web server to crash.
Process |
C H A P T E R |
13 |
Management
EXAM OBJECTIVES
5.6 Differentiate core services from non-critical services (e.g., ps, PID, PPID, init, timer)
5.7 Identify, execute and kill processes (ps, kill, killall)
5.8 Monitor system log files regularly for errors, logins, and unusual activity
5.9 Document work performed on a system
410 Part V Maintaining the Linux System
CHAPTER PRE-TEST
1.What command is used to identify processes?
2.Which log file contains a list of user logins and logouts?
3.Why is maintenance documentation important?
4.What command is used to terminate a process?
5.What is the difference between a core process and a non-critical process?
6.What is the purpose of the init process?
7.What is a PID?
8.What command is used to send a running process into the background?
9.Which log contains system errors?
10.What command can be used to see real-time information on running processes and the resources that they are using?
Answers to these questions can be found at the end of the chapter.