Ffirs.indd Ii 11/12/12 12:25 PM

3y ago
33 Views
2 Downloads
1.92 MB
30 Pages
Last View : 6d ago
Last Download : 3m ago
Upload by : Bria Koontz
Transcription

ffirs.indd ii11/12/12 12:25 PM

LPIC-1Linux Professional InstituteCertificationStudy GuideThird Editionffirs.indd i11/12/12 12:25 PM

ffirs.indd ii11/12/12 12:25 PM

LPIC-1Linux Professional InstituteCertificationStudy GuideThird EditionRoderick W. SmithJohn Wiley & Sons, Inc.ffirs.indd iii11/12/12 12:25 PM

Senior Acquisitions Editor: Jeff KellumDevelopment Editor: Alexa MurphyTechnical Editors: Ross Brunson and Kevin Glendenning, FOSSter.comProduction Editor: Eric CharbonneauCopy Editor: Kim WimpsettEditorial Manager: Pete GaughanProduction Manager: Tim TateVice President and Executive Group Publisher: Richard SwadleyVice President and Publisher: Neil EddeMedia Project Manager 1: Laura Moss-HollisterMedia Associate Producer: Doug KuhnMedia Quality Assurance: Josh FrankBook Designer: Judy FungProofreader: Candace CunninghamIndexer: Ted LauxProject Coordinator, Cover: Katherine CrockerCover Designer: Ryan SneedCopyright 2013 by John Wiley & Sons, Inc., Indianapolis, IndianaPublished simultaneously in CanadaISBN: 978-1-118-49563-6ISBN: 978-1-118-52648-4 (ebk.)ISBN: 978-1-118-57047-0 (ebk.)ISBN: 978-1-118-57055-5 (ebk.)No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form orby any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permittedunder 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 CopyrightClearance 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 atwww.wiley.com/go/permissions.Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warrantieswith 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 becreated or extended by sales or promotional materials. The advice and strategies contained herein may notbe suitable for every situation. This work is sold with the understanding that the publisher is not engaged inrendering legal, accounting, or other professional services. If professional assistance is required, the servicesof a competent professional person should be sought. Neither the publisher nor the author shall be liable fordamages arising herefrom. The fact that an organization or Web site is referred to in this work as a citationand/or a potential source of further information does not mean that the author or the publisher endorsesthe 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 disappearedbetween 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 contactour Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 orfax (317) 572-4002.Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some materialincluded 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, youmay download this material at http://booksupport.wiley.com. For more information about Wileyproducts, visit www.wiley.com.Library of Congress Control Number: 2012951869TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks ofJohn Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be usedwithout written permission. 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.10 9 8 7 6 5 4 3 2 1ffirs.indd iv11/12/12 12:25 PM

Dear Reader,Thank you for choosing LPIC-1: Linux Professional Institute Certification Study Guide,Third Edition. This book is part of a family of premium-quality Sybex books, all of whichare written by outstanding authors who combine practical experience with a gift forteaching.Sybex was founded in 1976. More than 30 years later, we’re still committed to producingconsistently exceptional books. With each of our titles, we’re working hard to set a newstandard for the industry. From the paper we print on to the authors we work with, ourgoal is to bring you the best books available.I hope you see all that reflected in these pages. I’d be very interested to hear yourcomments and get your feedback on how we’re doing. Feel free to let me know what youthink about this or any other Sybex book by sending me an email at nedde@wiley.com. If youthink you’ve found a technical error in this book, please visit http://sybex.custhelp.com.Customer feedback is critical to our efforts at Sybex.Best regards,Neil EddeVice President and PublisherSybex, an Imprint of Wileyffirs.indd v11/12/12 12:25 PM

ffirs.indd vi11/12/12 12:25 PM

AcknowledgmentsAlthough this book bears my name as author, many other people contributed to itscreation. Without their help, this book wouldn’t exist, or at best would exist in a lesserform. Jeff Kellum was the acquisitions editor and so helped get the book started. AlexaMurphy, the developmental editor, and Eric Charbonneau, the production editor, oversawthe book as it progressed through all its stages. Ross Brunson and Kevin Glendenningwere the technical editors who checked the text for technical errors and omissions — butany mistakes that remain are my own. Kim Wimpsett, the copy editor, helped keep thetext grammatical and understandable. The proofreader, Candace Cunningham, checkedthe text for typos. I’d also like to thank Neil Salkind and others at Studio B, who helpedconnect me with Wiley to write this book.ffirs.indd vii11/12/12 12:25 PM

