Senior Acquisitions Editor: Kenyon Brown
Development Editor: Gary Schwartz
Technical Editor: Kevin Ryan
Production Editor: Rebecca Anderson
Copy Editor: Judy Flynn
Editorial Manager: Mary Beth Wakefield
Production Manager: Kathleen Wisor
Associate Publisher: Jim Minatel
Media Supervising Producer: Richard Graves
Book Designers: Judy Fung and Bill Gibson
Proofreader: Word One, New York
Indexer: Johnna VanHoose
Project Coordinator, Cover: Brent Savage
Cover Designer: Wiley
Cover Image: © Getty Images Inc./Jeremy Woodhouse
Copyright © 2015 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-119-02118-6
ISBN: 978-1-119-02120-9 (ebk.)
ISBN: 978-1-119-02119-3 (ebk.)
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/
permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com
. For more information about Wiley products, visit www.wiley.com
.
Library of Congress Control Number: 2015933955
TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission.LPIC-1 is a registered trademark of Linux Professional Institute, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
First, all glory and praise go to God, who through His Son, Jesus Christ, makes all things possible, and gives us the gift of eternal life.
Many thanks go to the fantastic team of people at Sybex for their outstanding work on this project. Thanks to Kenyon Brown, the acquisitions editor, for offering us the opportunity to work on this book. Also thanks to Gary Schwartz, the development editor, for keeping things on track and making this book more presentable. Thanks, Gary, for all your hard work and diligence. The technical editor, Kevin E. Ryan, did a wonderful job of double-checking all of the work in the book in addition to making suggestions to improve the content. We would also like to thank Carole Jelen at Waterside Productions, Inc., for arranging this opportunity for us and for helping us out in our writing careers.
Christine would particularly like to thank her husband, Timothy, for his encouragement, patience, and willingness to listen, even when he has no idea what she is talking about.
Richard Blum, CompTIA Linux+, LPIC-1, has worked in the IT industry for more than 25 years as both a system and network administrator, and he has published numerous Linux and open-source books. Rich is an online instructor for Linux and Web programming courses that are used by colleges and universities across the United States. When he is not being a computer nerd, Rich enjoys spending time with his wife, Barbara, and two daughters, Katie Jane and Jessica.
Christine Bresnahan, CompTIA Linux+, LPIC-1, started working with computers more than 25 years ago in the IT industry as a systems administrator. Christine is an Adjunct Professor at Ivy Tech Community College where she teaches Linux certification and Python programming classes. She also writes books and produces instructional resources for the classroom.
Why should you learn about Linux? It's a fast-growing operating system, and it is inexpensive and flexible. Linux is also a major player in the small and mid-size server field, and it's an increasingly viable platform for workstation and desktop use as well. By understanding Linux, you'll increase your standing in the job market. Even if you already know Windows or Mac OS and your employer uses these systems exclusively, understanding Linux will give you an edge when you're looking for a new job or you're looking for a promotion. For instance, this knowledge will help you make an informed decision about if and when you should deploy Linux.
The Linux Professional Institute (LPI) has developed its LPIC-1 certification as an introductory certification for people who want to enter careers involving Linux. The exam is meant to certify that an individual has the skills necessary to install, operate, and troubleshoot a Linux system and is familiar with Linux-specific concepts and basic hardware.
The purpose of this book is to help you pass the LPIC-1 exams (101-400 and 102-400), updated in 2015. Because these exams cover basic Linux installation, configuration, maintenance, applications, networking, and security, those are the topics that are emphasized in this book. You'll learn enough to get a Linux system up and running and to configure it for many common tasks. Even after you've taken and passed the LPIC-1 exams, this book should remain a useful reference.
Linux is a clone of the Unix operating system (OS) that has been popular in academia and many business environments for years. Formerly used exclusively on large mainframes, Unix and Linux can now run on small computers, which are actually far more powerful than the mainframes of just a few years ago. Because of its mainframe heritage, Unix (and hence also Linux) scales well to perform today's demanding scientific, engineering, and network server tasks.
Linux consists of a kernel, which is the core control software, and many libraries and utilities that rely on the kernel to provide features with which users interact. The OS is available in many different distributions, which are collections of a specific kernel with specific support programs.
Several good reasons to get your Linux certification exist. There are four major benefits:
The exams were designed with the needs of Linux professionals in mind. Surveys of Linux administrators were performed to learn what they actually needed to know to do their jobs.
The exams have been extensively tested and validated using psychometric standards. The result is an ability to discriminate between competent administrators and those who must still learn more material.
LPI is an organization that doesn't itself market any Linux distribution. This fact removes the motivation to create an exam that's designed as a way to market a particular distribution.
Major players in the Linux world support the exams.
The certification is available to anyone who passes the two required exams: 101-400 and 102-400 (often referred to as simply 101 and 102). You don't have to work for a particular company. It's not a secret society.
Pearson VUE administers the exam. The exam can be taken at any Pearson VUE testing center. If you pass, you will get a certificate in the mail saying that you have passed.
Anybody who wants to pass the certification exams may benefit from this book. This book covers the material that someone new to Linux will need to learn the OS from the beginning, and it continues to provide the knowledge you need up to a proficiency level sufficient to pass the two exams. You can pick up this book and learn from it even if you've never used Linux before, although you'll find it an easier read if you've at least casually used Linux for a few days. If you're already familiar with Linux, this book can serve as a review and as a refresher course for information with which you might not be completely familiar. In either case, reading this book will help you pass the exams.
This book is written with the assumption that you know at least a little bit about Linux (what it is and possibly a few Linux commands). We also assume that you know some basics about computers in general, such as how to use a keyboard, how to insert a disc into an optical drive, and so on. Chances are that you have used computers in a substantial way in the past—perhaps even Linux, as an ordinary user, or maybe you have used Windows or Mac OS. We do not assume that you have extensive knowledge of Linux system administration, but if you've done some system administration, you can still use this book to fill in gaps in your knowledge.
This book consists of 10 chapters plus supplementary information: an online glossary, this introduction, and the assessment test after the introduction. The chapters are organized as follows:
Chapters 1 through 5 cover the 101-400 exam, while Chapters 6 through 10 cover the 102-400 exam. These make up Part I and Part II of the book, respectively.
We've included several study learning tools throughout the book:
At the end of this introduction is an assessment test that you can use to check your readiness for the exam. Take this test before you start reading the book; it will help you determine the areas you might need to brush up on. The answers to the assessment test questions appear on a separate page after the last question of the test. Each answer includes an explanation and a note telling you the chapter in which the material appears.
An objective map shows you where each of the exam objectives is covered in this book. In addition, each chapter opens with a list of the exam objectives it covers. Use these to see exactly where each of the exam topics is covered.
Each chapter, just after the summary, includes a number of exam essentials. These are the key topics you should take from the chapter in terms of areas to focus on when preparing for the exam.
To test your knowledge as you progress through the book, there are review questions at the end of each chapter. As you finish each chapter, answer the review questions and then check your answers—the correct answers and explanations are in Appendix A. You can go back to reread the section that deals with each question you got wrong to ensure that you answer correctly the next time you're tested on the material.
To get the most out of this book, you should read each chapter from start to finish and then check your memory and understanding with the end-of-chapter elements. Even if you're already familiar with a topic, you should skim the chapter; Linux is complex enough that there are often multiple ways to accomplish a task, so you may learn something even if you're already competent in an area.
The interactive online learning environment that accompanies the book provides a test bank with study tools to help you prepare for the certification exam—and increase your chances of passing it the first time! The test bank includes the following:
All of the questions in this book are provided, including the Assessment Test, which you'll find at the end of this introduction, and the Chapter Tests that include the Review Questions at the end of each chapter. In addition, there are two Practice Exams. Use these questions to test your knowledge of the study guide material. The online test bank runs on multiple devices.
Questions are provided in digital flashcard format (a question followed by a single correct answer). You can use the flashcards to reinforce your learning and provide last-minute test prep before the exam.
A glossary of key terms from this book and their definitions are available as a fully searchable PDF.
This book uses certain typographic styles in order to help you quickly identify important information and to avoid confusion over the meaning of words such as onscreen prompts. In particular, look for the following styles:
A monospaced font
indicates the contents of configuration files, messages displayed at a text-mode Linux shell prompt, filenames, text-mode command names, and Internet URLs.Italicized monospaced text
indicates a variable—information that differs from one system or command run to another, such as the name of a client computer or a process ID number.Bold monospaced text
is information that you're to type into the computer, usually at a Linux shell prompt. This text can also be italicized to indicate that you should substitute an appropriate value for your system. (When isolated on their own lines, commands are preceded by non-bold monospaced $
or #
command prompts, denoting regular user or system administrator use, respectively.)In addition to these text conventions, which can apply to individual words or entire paragraphs, a few conventions highlight segments of text:
Behind every computer industry exam, you can be sure to find exam objectives—the broad topics in which exam developers want to ensure your competency. The official exam objectives are listed here. (They're also printed at the start of the chapters in which they're covered.)
Following are the areas in which you must be proficient in order to pass the 101-400 exam. This exam is broken into four topics (101–104), each of which has three to eight objectives. Each objective has an associated weight, which reflects its importance to the exam as a whole. The four main topics are as follows:
Subject Area |
101 System Architecture |
102 Linux Installation and Package Management |
103 GNU and Unix Commands |
104 Devices, Linux Filesystems, Filesystem Hierarchy Standard |
lsusb
, lspci
, etc.)sysfs
, udev
, hald
, dbus
/sys
, /proc
, /dev
, modprobe
, lsmod
, lspci
, lsusb
dmesg
, BIOS, bootloader, kernel, init
, initramfs
, SysVinit, systemd/etc/inittab
, shutdown
, init
, /etc/init.d
, telinit
, systemd
, systemctl
, /etc/systemd/
, /usr/lib/systemd/
, wall
/boot
partition conforms to the hardware architecture requirements for booting/
(root) filesystem, /var
filesystem, /home
filesystem, /boot
filesystem, swap space, mount points, partitions/boot/grub/menu.lst
, grub.cfg
and grub.conf
, grub-install
, grub-mkconfig
, MBRldd
, ldconfig
, /etc/ld.so.conf
, LD_LIBRARY_PATH
/etc/apt/sources.list
, dpkg
, dpkg-reconfigure
, apt-get
, apt-cache
, aptitude
rpm
, rpm2cpio
, /etc/yum.conf
, /etc/yum.repos.d/
, yum
, yumdownloader
bash
, echo
, env
, exec
, export
, pwd
, set
, unset
, man
, uname
, history
, .bash_history
cat
, cut
, expand
, fmt
, head
, od
, join
, less
, nl
, paste
, pr
, sed
, sort
, split
, tail
, tr
, unexpand
, uniq
, wc
find
to locate and act on files based on type, size, or timetar
, cpio
, and dd
cp
, find
, mkdir
, mv
, ls
, rm
, rmdir
, touch
, tar
, cpio
, dd
, file
, gzip
, gunzip
, bzip2
, xz
, file globbingtee
, xargs
&
, bg
, fg
, jobs
, kill
, nohup
, ps
, top
, free
, uptime
, pgrep
, pkill
, killall
, screen
nice
, ps
, renice
, top
grep
, egrep
, fgrep
, sed
, regex(7)
vi
, /
, ?
, h
, j
, k
, l
, i
, o
, a
, c
, d
, p
, y
, dd
, yy
, ZZ
, :w!
, :q!
, :e!
mkfs
commands to create various filesystems, such as ext2, ext3, ext4, xfs, vfatgdisk
and parted
with GPTfdisk
, gdisk
, parted
, mkfs
, mkswap
du
, df
, fsck
, e2fsck
, mke2fs
, debugfs
, dumpe2fs
, tune2fs
, xfs tools (such as xfs_metadump
and xfs_info
)/etc/fstab
, /media
, mount
, umount
quota
, edquota
, repquota
, quotaon
chmod
, umask
, chown
, chgrp
ln,
ls
find
, locate
, updatedb
, whereis
, which
, type
, /etc/updatedb.conf
The 102-400 exam comprises six topics (105–110), each of which contains three or four objectives. The six major topics are as follows:
Subject Area |
105 Shells, Scripting, and Data Management |
106 User Interfaces and Desktops |
107 Administrative Tasks |
108 Essential System Services |
109 Networking Fundamentals |
110 Security |
PATH
) at login or when spawning a new shellsource
, /etc/bash.bashrc
, /etc/profile
, env
, export
, set
, unset
, ∼/.bash_profile
, ∼/.bash_login
, ∼/.profile
, ∼/.bashrc
, ∼/.bash_logout
, function
, alias
, lists
sh
syntax (loops, tests)#!
) linefor
, while
, test
, if
, read
, seq
, exec
insert
, update
, select
, delete
, from
, where
, group by
, order by
, join
/etc/X11/xorg.conf
, xhost
, DISPLAY
, xwininfo
, xdpyinfo
, Xlightdm
, /etc/lightdm
gdm
), Orca, GOK, emacspeak
/etc/passwd
, /etc/shadow
, /etc/group
, /etc/skel
, chage
, getent
, groupadd
, groupdel
, groupmod
, passwd
, useradd
, userdel
, usermod
cron
and at
jobscron
and at
servicesanacron
/etc/cron.{d,daily,hourly,monthly,weekly}
, /etc/at.deny
, /etc/at.allow
, /etc/crontab
, /etc/cron.allow
, /etc/cron.deny
, /var/spool/cron/*
, crontab
, at
, atq
, atrm
, anacron
, /etc/anacrontab
/etc/timezone
, /etc/localtime
, /usr/share/zoneinfo
, environment variables (LC_*
, LC_ALL
, LANG
, TZ
), /usr/bin/locale
, tzselect
, tzconfig
, date
, iconv
, UTF-8, ISO-8859, ASCII, Unicodepool.ntp.org
servicentpq
command/usr/share/zoneinfo
, /etc/timezone
, /etc/localtime
, /etc/ntp.conf
, date
, hwclock
, ntpd
, ntpdate
, pool.ntp.org
syslog
daemonlogrotate
rsyslog
and syslog-ng
syslog.conf
, syslogd
, klogd
, /var/log
, logger
, logrotate
, /etc/logrotate.conf
, /etc/logrotate.d/
, journalctl
, /etc/system/journal.conf
, /var/log/journal/
∼/.forward
, sendmail emulation layer commands, newaliases
, mail
, mailq
, postfix, sendmail, exim, qmail/etc/cups
; lpd
legacy interface (lpr
, lprm
, lpq
)/etc/services
, IPv4, IPv6, subnetting, TCP, UDP, ICMP/etc/hostname
, /etc/hosts
, /etc/nsswitch.conf
, ifconfig
, ifup
, ifdown
, ip
, route
, ping
ifconfig
, ip
, ifup
, ifdown
, route
, host
, hostname
, dig
, netstat
, ping
, ping6
, traceroute
, traceroute6
, tracepath
, tracepath6
, netcat
/etc/hosts
, /etc/resolv.conf
, /etc/nsswitch.conf
, host
, dig
, getent
nmap
and netstat
to discover open ports on a systemsudo
configuration and usagefind
, passwd
, lsof
, nmap
, chage
, netstat
, sudo
, /etc/sudoers
, su
, usermod
, ulimit
, who
, w
, last
/etc/nologin
, /etc/passwd
, /etc/shadow
, /etc/xinetd.d/*
, /etc/xinetd.conf
, /etc/inetd.d/*
, /etc/inetd.conf
, /etc/inittab
, /etc/init.d/*
, /etc/hosts.allow
, /etc/hosts.deny
ssh
, ssh-keygen
, ssh-agent
, ssh-add
, ∼/.ssh/id_rsa
and id_rsa.pub
, ∼/.ssh/id_dsa
and id_dsa.pub
, /etc/ssh/ssh_host_rsa_key
and ssh_host_rsa_key.pub
, /etc/ssh/ssh_host_dsa_key
and ssh_host_dsa_key.pub
, ∼/.ssh/authorized_keys
, /etc/ssh_known_hosts
, gpg
, ∼/.gnupg/*