
- •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 8 User Environment Settings 263
The user environment is constantly changing, and as a result, systems require the addition of new hardware, the expansion of current hardware, and
software changes. The system maintainer may be required to perform several configurations when adding any piece of hardware. This job may include the reconfiguration of swap space, printers, configuration files, hardware profiles, and other environmental variables. The system maintainer may also need to reconfigure LILO and the kernel modules — or even upgrade the kernel. After these tasks have been completed, several of the critical system files may also need to be reconfigured. In this chapter, you will learn how to handle the addition of hardware or software by reconfiguring the user environments.
Adding Hardware
3.9 Install and configure add-in hardware (e.g., monitors, modems, network interfaces, scanners)
When maintaining or deploying systems, new hardware is often required to support the users’ needs. This new hardware may consist of additional memory, video cards, network cards or modems, I/O controllers, printers, and many others. These devices must be configured for the Linux system in order to use them correctly, which often requires the physical installation or connection of the device.
When installing or connecting any device to a system, you must follow the installation instructions for the device. These instructions usually include antistatic guidelines and directions for proper grounding and environmental conditions; you should make sure that you have followed these instructions before attempting any hardware change. If you don’t follow the instructions, you may not see any immediate, adverse effects; the damage, however, has been done and the system will show the effects of the damage in time.
For example, monitors are often installed and connected while the system is still powered on. This can be a big mistake because voltage will damage the system if you experience an accidental misconnection of the cables. The same warning goes for printers and most other external devices. Hot plug devices, such as USB, are an exception to this rule because they don’t require the system to be powered down for installation. High-end servers usually offer hot plug and swap devices, including hard drives and even PCI cards, that require special consideration. These systems, however, are beyond the basic configuration of a Linux system. Maintaining a Linux system often requires the installation and configuration of new devices, but Linux provides the tools to perform these configurations.

264 Part III Configuration
Memory
3.7 Identify when swap space needs to be increased
3.12 Edit basic configuration files (e.g., BASH files, inittab, fstab)
The addition of memory to a system is often required to meet the demanding needs of new applications. In most cases, Linux handles the addition of memory quite well; however, you do need to make several considerations. Memory is often added to increase the memory available to programs, which can render the swap file inadequate for the amount of installed memory. The recommended size of the swap file is twice the available RAM. To reconfigure the Linux swap partition created during installation or to create a swap partition after installation, you should edit the /etc/fstab file accordingly, or use the many disk partitioning tools available to you such as fdisk. If you want to adjust the size of a swap partition, you must disable the current swap partition, which you can do by editing the fstab file (this controls the file systems that are used on boot). The following is an example of the fstab file:
/dev/hda1 / reiserfs defaults 1 1 none /dev/pts devpts mode=0620 0 0
/dev/hdb5 /home reiserfs exec,dev,suid,rw,usrquota 1 2 /mnt/cdrom /mnt/cdrom supermount fs=iso9660,dev=/dev/cdrom 0 0 /mnt/floppy /mnt/floppy supermount fs=vfat,dev=/dev/fd0 0 0 none /proc proc defaults 0 0
/dev/hda6 /usr reiserfs defaults 1 2 /dev/hda7 /var reiserfs defaults 1 2 /dev/hda5 swap swap defaults 0 0
To disable the swap file, simply remark the entry:
#/dev/hda5 swap swap defaults 0 0
VI
You can use any editor to edit the file, but you may want to consider vi, which is a very good, basic text editor. You will find that vi is very simple to use, and even though vi has many commands, you can perform most simple editing using the commands shown in Table 8-1.

Chapter 8 User Environment Settings 265
Table 8-1
VI Commands
Switch |
Task performed |
Notes |
aEnter insert mode. The characters typed in
will be inserted after the current cursor position
iEnter insert mode. The characters typed in will be inserted before the current cursor position
r |
Replace one character under the cursor |
|
|
|
|
u |
Undo the last change to the file |
|
|
|
|
x |
Delete character under the cursor |
|
|
|
|
<esc> |
Used to exit editing mode |
This key is in the upper left |
|
|
corner on the keyboard |
|
|
|
: |
Used to prepare to exit and save |
Used after <esc> |
|
|
|
w |
Writes the file when used after : |
Used after <esc> |
|
|
|
q |
Quits vi when used after : |
Used after <esc> |
|
|
|
! |
Forces command ignoring other factors |
Used to overwrite files or |
|
|
quit without saving |
|
|
|
1.Open the file in the vi editor to begin editing the fstab file. Use the command vi /etc/fstab or by moving to the directory where fstab is contained (usually /etc and using the command vi fstab).
2.After you have opened the file, edit the file by using the arrow keys to move down the file to the line containing the swap file information.
3.Comment out the relevant line configuring the swap using the i command and adding a semicolon (;) to the beginning of the line.
4.The changes must be saved, so use the <esc> keystroke to exit editing mode. Then, : to move to prepare to save and w to write or save the file.
5.After you have saved the file, you can exit the file by using : and q.

266 Part III Configuration
This action disables the mounting of the swap partition at boot and allows the configuration of a larger swap partition. To boot the system without the swap partition enabled, simply reboot the system after editing the fstab file. Be aware, though, that system performance may decrease drastically upon a reboot. At this point, you can create a new swap partition by using any of the hard disk (HD) partitioning tools discussed in Chapters 4 and 5; cfdisk is usually the preferred tool. The typical cfdisk screen looks like this.
|
|
cfdisk 2.10s |
|
|
|
Disk Drive: /dev/hda |
|
|
|
|
Size: 2111864832 bytes |
|
|
|
|
Heads: 128 |
Sectors per Track: 63 |
Cylinders: 511 |
|
Name |
Flags |
Part Type FS Type |
[Label] |
Size (MB) |
--------------------------------------------------------------------------
hda1 |
Boot |
Primary |
Linux |
260.12 |
hda5 |
|
Logical |
Linux swap |
417.01 |
hda6 |
|
Logical |
Linux |
957.88 |
hda7 |
|
Logical |
Linux |
474.81 |
[Bootable] [ Delete ] [ Help ] [Maximize] [ Print ]
[ Quit ] [ Type ] [ Units ] [ Write ]
Toggle bootable flag of the current partition
Swap
In the cfdisk output, the swap partition is listed even though it has been disabled; you can verify this by using the mount command to view mounted systems after rebooting the system. Use the cfdisk program to delete the current swap partition and to create a new swap partition. Your system may not have extra free space, however, so you must back up, resize, and then restore another file system in order to create a larger swap partition. After you have created the larger swap partition, you must activate it with mkswap /dev/<partition>. Therefore, in the preceding example, <partition> would be hda5, and then swapon /dev/<partition>. Then, you can mount the swap by entering the line into fstab, /dev/hda5 swap swap defaults 0 0, or — if the partition is the same as before — by removing the comment from the line and rebooting the system.
The creation of a new swap partition is most often made on a second hard drive to improve system performance.
After you have successfully created swap space, the system will have improved performance and better reliability.