ffirs.indd viii11/12/12 12:25 PM

About the AuthorRoderick W. Smith is a Linux consultant and author. He has written more than 20 bookson Linux, FreeBSD, and computer networking, including Linux Essentials, the LPIC-2Study Guide, and Linux Administrator Street Smarts (all from Sybex). He can be reachedat rodsmith@rodsbooks.com.ffirs.indd ix11/12/12 12:25 PM

ffirs.indd x11/12/12 12:25 PM

Contents at a GlanceIntroductionxxiiiExam Objectivesxxix- Exam 101 Objectivesxxix- Exam 102 ObjectivesxxxvAssessment TestxliAnswers to the Assessment TestPart IExam 1011Chapter 1Exploring Linux Command-Line Tools3Chapter 2Managing SoftwareChapter 3Configuring Hardware105Chapter 4Managing Files175Chapter 5Booting Linux and Editing Files223Part IIExam 102Chapter 6Configuring the X Window System,Localization, and Printing267Chapter 7Administering the System329Chapter 8Configuring Basic Networking381Chapter 9Writing Scripts, Configuring Email, and Using Databases425Chapter 10Securing Your System473Appendix AAnswers to Review Questions517Appendix BAbout the Additional Study Tools553Indexffirs.indd xixlviii4526555711/12/12 12:25 PM

ffirs.indd xii11/12/12 12:25 PM

ContentsIntroductionxxiiiExam Objectivesxxix- Exam 101 Objectivesxxix- Exam 102 ObjectivesxxxvAssessment TestxliAnswers to the Assessment TestPart IChapterExam 1011Exploring Linux Command-Line ToolsUnderstanding Command-Line BasicsExploring Your Linux Shell OptionsUsing a ShellExploring Shell ConfigurationUsing Environment VariablesGetting HelpUsing Streams, Redirection, and PipesExploring Types of StreamsRedirecting Input and OutputPiping Data Between ProgramsGenerating Command LinesProcessing Text Using FiltersFile-Combining CommandsFile-Transforming CommandsFile-Formatting CommandsFile-Viewing CommandsFile-Summarizing CommandsUsing Regular ExpressionsUnderstanding Regular ExpressionsUsing grepUsing sedSummaryExam EssentialsReview Questionsftoc.indd 537383911/12/12 12:26 PM

xivChapterChapterContents23Managing Software45Package ConceptsUsing RPMRPM Distributions and ConventionsThe rpm Command SetExtracting Data from RPMsUsing YumRPM and Yum Configuration FilesRPM Compared to Other Package FormatsUsing Debian PackagesDebian Distributions and ConventionsThe dpkg Command SetUsing apt-cacheUsing apt-getUsing dselect, aptitude, and SynapticReconfiguring PackagesDebian Packages Compared to Other Package FormatsConfiguring Debian Package ToolsConverting Between Package FormatsPackage Dependencies and ConflictsReal and Imagined Package Dependency ProblemsWorkarounds for Package Dependency ProblemsStartup Script ProblemsManaging Shared LibrariesLibrary PrinciplesLocating Library FilesLibrary Management CommandsManaging ProcessesUnderstanding the Kernel: The First ProcessExamining Process ListsUnderstanding Foreground and BackgroundProcessesManaging Process PrioritiesKilling ProcessesSummaryExam EssentialsReview 67879798183858586Configuring HardwareConfiguring the Firmware and Core HardwareUnderstanding the Role of the FirmwareIRQsI/O AddressesDMA Addressesftoc.indd xiv92939496969810510610611011311411/12/12 12:26 PM

