“With the right knowledge, Linux can be clear and simple to understand. This
book presents the core fundamentals of Linux in a manner that is very logical
and easy to follow.”
—Greg Kurtzer, CTO, Infiscale, Inc.
“Wale continues to do a great job explaining complex information in a straightfor-
ward manner. All newcomers should start their Linux library with this book.”
—Ron Hudson, Senior Field Support Engineer, Intervoice, Inc.
“Wale Soyinka did a stellar job in the fourth edition and he was up for the chal-
lenge of making the fifth edition his own. It is with great pleasure I present the
fifth edition of Linux Administration: A Beginners Guide by Wale Soyinka. This
book barely resembles the 500-odd pages written nine years ago in the first edi-
tion, and it is without hesitation that I say his new words are for the better.”
—From the Foreword by Steve Shah, original author of
Linux Administration: A Beginner’s Guide
network. Any experience with bigger networks or advanced Windows technologies,
such as Active Directory, will allow you to get more from the book but is not required.
We make this assumption because we did not want to write a guide for dummies.
There are already enough books on the market that tell you what to click without tell-
ing you why; this book is not meant to be among those ranks. Furthermore, we did not
want to waste time writing about information that we believe is common knowledge for
power users of Windows. Other people have already done an excellent job of conveying
that information, and there is no reason to repeat that work here.
In addition to your Windows background, we assume that you’re interested in hav-
ing more information about the topics here than the material we have written alone. After
all, we’ve only spent 30 to 35 pages on topics that have entire books devoted to them!
For this reason, we have scattered references to other books throughout the chapters. We
urge you to take advantage of these recommendations. No matter how advanced you
are, there is always something new to learn.
We feel that seasoned Linux system administrators can also benefit from this book
because it can serve as a quick how-to cookbook on various topics that may not be the
seasoned reader’s strong points. We understand that system administrators generally
have aspects of system administration that they like or loath. For example, backups is not
one of the author’s favorite aspects of system administration, and this is reflected in the
half a page we’ve dedicated to backups—just kidding, we’ve actually dedicated an entire
chapter to backups.
WHAT’S IN THIS BOOK?
Linux Administration: A Beginner’s Guide, is broken into five parts.
Part I: Installing Linux as a Server
Part I includes three chapters (Chapter 1, “Technical Summary of Linux Distributions”;
Chapter 2, “Installing Linux in a Server Configuration”; and Chapter 3, “Managing Soft-
ware”) that give you a firm handle on what Linux is, how it compares to Windows in
several key areas, and how to install server-grade Fedora and Ubuntu Linux distribu-
tions. We end Part I with a chapter on how to install and manage software installed from
prepackaged binaries and source code. Ideally, this should be enough information to
get you started and help you draw parallels to how Linux works based on your existing
knowledge of Windows.
Part II: Single-Host Administration
Part II covers the material necessary to manage a stand-alone system (a system not requir-
ing or providing any services to other systems on the network). While this may seem
useless at first, it is the foundation on which many other concepts are built, and these
concepts are essential to understand, even after a system is connected to a network.
There are seven chapters in this part. Chapter 4, “Managing Users,” covers the infor-
mation necessary on how to add, remove, and otherwise manage users. The chapter also
introduces the basic concepts of multiuser operation, permissions, etc. In Chapter 5, “The
Command Line,” we begin covering the basics of working with the Linux command line
so that you can become comfortable dropping out of the graphical environment pro-
vided by default. While it is possible to administer a system from within the graphical
desktop, the greatest power comes from being comfortable with both the command line
interface (CLI) and the graphical user interface (GUI). (This is true for Windows, too.
Don’t believe that? Open a command prompt, run netsh, and try to do what netsh
does in the GUI.).
Once you are comfortable with the CLI, you begin Chapter 6, “Booting and Shutting
Down,” which documents the entire booting and shutting down process. This includes
the necessary detail on how to start up services and properly shut them down during
these cycles so that you can reliably add new services later on in the book without any
Chapter 7, “File Systems,” continues with the basics of file systems—their organiza-
tion, creation, and, most importantly, their management.
The basics of operation continue in Chapter 8, “Core System Services,” with coverage
of basic tools, such as xinetd for scheduling applications to run at specified times. xinetd
is the Linux equivalent of Windows’ svchost and rsyslog, which manage logging for all
applications in a unified framework. One may think of rsyslog as a more flexible version
of the Event Viewer.
We finish this section with Chapter 9, “Compiling the Linux Kernel,” and Chapter 10,
“Knobs and Dials: proc and SysFS File Systems,” which cover the kernel and kernel-level
tweaking through /proc and /sys. Kernel coverage documents the process of compiling
and installing your own custom kernel in Linux. This capability is one of the points that
gives Linux administrators an extraordinary amount of fine-grained control over how
their systems operate. The viewing of kernel-level configuration and variables through
the /proc and /sys file systems shown in Chapter 10 allows administrators to fine-tune
their kernel operation in what amounts to an arguably better and easier way than in the
Microsoft Windows world.
Part III: Security and Networking
Previous editions of this book had security and networking at the back. This was done
because at the time, the only real extensions to the book that were covered were advanced
networking concepts that don’t apply to most administrators. This has significantly
changed over the last few years. With the ongoing importance of security on the Internet,
as well as compliancy issues with Sarbanes Oxley and Health Insurance Portability and
Accountability Act (HIPAA), the use of Linux in scenarios that require high security has
risen dramatically. Thus, we decided to move coverage up before introducing network-
based services, which could be subject to network attacks.
We kick off this section with Chapter 11, “TCP/IP for System Administrators,”
which provides a detailed overview of Transmission Control Protocol/Internet Proto-
col (TCP/IP) in the context of what system administrators need to know. The chapter
provides a lot of detail on how to use troubleshooting tools, like tcpdump, to capture
packets and read them back, as well as a step-by-step analysis of how TCP connections
work. These tools should enable you to effectively troubleshoot network peculiarities.
Chapter 12, “Network Configuration,” returns to administration issues by focusing
on basic network configuration (for both IPv4 and IPv6). This includes setting up IP
addresses, routing entries, etc. We extend past the basics in Chapter 13, “The Linux Fire-
wall,” by going into advanced networking concepts and showing you how to build a
Chapter 14, “Local Security,” and Chapter 15, “Network Security,” discuss aspects
of system and network security in detail. They include Linux-specific issues as well as
general security tips and tricks so that you can better configure your system and protect
it against attacks.
Part IV: Internet Services
The remainder of the book is broken into two distinct parts: Internet and intranet ser-
vices. We define Internet services as those that you may consider running on a Linux sys-
tem exposed directly to the Internet. Examples of this include Web and Domain Name
System (DNS) services.
We start this section off with Chapter 16, “DNS.” In this section, we cover the infor-
mation you need to know to install, configure, and manage a DNS server. In addition to
the actual details of running a DNS server, we provide a detailed background on how
DNS works and several troubleshooting tips, tricks, and tools.
From DNS we move on to Chapter 17, “FTP,” and cover the installation and care of
File Transfer Protocol (FTP) servers. Like the DNS chapter, we also include a background
on the FTP protocol itself and some notes on its evolution.
Chapter 18, “Apache Web Server,” moves on to what may be considered one of the
most popular uses of Linux today: running a Web server with the Apache Web server.
In this chapter, we cover the information necessary to install, configure, and manage the
Apache Web server.
Chapter 19, “SMTP,” and Chapter 20, “POP and IMAP,” dive into e-mail through the
setup and configuration of Simple Mail Transfer Protocol (SMTP), Post Office Protocol
(POP), and Internet Message Access Protocol (IMAP) servers. We cover the information
needed to configure all three, as well as show how they interact with one another. What
you may find a little different about this book from other books on Linux is that we have
chosen to cover the Postfix SMTP server instead of the classic Sendmail server, because
it provides a more flexible server with a better security record.
We end Part IV with Chapter 21, “The Secure Shell (SSH).” Knowing how to set up
and manage the SSH service is useful for almost any server environment—regardless of
the server’s primary function.
Part V: Intranet Services
We define intranet services as those that are typically run behind a firewall for internal
users only. Even in this environment, Linux has a lot to offer. We start off by looking
at NFS in Chapter 22, “Network File System (NFS).” NFS has been around for close to
20 years now and has evolved and grown to fit the needs of its users quite well. In this
chapter, we cover Linux’s NFS server capabilities, including how to set up both clients
and servers, as well as troubleshooting. From NFS, we move on to NIS in Chapter 23,
“Network Information Service (NIS).” NIS is typically deployed alongside NFS servers to
provide a central naming service for all users within a network. We pay special attention
to scaling issues and how you can make NIS work in a large user-base environment.
Chapter 24, “Samba,” continues the idea of sharing disks and resources with cover-
age of the Samba service. Using Samba, administrators can share disks, printing facilities
and provide authentication for Windows (and Linux) users without having to install any
special client software. Thus, Linux can become an effective server, able to support and
share resources between UNIX/Linux systems as well as Windows systems.
We revisit directory services in Chapter 25, “LDAP,” with coverage of Lightweight
Directory Access Protocol (LDAP) and how administrators can use this standard service
for providing a central (or single) user database (directory) for use amongst heteroge-
neous operating systems.
In Chapter 26, “Printing,” we take a tour of the Linux printing subsystem. The print-
ing subsystem, when combined with Samba, allows administrators to support seamless
printing from Windows desktops. The result is a powerful way of centralizing printing
options for Linux, Windows, and even Mac OS X users on a single server.
Chapter 27, “DHCP,” covers another common use of Linux systems: Dynamic Host
Configuration Protocol (DHCP) servers. In this chapter, we cover how to deploy the ISC
DHCP server, which offers a powerful array of features and access controls that are not
traditionally exposed in graphical-based DHCP administration tools.
Chapter 28, “Virtualization,” is a new chapter. We discuss the basic virtualization con-
cepts and briefly cover some of the popular virtualization technologies in Linux. We cover
the kernel-based virtual machine (KVM) implementation in detail, with examples.
We end with Chapter 29, “Backups.” Backups are arguably one of the most critical
pieces of administration. Linux based systems support several methods of providing
backups that are easy to use and readily usable by tape drives and other media. We dis-
cuss some of the methods and explain how they can be used as part of a backup sched-
ule. In addition to the mechanics of backups, we discuss general backup design and how
you can optimize your backup system.
Updates and Feedback
While we hope that we publish a book with no errors, this isn’t always possible. You can
find an errata list for this book posted at www.labmanual.org. If you find any errors,
we welcome your submissions for errata updates. We also welcome your feedback and
comments. Unfortunately, our day jobs prevent us from answering detailed questions,
so if you’re looking for help on a specific issue, you may find one of the many online
communities a better choice. However, if you have two cents to share about the book, we
welcome your thoughts. You can send us e-mail at firstname.lastname@example.org.
4 Linux Administration: A Beginner’s Guide
inux has hit the mainstream. A quick walk through any local major computer
and electronics retail store will show this—the software offerings include boxed
versions of various Linux distributions, and the hardware offerings include systems
or appliances that use Linux in one form or another! Hardly a day goes by without a
mention of Linux (or open source software) in widely read print or digital publications.
What was only a hacker’s toy several years ago has grown up tremendously and is well
known for its stable and fast server performance. If more proof is needed, just note a
common question that is now asked of chief technology officers (CTOs) of Fortune 500
companies: “What is your Linux or open source strategy?”
With the innovative K Desktop Environment (KDE) and GNOME environments,
Linux is also making inroads into the Windows desktop market. In this chapter, we
will take a look at some of the core server-side technologies as they are implemented
in the Linux (open source) world and in the Microsoft Windows Server world (likely
the platform you are considering replacing with Linux). But before we delve into any
technicalities, we will briefly discuss some important underlying concepts and ideas
that affect Linux.
LINUX—THE OPERATING SYSTEM
Usually, people (mis)understand Linux to be an entire software suite of developer tools,
editors, graphical user interfaces (GUIs), networking tools, and so forth. More formally
and correctly, such software collectively is called a distribution, or distro. So the distro is the
entire software suite that makes Linux useful.
So if we consider a distribution everything you need for Linux, what then is Linux
exactly? Linux itself is the core of the operating system: the kernel. The kernel is the
program acting as chief of operations. It is responsible for starting and stopping other
programs (such as editors), handling requests for memory, accessing disks, and manag-
ing network connections. The complete list of kernel activities could easily be a chapter
in itself, and in fact, several books documenting the kernel’s internal functions have been
The kernel is a nontrivial program. It is also what puts the Linux badge on all the
numerous Linux distributions. All distributions use essentially the same kernel, and
thus, the fundamental behavior of all Linux distributions is the same.
You’ve most likely heard of the Linux distributions named Red Hat Enterprise Linux
(RHEL), Fedora, Debian, Mandrake, Ubuntu, Kubuntu, openSuSE, goBuntu, and so on,
which have received a great deal of press.
Linux distributions can be broadly categorized into two groups. The first category
includes the purely commercial distros, and the second includes the noncommercial dis-
tros, or spins. The commercial distros generally offer support for their distribution—at
a cost. The commercial distros also tend to have a longer release life cycle. Examples of
commercial flavors of Linux-based distros are RHEL, SuSE Linux Enterprise (SLE), etc.
Chapter 1: Technical Summary of Linux Distributions 5
The noncommercial distros, on the other hand, are free. The no