ContentsChapterftoc.indd xv4xvBoot Disks and Geometry SettingsColdplug and Hotplug DevicesConfiguring Expansion CardsConfiguring PCI CardsLearning about Kernel ModulesLoading Kernel ModulesRemoving Kernel ModulesConfiguring USB DevicesUSB BasicsLinux USB DriversUSB Manager ApplicationsConfiguring Hard DisksConfiguring PATA DisksConfiguring SATA DisksConfiguring SCSI DisksConfiguring External DisksDesigning a Hard Disk LayoutWhy Partition?Understanding Partitioning SystemsAn Alternative to Partitions: LVMMount PointsCommon Partitions and Filesystem LayoutsCreating Partitions and FilesystemsPartitioning a DiskPreparing a Partition for UseMaintaining Filesystem HealthTuning FilesystemsMaintaining a JournalChecking FilesystemsMonitoring Disk UseMounting and Unmounting FilesystemsTemporarily Mounting or Unmounting FilesystemsPermanently Mounting FilesystemsSummaryExam EssentialsReview 58159164166167169Managing Files175Using File Management CommandsFile Naming and Wildcard Expansion RulesFile CommandsFile Archiving CommandsManaging LinksDirectory Commands17617617818319019111/12/12 12:26 PM

xviContentsManaging File OwnershipAssessing File OwnershipChanging a File’s OwnerChanging a File’s GroupControlling Access to FilesUnderstanding PermissionsChanging a File’s ModeSetting the Default Mode and GroupChanging File AttributesManaging Disk QuotasEnabling Quota SupportSetting Quotas for UsersLocating FilesThe FHSTools for Locating FilesSummaryExam EssentialsReview QuestionsChapter5Booting Linux and Editing FilesInstalling Boot LoadersBoot Loader PrinciplesUsing GRUB Legacy as the Boot LoaderUsing GRUB 2 as the Boot LoaderUsing Alternative Boot LoadersUnderstanding the Boot ProcessExtracting Information about the Boot ProcessLocating and Interpreting Boot MessagesThe Boot ProcessDealing with Runlevels and the Initialization ProcessRunlevel FunctionsIdentifying the Services in a RunlevelManaging Runlevel ServicesChecking Your RunlevelChanging Runlevels on a Running SystemUsing Alternative Boot SystemsConfiguring UpstartUsing systemdEditing Files with ViUnderstanding Vi ModesExploring Basic Text-Editing ProceduresSaving ChangesSummaryExam EssentialsReview Questionsftoc.indd 4524624924925125225225325625625725911/12/12 12:26 PM

ContentsPart IIChapterChapter67Exam 102265Configuring the X Window System,Localization, and Printing267Configuring Basic X FeaturesX Server Options for LinuxMethods of Configuring XX Configuration OptionsObtaining X Display InformationConfiguring X FontsFont Technologies and FormatsConfiguring X Core FontsConfiguring a Font ServerConfiguring Xft FontsManaging GUI LoginsThe X GUI Login SystemRunning an XDMCP ServerConfiguring an XDMCP ServerUsing X for Remote AccessX Client-Server PrinciplesUsing Remote X ClientsX AccessibilityKeyboard and Mouse Accessibility IssuesScreen Display SettingsUsing Additional Assistive TechnologiesConfiguring Localization and InternationalizationSetting Your Time ZoneQuerying and Setting Your LocaleConfiguring PrintingConceptualizing the Linux Printing ArchitectureUnderstanding PostScript and GhostscriptRunning a Printing SystemConfiguring CUPSMonitoring and Controlling the Print QueueSummaryExam EssentialsReview 22322324Administering the SystemManaging Users and GroupsUnderstanding Users and GroupsConfiguring User AccountsConfiguring GroupsTuning User and System EnvironmentsUsing System Log Filesftoc.indd xviixvii32933033033334434834911/12/12 12:26 PM

xviiiContentsUnderstanding syslogdSetting Logging OptionsManually Logging DataRotating Log FilesReviewing Log File ContentsMaintaining the System TimeLinux Time ConceptsManually Setting the TimeUsing NTPRunning Jobs in the FutureUnderstanding the Role of cronCreating System cron JobsCreating User cron JobsUsing anacronUsing atSummaryExam EssentialsReview QuestionsChapterftoc.indd 3374375376Configuring Basic Networking381Understanding TCP/IP NetworkingKnowing the Basic Functions of Network HardwareInvestigating Types of Network HardwareUnderstanding Network PacketsUnderstanding Network Protocol StacksKnowing TCP/IP Protocol TypesUnderstanding Network AddressingUsing Network AddressesResolving HostnamesNetwork PortsConfiguring Linux for a Local NetworkNetwork Hardware ConfigurationConfiguring with DHCPConfiguring with a Static IP AddressConfiguring RoutingUsing GUI Configuration ToolsUsing the ifup and ifdown CommandsConfiguring HostnamesDiagnosing Network ConnectionsTesting Basic ConnectivityTracing a RouteChecking Network StatusExamining Raw Network TrafficUsing Additional 40840840941141241241341441511/12/12 12:26 PM

ContentsSummaryExam EssentialsReview QuestionsChapterChapterftoc.indd xix910Writing Scripts, Configuring Email,and Using Databasesxix418418420425Managing the Shell EnvironmentReviewing Environment VariablesUnderstanding Common Environment VariablesUsing AliasesModifying Shell Configuration FilesWriting ScriptsBeginning a Shell ScriptUsing CommandsUsing VariablesUsing Conditional ExpressionsUsing LoopsUsing FunctionsManaging EmailUnderstanding EmailChoosing Email SoftwareWorking with EmailSecuring Your Email ServerManaging Data with SQLPicking a SQL PackageUnderstanding SQL BasicsUsing MySQLSummaryExam EssentialsReview 5447448452453453454456465465467Securing Your System473Administering Network SecurityUsing Super Server RestrictionsDisabling Unused ServersAdministering Local SecuritySecuring PasswordsLimiting root AccessSetting Login, Process, and Memory LimitsLocating SUID/SGID FilesConfiguring SSHSSH BasicsSetting SSH Options for Your ComputerSSH Security 11/12/12 12:26 PM

ContentsxxAppendixAppendixABUsing GPGGenerating KeysImporting KeysRevoking a KeyEncrypting and Decrypting DataSigning Messages and Verifying SignaturesSummaryExam EssentialsReview Questions506506507508508509510510512Answers to Review Questions517Chapter 1: Exploring Linux Command-Line ToolsChapter 2: Managing SoftwareChapter 3: Configuring HardwareChapter 4: Managing FilesChapter 5: Booting Linux and Editing FilesChapter 6: Configuring the X Window System,Localization, and PrintingChapter 7: Administering the SystemChapter 8: Configuring Basic NetworkingChapter 9: Writing Scripts, Configuring Email, andUsing DatabasesChapter 10: Securing Your System518521524528531About the Additional Study ToolsAdditional Study ToolsSybex Test EngineElectronic FlashcardsPDF of Glossary of TermsAdobe ReaderSystem RequirementsUsing the Study ToolsTroubleshootingCustomer CareIndexftoc.indd 11/12/12 12:26 PM

Table of Exercisesftoc.indd xxiExercise1.1Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Exercise2.1Managing Packages Using RPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Exercise2.2Managing Debian Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68Exercise3.1Creating Filesystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146Exercise4.1Modifying Ownership and Permissions. . . . . . . . . . . . . . . . . . . . . . . . . . . 201Exercise4.2Locating Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215Exercise5.1Changing Runlevels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248Exercise6.1Printing with Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321Exercise7.1Creating User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338Exercise7.2Creating User cron Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370Exercise8.1Practice Resolving Hostnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396Exercise8.2Configuring a Network Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409Exercise9.1Changing Your bash Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430Exercise9.2Creating a Simple Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444Exercise9.3Creating a SQL Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460Exercise10.1Monitor Network Port Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48211/12/12 12:26 PM

flast.indd xxii11/12/12 12:26 PM

IntroductionWhy 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-sized server field, and it’san increasingly viable platform for workstation and desktop use as well. By understandingLinux, you’ll increase your standing in the job market. Even if you already know Windowsor Mac OS and your employer uses these systems exclusively, understanding Linux willgive you an edge when you’re looking for a new job or you’re looking for a promotion. Forinstance, this knowledge will help you make an informed decision about if and when youshould deploy Linux.The Linux Professional Institute (LPI) has developed its LPI-1 certification as an introductory certification for people who want to enter careers involving Linux. The exam ismeant 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 and 102) updatedin 2012. Because these exams cover basic Linux installation, configuration, maintenance,applications, networking, and security, those are the topics that are emphasized in thisbook. You’ll learn enough to get a Linux system up and running and to configure it formany common tasks. Even after you’ve taken and passed the LPIC-1 exams, this bookshould remain a useful reference.What Is Linux?Linux is a clone of the Unix operating syst

ffirs.indd i 11/12/12 12:25 PM. ffirs.indd ii 11/12/12 12:25 PM. LPIC-1 Linux Professional Institute Certification Study Guide Third Edition Roderick W. Smith John Wiley & Sons, Inc. ffirs.indd iii 11/12/12 12:25 PM. Senior Acquisitions Editor: Jeff Kellum Development Editor: Alexa Murphy

Related Documents:

FFIRS.indd ii 6/2/11 12:34:44 PM. Corporate Governance FFIRS.indd i 6/2/11 12:34:44 PM. FFIRS.indd ii 6/2/11 12:34:44 PM. Corporate Governance Fifth Edition Robert A. G. Monks and Nell Minow FFIRS.indd iii 6/2/11 12:34:44 PM. This edition fi rst published in 2011

ffirs.indd i 11/12/12 12:25 PM. ffirs.indd ii 11/12/12 12:25 PM. LPIC-1 Linux Professional Institute Certification Study Guide Third Edition Roderick W. Smith John Wiley & Sons, Inc. ffirs.indd iii 11/12/12 12:25 PM. Senior Acquisitions Editor: Jeff Kellum Development Editor: Alexa Murphy

ffirs.indd ii 2/11/09 9:12:06 AM. SCJP Sun Certified Programmer . ffirs.indd vii 2/11/09 9:12:08 AM. ffirs.indd viii 2/11/09 9:12:08 AM. Contents at a Glance Introduction xvii Assessment Test xxiv Chapter 1 Fundamentals 1 Chapter 2 Declarations, Initialization, and Scoping 77

ffirs.indd ii 8/9/12 2:02 PM. . ffirs.indd xi 8/9/12 2:02 PM. ffirs.indd xii 8/9/12 2:02 PM. . Understanding the Structure of perldoc 11 Getting Started with perldoc 11 Using Tutorials and FAQs 12 Using the perldoc -f function 14 Using a Terminal Window 14 Using the Command Line 15 Creating a Work Directory 16

ffirs.indd ii 7/24/09 8:52:41 PM. ffirs.indd vi 7/24/09 8:52:44 PM. vii Contents . Chapter 11 Mr. Outside versus Mr. Inside versus the SEC 145 ftoc.indd vii 7/24/09 8:52:58 PM. viii CONTENTS Chapter 12 Life inside the Madoff Piggy Bank, Flashing the Plastic, and Losing the Farm 159 Chapter 13 A Family (and Sometimes an Offi ce) .

ffirs.indd ii 29/12/11 2:41 PM. Pass port to Profi ts fffirs.indd ifirs.indd i 119/01/12 2:38 PM9/01/12 2:38 PM. fffirs.indd iifirs.indd ii 119/01/12 2:38 PM9/01/12 2:38 PM. Passport to Profi ts Why the Next Investment Windfalls Will Be Found Abroad and How to Grab Your Share Revised and Updated .

ffirs.indd ii 1/6/11 10:36:33 AM. For my wife— a heroic woman whose patience and wisdom are without equal. ffirs.indd iii 1/6/11 10:36:34 AM. ffirs.indd iv 1/6/11 10:36:34 AM. v Contents Preface vii Experience Level Rating System (EL) ix Chapter 1 The Big Business of Penny Stocks 1

fructose, de la gélatine alimentaire, des arômes plus un conservateur du fruit – sorbate de potassium –, un colorant – E120 –, et deux édulco-rants – aspartame et acésulfame K. Ces quatre derniers éléments relèvent de la famille des additifs. Ils fleuris-sent sur la liste des ingrédients des spécialités laitières allégées .