Tải bản đầy đủ (.pdf) (1,371 trang)

OReilly linux cookbook nov 2004 ISBN 0596006403

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (4.61 MB, 1,371 trang )

LinuxCookbook

ByCarlaSchroder
Tableof

Contents Publisher :O'Reilly
• Index
PubDate :November2004
ISBN :0-596-00640-3
• Reviews
Pages :580
Reader




Reviews
• Errata
• Academic
Cooking
with

Linux,
Part2
Cooking
with

Linux,
Part1




Linuxinformationcanbefoundscatteredinmanpages,texinfo
files,andsourcecodecomments,butthebestsourceisthe
expertswhohavebuiltupaworkingknowledgeofmanaging
Linuxsystems.TheLinuxCookbook'stestedtechniquesdistill
yearsofhard-wonexperienceintopracticalcut-and-paste
solutionstoeverydayLinuxdilemmas.Usejustonerecipefrom
thiscollectionofreal-worldsolutions,andthehoursoftedious
trial-and-errorsavedwillmorethanpayforthecostofthebook.
It'smorethanatime-saver;it'sasanitysaver.





Tableof

Contents
• Index
• Reviews
Reader

Reviews
• Errata
• Academic
Cooking
with

Linux,
Part2

Cooking
with

Linux,
Part1

LinuxCookbook
ByCarlaSchroder

Publisher :O'Reilly
PubDate :November2004
ISBN :0-596-00640-3
Pages :580


Copyright

Dedication

Preface
RecipeAudience

RecipeWhatIsIncluded/Omitted




RecipePlatforms





RecipeDownloadsandFeedback

RecipeConventions
RecipeCommentsandQuestions





RecipeAcknowledgments

Chapter1.FindingDocumentation
Section1.1.Introduction




Recipe1.2.UnderstandingmanPages




Recipe1.4.FindingLostmanPages




Recipe1.6.ConfiguringYourmanpath





Recipe1.8.PrintingmanPages




Recipe1.10.PrintingSelectedmanorinfoPages

Recipe1.3.FindingAppropriatemanPages
Recipe1.5.ReadingmanPagesWithoutamanViewer
Recipe1.7.UsinginfoPages
Recipe1.9.PrintinginfoPages
Recipe1.11.FindingAlloftheDocumentationforaProgram


Chapter2.InstallingandManagingSoftwareonRPM-BasedSystems
Section2.1.Introduction

Recipe2.2.InstallingRPMs




Recipe2.3.UpgradingRPMs





Recipe2.5.CollectingInformationonInstalledRPMs




Recipe2.7.FindingRecentlyInstalledRPMs




Recipe2.9.TrackingSource-BuiltLibrariesonanRPM-BasedSystem




Recipe2.11.InstallingSourceRPMs



Recipe2.13.InstallingYum




Recipe2.14.ConfiguringYum





Recipe2.16.RemovingPackageswithYum

Recipe2.4.RemovingRPMs
Recipe2.6.CollectingInformationfromRPMsThatAreNotInstalled
Recipe2.8.RebuildingtheRPMDatabase
Recipe2.10.FixingRPMInstallationProblems
Recipe2.12.CustomizingBuildOptionsinaSourceRPM

Recipe2.15.InstallingandUpgradingPackageswithYum
Recipe2.17.GettingInformationonInstalledPackageswithYum

Recipe2.18.MaintainingYum


Chapter3.InstallingandManagingSoftwareonDebian-BasedSystems
Section3.1.Introduction




Recipe3.2.GettingSoftwareforaDebianSystem




Recipe3.4.InstallingPackagesonDebian-BasedSystems



Recipe3.6.InstallingfromSourcesonaDebianSystem


Recipe3.3.InstallingDebianPackagesfromCD-ROM
Recipe3.5.RemovingPackagesfromaDebianSystem




Recipe3.7.UpgradingPackagesonDebian




Recipe3.8.UpgradingaDebianSystem




Recipe3.10.RunningaMixedDebianSystem




Recipe3.12.MaintainingtheDebianPackageCache




Recipe3.14.BuildingaLocalDebianRepository

Recipe3.9.UpgradingtoaNewerDebianRelease

Recipe3.11.FindingOutWhatIsInstalledonaDebianSystem
Recipe3.13.ResolvingDebianDependencyConflicts
Recipe3.15.SelectingPackageMirrorsforapt-proxy.conf

Recipe3.16.AddingYourExistingPackageCachetoapt-proxy.conf


Chapter4.InstallingProgramsfromSourceCode
Section4.1.Introduction




Recipe4.2.PreparingYourSystemforCompilingProgramsfromSources




Recipe4.4.InstallingProgramsfromSourceCode

Recipe4.3.GeneratingaListofFilesfromaSourceInstallforEasyUninstalls
Recipe4.5.UsingCheckInstalltoCreatePackagesfromSources


Chapter5.DiscoveringHardwarefromOutsidetheBox
Section5.1.Introduction

Recipe5.2.DetectingHardwarewithlspci





Recipe5.3.UsingdmesgtoCollectHardwareInformation




Recipe5.5.ViewingDrivePartitionswithfdisk

Recipe5.4.GettingLiveHardwareSnapshotswith/proc
Recipe5.6.CalculatingHardDriveCapacity


Chapter6.EditingTextFileswithJOEandVim
Section6.1.Introduction

Recipe6.2.FindingJOECommands




Recipe6.3.CustomizingJOE




Recipe6.5.CopyingBetweenTwoFilesinJOE





Recipe6.7.SelectingTextVerticallyinJOE




Recipe6.9.LearningVimQuickly




Recipe6.11.MappingCommandstoKeystrokes




Recipe6.13.NavigatingQuicklyinVimwithMarks



Recipe6.15.SettingYourDefaultEditor

Recipe6.4.OrganizingJOE'sPreferencesinaSeparateFile
Recipe6.6.SearchingandReplacinginJOE
Recipe6.8.FindingandOpeningFilesinJOE
Recipe6.10.CreatingAutotextwithVim'sAbbreviations
Recipe6.12.CustomizingVim
Recipe6.14.PickingUpWhereYouLeftOff:UsingVim'sSessions




Recipe6.16.DiscoveringVim'sCompile-TimeOptions

Chapter7.StartingandStoppingLinux



Section7.1.Introduction




Recipe7.3.ChangingtheDefaultRunlevel




Recipe7.5.ManagingDebian'sRunlevels




Recipe7.7.ManagingRedHat'sRunlevels




Recipe7.9.ManuallyStartingandStoppingServices





Recipe7.11.DisablingorLimitingAccesstoCtrl-Alt-Delete

Recipe7.2.ChangingRunlevelsAfterBootup
Recipe7.4.StartingandStoppingX
Recipe7.6.CreatingBothTextandGraphicalLoginRunlevelsonDebian
Recipe7.8.ManuallyConfiguringStartupServices
Recipe7.10.ShuttingDownorRebootingLinux
Recipe7.12.ShuttingDownAutomatically


Chapter8.ManagingUsersandGroups
Section8.1.Introduction

Recipe8.2.SortingHumanUsersfromSystemUsers




Recipe8.3.FindingaUser'sUIDandGID




Recipe8.5.AddingUserswithadduser





Recipe8.7.DeletingaUser




Recipe8.9.DisablingAccounts




Recipe8.11.AddingGroupswithgroupadd




Recipe8.13.CreatingaSystemUser




Recipe8.15.AddingandDeletingGroupMembers




Recipe8.17.AddingNewUsersinBatches





Recipe8.19.AddingBatchesofUserstoGroups




Recipe8.21.GrantingLimitedRootlyPowerswithsudo

Recipe8.4.AddingUserswithuseradd
Recipe8.6.ModifyingUserAccounts
Recipe8.8.KillingUserProcessestheEasy,FunWay
Recipe8.10.ManagingPasswords
Recipe8.12.DeletingGroupswithgroupdel
Recipe8.14.CreatingSystemGroupswithaddgroup
Recipe8.16.CheckingPasswordFileIntegrity
Recipe8.18.ChangingMassesofPasswords
Recipe8.20.UsingsutoBeRootTemporarily
Recipe8.22.UsingDiskQuotas


Chapter9.ManagingFilesandPartitions
Section9.1.Introduction





Recipe9.2.SettingFileandDirectoryPermissionswithchmod'sNumericNotation




Recipe9.3.DoingBatchOperationswithchmod



Recipe9.4.SettingFileandDirectoryPermissionswithchmod'sSymbolic
Notation
Recipe9.5.SettingFileOwnershipwithchown




Recipe9.6.DoingBatchOperationswithchown




Recipe9.7.SettingUpaSharedDirectorywithsetgidandtheStickyBit




Recipe9.9.MountingandUnmountingRemovableDisks




Recipe9.11.MountingandUnmountingFilesystemsonHardDrives





Recipe9.13.CreatingFilesandDirectories




Recipe9.15.Copying,Moving,andRenamingFilesandDirectories

Recipe9.8.SettingPermissionsDefaultswithumask
Recipe9.10.ConfiguringFilesystemMountswith/etc/fstab
Recipe9.12.FindingDeviceNamesformountandfstab
Recipe9.14.DeletingFilesandDirectories
Recipe9.16.CreatingLinuxDiskPartitionswithfdisk

Recipe9.17.CreatingaFilesystemonaNewPartition


Chapter10.Patching,Customizing,andUpgradingKernels
Section10.1.Introduction




Recipe10.2.AddingNewFeaturestothe2.4Kernel




Recipe10.4.UpgradingtotheLatestStableVersionofthe2.4Kernel





Recipe10.6.AddingNewFeaturestothe2.6Kernel




Recipe10.8.PatchingaKernel




Recipe10.10.CreatinganinitrdImage

Recipe10.3.SlimmingaStock2.4Kernel
Recipe10.5.Buildingthe2.6Kernel
Recipe10.7.AddingaNewLoadableKernelModule
Recipe10.9.RemovingaKernelPatch
Recipe10.11.CreatingaBootDiskonDebian

Recipe10.12.CreatingaBootDiskonRedHat


Chapter11.CDandDVDRecording
Section11.1.Introduction





Recipe11.2.FindingtheSCSIAddressforCDandDVDWriters




Recipe11.4.MakingaDataCDforGeneralDistribution




Recipe11.6.CopyingaCDorDVD




Recipe11.8.RecordingaMultisessionDataCD

Recipe11.3.EnablingSCSIEmulationforIDE/AtapiCDandDVDWriters
Recipe11.5.BuildingFileTreesonaDataCD
Recipe11.7.ErasingaCD-RW
Recipe11.9.CreatingaBootableCD






Recipe11.10.SpanningaLargeFileoverSeveralCDs
Recipe11.11.RecordingDataDVDs


Recipe11.12.RecordinganAudioCDforStandardCDPlayers


Chapter12.ManagingtheBootloaderandMulti-Booting
Section12.1.Introduction




Recipe12.2.MigratingfromLILOtoGRUB




Recipe12.4.InstallingGRUBwithgrub-install




Recipe12.6.AddingMoreLinuxestoaMultibootSystem




Recipe12.8.ConfiguringtheBootPartition




Recipe12.10.Customizingmenu.lst





Recipe12.12.AddingWindowsNT/2000/XPtoaMultibootSystem




Recipe12.14.ProtectingSystemFileswithaGRUBPassword




Recipe12.16.CreatingaGRUBSplashImage




Recipe12.18.MultibootingLinuxeswithLILO




Recipe12.20.CreatingaLILOBootDiskette

Recipe12.3.InstallingGRUBWithoutaFloppyDisk
Recipe12.5.PreparingaSystemforMultibootingLinux
Recipe12.7.DiscoveringBootParametersfromtheGRUBCommandShell
Recipe12.9.CreatingtheGRUBBootMenu

Recipe12.11.AddingWindows95/98/MEtoaLinuxSystem
Recipe12.13.RestoringGRUBtotheMBRwithaKnoppixCD
Recipe12.15.LockingOutUsersfromIndividualGRUBMenuEntries
Recipe12.17.BootingLinuxwithLILO
Recipe12.19.MultibootingWindowsandLinuxwithLILO
Recipe12.21.Password-ProtectingLILO

Recipe12.22.BackingUptheMBR


Chapter13.SystemRescueandRecoverywithKnoppix
Section13.1.Introduction




Recipe13.2.BootingKnoppix




Recipe13.4.SavingYourKnoppixConfigurationonaUSBMemoryStick




Recipe13.6.CopyingFilestoAnotherLinuxPC





Recipe13.8.CopyingFilestoaCD-R/RW




Recipe13.10.InstallingSoftwarefromKnoppix

Recipe13.3.CreatingaKnoppixBootDiskette
Recipe13.5.CreatingaPersistent,EncryptedKnoppixHomeDirectory
Recipe13.7.CopyingFilestoaSambaShare
Recipe13.9.EditingConfigurationFilesfromKnoppix
Recipe13.11.RepairingaLostRootPassword




Recipe13.12.InstallingKnoppixtoaHardDisk

Recipe13.13.Virus-ScanningWindowsPCswithKnoppix


Chapter14.PrintingwithCUPS



Section14.1.Introduction





Recipe14.3.ServingLinuxClients




Recipe14.5.ServingWindowsClientsWithoutSamba




Recipe14.7.BuildingaDedicatedCUPSPrinterServer




Recipe14.9.RestrictingUsersfromPrintersandClasses

Recipe14.2.InstallingaPrinteronaStandaloneLinuxPC
Recipe14.4.SharingaPrinterWithoutUsingNameResolution
Recipe14.6.SharingPrintersonaMixedLANwithSamba
Recipe14.8.DistributedPrintingwithClasses
Recipe14.10.Troubleshooting


Chapter15.ConfiguringVideoandManagingXWindows
Section15.1.Introduction

Recipe15.2.UsingBothXWindowsandConsoles





Recipe15.3.InstallingaNewVideoAdapter




Recipe15.5.Enabling3DHardwareAccelerationwithXFree86/DRI




Recipe15.7.ConfiguringaMultiheadDisplay




Recipe15.9.SettingaDefaultServerLayout




Recipe15.11.ChangingYourLoginDisplayManager

Recipe15.4.EditingXF86Config
Recipe15.6.Troubleshooting3DAccelerationProblems
Recipe15.8.ChoosingDifferentServerLayoutsatStartup
Recipe15.10.Configuringstartx
Recipe15.12.RunningDifferentWindowManagersSimultaneouslywithXnest



Chapter16.BackupandRecovery
Section16.1.Introduction

Recipe16.2.UsingrsyncforLocalFileTransfersandSynchronization




Recipe16.3.MakingSecureTransferswithrsyncandssh




Recipe16.5.SecuringrsyncModules




Recipe16.7.LaunchingthersyncDaemonatStartup




Recipe16.9.AutomatingrsyncoversshBackups





Recipe16.11.CustomizingFilepathsinrsync

Recipe16.4.BuildinganrsyncBackupServer
Recipe16.6.BuildinganAnonymousPublicrsyncServer
Recipe16.8.Fine-TuningFileSelection
Recipe16.10.Limitingrsync'sBandwidthRequirements
Recipe16.12.InstallingrsynconWindowsClients




Recipe16.13.CreatingaMessageoftheDayforrsync



Recipe16.14.CreatingaBootableSystemRestoreCDwithMondoRescue



Recipe16.15.VerifyingtheMondoBackup




Recipe16.16.CreatingaBootableSystemRestoreDVDwithMondoRescue




Recipe16.18.Usingthemindi-kernelfora"Sane"Backup


Recipe16.17.UsingMondoRescuetoCloneLinuxSystems
Recipe16.19.RestoringaSystemfromaMondoRescueDisk

Recipe16.20.RestoringSelectedFilesfromaMondoDisk


Chapter17.RemoteAccess
Section17.1.Introduction




Recipe17.2.SettingUpOpenSSHtheFirstTime




Recipe17.4.AuthenticatingViaPublicKeys




Recipe17.6.PasswordlessLoginswithssh-agent




Recipe17.8.PasswordlessLoginsforcronJobs





Recipe17.10.CustomizingtheBashPromptforssh




Recipe17.12.ConnectingfromaWindowsPC

Recipe17.3.GeneratingNewHostKeys
Recipe17.5.UsingMultipleKeyPairs
Recipe17.7.BetterPasswordlessLoginswithkeychain
Recipe17.9.ShuttingDownssh-agentAutomaticallyatLogout
Recipe17.11.TunnelingXoverSSH
Recipe17.13.SettingFilePermissionsonsshFiles


Chapter18.VersionControl
Section18.1.Introduction

Recipe18.2.BuildingaSimpleLocalRCSRepository



Recipe18.3.RetrievingOlderFileRevisionsfromRCS





Recipe18.4.ComparingFileVersionsinRCS




Recipe18.6.UsingCVSforaSingle-UserLocalRepository




Recipe18.8.DeletingFilesfromaCVSRepository




Recipe18.10.SharingaSingleRepositoryBetweenSeveralGroups




Recipe18.12.UpdatingYourWorkingFilesinCVS




Recipe18.14.BuildinganAnonymousRead-OnlyCVSRepositorywithPserver

Recipe18.5.ManagingSystemConfigurationFileswithRCS
Recipe18.7.AddingNewFilestoaCVSRepository
Recipe18.9.CreatingaSharedCVSRepository

Recipe18.11.AccessingaRemoteCVSRepository
Recipe18.13.RetrievingSpecificOlderRevisionsfromCVS
Recipe18.15.MirroringaCVSRepository




Recipe18.16.StoringBinaryFilesinCVS




Recipe18.17.CreatingReleaseSnapshotswithTags




Recipe18.19.CustomizingYourCVSEnvironment

Recipe18.18.CreatingStableandDevelopmentBranchesforaProject
Recipe18.20.CalculatingStorageSizeforaCVSRepository


Chapter19.KeepingTimewithNTP
Section19.1.Introduction

Recipe19.2.BuildingaLocalTimeServer





Recipe19.3.ConnectingtoaLocalTimeServer



Recipe19.5.DecidingWhichNTPPoolstoUse




Recipe19.6.ConnectingtoaTimeServerfromanIntermittentConnection

Recipe19.4.AddingAccessControls

Recipe19.7.SettingUpMultipleLocalTimeServers

Recipe19.8.UsingNTPKeysforAuthentication


Chapter20.BuildingaPostfixMailServer
Section20.1.Introduction




Recipe20.2.BuildingaPOP3MailServer





Recipe20.4.TestingtheSMTP/POP3MailServer




Recipe20.6.ReceivingInternetMail




Recipe20.8.InstallingCyrus-SASLonDebian




Recipe20.10.Usingsmtp-authtoAuthenticatePostfixtoAnotherServer




Recipe20.12.BuildinganIMAPMailServer




Recipe20.14.SharingIMAPFolders





Recipe20.16.CreatingaMailListwithcouriermlm




Recipe20.18.SquirrelingAroundwithWebmail

Recipe20.3.BuildingaPOP3MailServeronDebian
Recipe20.5.SendingInternetMail
Recipe20.7.InstallingCyrus-SASLforSMTPAuthorization
Recipe20.9.SettingUpsmtp-authtoAuthenticateUsers
Recipe20.11.ConfiguringaFullyQualifiedDomainName
Recipe20.13.ConnectingYourUsers
Recipe20.15.UsingPostfix'sVirtualMailboxDomains
Recipe20.17.AdministeringacouriermlmList
Recipe20.19.TableofSMTPResponseCodesandSMTPCommands


Chapter21.ManagingSpamandMalware
Section21.1.Introduction

Recipe21.2.BasicChecklist:PreparingtoBuildSpamMalwareDefenses




Recipe21.3.SafelyTestingNewUBEControlsinPostfix
Recipe21.4.BasicUBEConfigurationsforPostfix





Recipe21.5.CreatingWhitelists




Recipe21.6.UsingDNSBlackholeLists




Recipe21.8.SettingUpClamAnti-VirusonaPostfixServer

Recipe21.7.RejectingMessageswithAttachments
Recipe21.9.SettingUpSpamAssassinonPostfixwithAmavisd-new

Recipe21.10.SettingUpSpamAssassinWithoutAmavisd-new


Chapter22.RunninganApacheWebServer
Section22.1.Introduction




Recipe22.2.InstallingApache2.0fromSources





Recipe22.4.SettingApacheFilePermissionsandOwnership




Recipe22.6.SettingUpaSimplePublicWebServer




Recipe22.8.GivingUsersIndividualWebDirectories




Recipe22.10.HostingMultipleDomainswithApache




Recipe22.12.KeepingLANWebSitesOfftheInternet




Recipe22.14.Usingrobots.txttoControlWebCrawlers





Recipe22.16.MakingCustomErrorPages




Recipe22.18.MakingFull-LengthDirectoryIndexes




Recipe22.20.UsingFavicons

Recipe22.3.AddingNewModulesAfterInstallation
Recipe22.5.AccessingtheApacheUser'sManualLocally
Recipe22.7.RedirectingURLstoaNewDirectory
Recipe22.9.StartingApacheatBoot
Recipe22.11.UsingIndividualLogFilesforVirtualHosts
Recipe22.13.Password-ProtectingIndividualDirectories
Recipe22.15.BlockingObnoxiousVisitors
Recipe22.17.CustomizingApache'sDefaultErrorPages
Recipe22.19.UsingContentNegotiationtoDeliverPagesinDifferentLanguages
Recipe22.21.ViewingApacheAccessLogswithWebalizer


Chapter23.FileandPrinterSharing,andDomainAuthenticationwithSamba
Section23.1.Introduction

Recipe23.2.BuildingaSimpleAnonymousSambaFileServerforWindows





Recipe23.3.BuildingaWindows/LinuxPeerNetwork




Recipe23.5.AddingAuthenticationtoaSambaServer




Recipe23.7.ManagingSambaLoginsfromWindows95/98/ME



Recipe23.9.ControllingShareAccesswithAccessControlLists

Recipe23.4.EnablingFileSharingonWindowsPCs
Recipe23.6.Batch-ConvertingSystemUserstoSambaUsers
Recipe23.8.DealingwithWindowsEncryptedPasswordConfusion




Recipe23.10.CreatingPublicSharesforUsers





Recipe23.11.AccessingUsers'HomeDirectoriesinSamba




Recipe23.13.ConnectingWindows95/98/MEtoaSambaDomain



Recipe23.15.ConnectingWindowsXPClientstoaSambaDomain




Recipe23.16.EnablingRoamingProfiles



Recipe23.18.ConnectingLinuxClientstoSambaWorkgroupswithCommandLineTools
Recipe23.19.ConnectingLinuxClientstoaSambaDomainwithGUILAN
Browsers
Recipe23.20.ConnectingLinuxClientstoaSambaDomainwithCommand-Line
Tools
Recipe23.21.KeepingSambaandLinuxPasswordsinSync









Recipe23.12.BuildingaPrimaryDomainControllerwithSamba
Recipe23.14.ConnectingWindowsNT/2000ClientstoaSambaDomain

Recipe23.17.ConnectingLinuxClientstoaSambaFileServerorPeerNetwork

Recipe23.22.SharingLinuxPrinterswithWindows
Recipe23.23.SharingWindowsPrinterswithLinux
Recipe23.24.RunningWindowsApplicationsonLinuxwithCrossOverOffice


Chapter24.ManagingNameResolution
Section24.1.Introduction

Recipe24.2.EnablingLocalNameResolutionwithhostsFiles




Recipe24.3.SettingUpaDHCPServer




Recipe24.5.AddingStaticHoststodhcp





Recipe24.7.Installingdjbdns



Recipe24.9.RunningaLocalCachingNameServerwithdjbdns



Recipe24.10.ConfiguringLinuxandWindowsClientstoUseYourCachingDNS
Server
Recipe24.11.BuildingaPublicDNSServerwithtinydns




Recipe24.4.ConfiguringdhcpClients
Recipe24.6.RunningaPublicDNSServer
Recipe24.8.Movingtinydns'sanddnscache'sLogfiles

Recipe24.12.BuildingaPrivatetinydnsServer




Recipe24.13.EnablingSimpleLoadBalancingwithtinydns





Recipe24.15.RunningaLocalCachingNameServerwithBIND




Recipe24.17.CheckingSyntax




Recipe24.19.BuildingaBINDSecondaryServer

Recipe24.14.SynchronizingwithaSecondtinydnsServer
Recipe24.16.RunningaPrivateBINDDNSServer
Recipe24.18.ConfiguringaPublicBINDDNSServer
Recipe24.20.SimpleLoadBalancingwithBIND




Recipe24.21.TestingYourtinydnsServer

Recipe24.22.TestingandQueryingDNSServerswithdiganddnstrace


AppendixA.FindingLinuxDocumentation
RecipeA.1.LinuxDocumentationontheWeb

RecipeA.2.BooksandMagazines



AppendixB.OnlineReferences
RecipeB.1.HardwareWebSites







RecipeB.2.Usenet
AppendixC.MicrosoftFileTypes
AppendixD.InitScriptforCVSD
Colophon
Index


Copyright©2005O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
TheLinuxseriesdesignations,LinuxCookbook,imagesofthe
AmericanWest,andrelatedtradedressaretrademarksof

O'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.


Dedication
ToDawnMarie.
Duringthewritingofthisbook,shetilledthefields,trainedthe
horses,cookedthemeals,cleanedtheditches,andgraciously
fendedoffgenerousneighborsbearinglargezucchinis.No
authorcouldaskformore.Thankyoufor14greatyears;may
wehavemanymore.


Preface
So:you'rearelativelynewLinuxuser.You'vegotLinux
installed,you'vemanagedtologin,dosomewebbrowsing,
sendandreceiveemail,andnowwhat?Althoughyoucanhandle
someofthebasics,youfeellikeyou'reflyingblind:youknow
you'vegotlotsofreallypowerfulstuffatyourfingertips,orat
leastsoyourLinuxgurufriendtoldyou,buthowdoyoumakeit
dotricks?What'sthere,andhowdoesitwork?What'sthisthing
calledgrepthatthey'realwaystalkingabout?Howdoyou

Samba?Andwhere'sthe#$%^documentation?
TheLinux-Unixworldisabundantlydocumented.No,really!You
canalwaysfindananswer,ifyouknowwheretolook.The
problem,ofcourse,isknowingwheretolook.Thereareman
pages,infopages,READMEs,HTMLmanuals,andthecode
itself.Youdon'thavetobeaprogrammertounearthusefulbits
insourcecode,becausethecommentsoftentellyouwhatyou
needtoknow.
Therearethousandsuponthousandsofonlinecommunities,
one(ormore)surroundingnearlyeverybitofsoftwareinthe
Linuxuniverse.Nearlyeveryprogram,nomatterhowsmall,
hasitsownusermailinglist.EveryLinuxdistributionhasits
ownmailinglistsanduserforums.Thereareforumsandlists
andUsenetgroupsforeverycomputingsubjectunderthesun.
Andofcoursetherearebooksandmagazinesofevery
description.SotherealproblemwithLinuxdocumentationis
notthelackofit,butfindingthebitsyouneedwithouthaving
toembarkonalengthy,heroicquest.


Audience
Thisbookisaimedatfolkswhowanttoknowwhatbuttonto
push.Understandingtheunderlyingtheoryisuseful,butifyou
can'tmakethedarnthingwork,notveryhelpful.Soit'slighton
theoryandheavyonhow-to-make-this-go,withdetailed,stepby-stepinstructions.I'veincludedmanyreferencestoadditional
resources.
ReadersshouldhaveabitofLinuxexperience.Youdon'tneed
tobeaguru,butyoushouldhavesomefamiliaritywiththe
basicsofbootingupandshuttingdown,startingapplications,
Websurfing,andpokingaroundthefilesystem.Youshould

knowhowtofindandusethecommandline,aswellasworkin
agraphicalenvironment.YoushouldunderstandthatLinuxisa
truemulti-usersystem,andthatyouuseanordinary
unprivilegeduseraccountasmuchaspossible,andthatyou
onlyinvokerootwhenyoureallyneedto.
ThisbookassumesthatyouareinchargeofaPCorLAN,and
canacquirerootlypowerswhentheoccasioncallsforthem.You
mightbeapoweruserwhowantscompletecontrolofyour
Linuxbox,orahomeuserwhowantstorunapersonalwebor
mailserver,orsetupasmallLAN.PerhapsyouareaWindows
systemadmininstratorwhohassuddenlybeenorderedto"do
Linux,"andyouneedtoknowhowtosetupLinuxserversfor
Windowsclients.MaybeyouwanttoaddLinuxserverstoan
existingnetwork.YoumightneedtointegrateLinuxand
WindowsdesktopusersonaLAN.
OryouhavenoneedforWindowsatall,andjustwanttolearn
Linuxsystemadministration.


WhatIsIncluded/Omitted
Giventhattherearethousandsofsoftwarepackagestochoose
from,almostallofwhichdosomethinguseful,itwasaforegone
conclusionthatIcouldn'tcovereverything.Orevenmostof
everything.Idecidedwhattoinclude,andwhattoleaveout,
basedonmyopinionofwhatafundamentalLinuxskillset
shouldinclude.(Youmayhavedifferentideas.)Iincluded
programsthatIconsidertobethebest-of-breed,suchdjbdns,
GRUB,Apache2,vim,andPostfix.AndIdidn'tneglectold
standbyslikeLILOandBIND.
You'llfindsomeexcellent,innovativescriptsfor:

Addingusersinbatches
Changingpasswordsinbatches
Findingalltheinstalleddocumentationforaprogram
FindingorphanedlibrariesonRPM-basedsystems,and
addingthemtotheRPMdatabase
Idecidednottoincludeproductivityanddesktopapplications,
likeOpenOffice,KMail,Firefox,Konqueror,theGimp,GnuCash,
andsoforth.Thisbookisaboutbuildinginfrastructure.Once
youmasterthefundamentalsofrunningandmaintaininga
Linuxsystem,itwilltakeyouanywhereyouwanttogo.


Platforms
TherearemoreLinuxdistributionsthancanbecounted;there
areliterallythousandsofdistributions,manyofwhichare
peculiartoacompany,acampus,orevenacircleoffriendswho
liketorolltheirown.However,theworldofdistributionsbreaks
(notverycleanly)intotwolargecamps:RPM-basedsystems,
representedinthisbookbyRedHatandFedora,andapt-based
systems,representedbyDebian.Debian-baseddistributionsare
spreadinglikeweeds,suchasKnoppix,Xandros,Libranet,
Unbuntu,andLinspire.
Evenifyouareusingadistributionthatdoesnotfallintooneof
thesetwocategories,suchasSlackwareorGentoo,the
fundamentalsareprettymuchthesame.Thekernelisthe
same;theprogramsandutilitiesavailablearethesame;the
windowmanagersarethesame;theonlysubstantialdifference
isthewayyouinstallsoftware.
That'snottosaytherearen'totherdifferencesbetweenLinux
distributions.AchronicbugaboowithLinuxisdifferingfile

locationsondifferentdistributions.Getusedtoit;it'snotgoing
togoaway.Thisbookprovidesseveralexcellentmethodsfor
findingoutwhereyourparticulardistributionputsconfiguration
files,executables,andprogramdocumentation.


Conventions
Thefollowingtypographicalconventionsareusedinthisbook:

Italic
Usedforfilenamesandpathnames,hostnames,domain
names,commands,URLs,andemailaddresses.Italicisalso
usedfornewtermswheretheyaredefined.

Constantwidth
Usedforcodeexamplesandfragments.

Constantwidthbold
Usedforuserinput.

Constantwidthitalic
Usedtoindicatetextthatisreplaceable.

Indicatesatip,suggestion,orgeneralnote.


Indicatesawarningorcaution.

Oneparticularlyimportantconventioninthisbookinvolvesthe
useofcommandlineprompts.Ican'tsayittoooften:don'tget

intothehabitofsu'ingtorootwheneveryouhavetodo
anythingremotelyadministrative.Evenworse,don'tsay"It's
mymachine,Icandoanythingasroot."Userootprivileges
onlywhenyoureallyneedthem.You'llbesaferthatway;you'll
havesomeprotectionagainstyourownmistakes,andagainst
attacksmadebyoutsiders.
Toshowyouwhenyouneedrootprivileges,commands
requiringrootprivilegesareprecededbytherootprompt,#.
Commandsthatdon'trequirerootprivilegesareprecededby
thedefaultbashshellprompt,$.
Don'tbeconfusedtherearemanyfilelistingsinthebook,andin
manyofthesefiles,commentsareprecededby#.Yes,itcan
beconfusing,butyou'llgetusedtoit.


DownloadsandFeedback
Doubtlessthisbook,despitetheheroiceffortsofmeandthe
fabulousO'Reillyteam,containsflaws,errors,andomissions.
Pleaseemailyourfeedbackandsuggestionsto
,sowecanmakethesecondedition
evenbetter.Besuretovisitfor
errata,updates,andtodownloadthescriptsandconfiguration
filesusedinthebook.
ThisbookwasauthoredentirelyinOpenOfficeWriter,on
LibranetDebian2.8.


CommentsandQuestions
Pleaseaddresscommentsandquestionsconcerningthisbookto
thepublisher:

O'ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
(800)998-9938(intheUnitedStatesorCanada)
(707)829-0515(internationalorlocal)
(707)829-0104(fax)
Thereisawebpageforthisbook,whichlistserrata,examples,
andanyadditionalinformation.Youcanaccessthispageat:
/>Tocommentonorasktechnicalquestionsaboutthisbook,send
emailto:

Formoreinformationaboutbooks,conferences,software,
ResourceCenters,andtheO'ReillyNetwork,seetheO'Reilly
websiteat:



Acknowledgments
ThankyoutoaceO'ReillyeditorMichaelLoukides,whosegood
taste,eagleeditorialeye,patientendurance,andimplacable
insistencemadethisamuchbetterbook.
ThankyoutoacetechnicalreviewerJennVesperman,andher
attentiontodetail.Sillycomputersarecompletelyliteral,and
mustbefedpreciseinputthanksJenn!
ManythankstoAkkanaPeck,JennVesperman,PaulHeinlein,
andPeterSamuelson,whosecontributionsappearinthisbook.
HeartfeltthankstothegangatLinuxchix,includingJenn
Vesperman(benevolentdictatorofLinuxchix),Dancer
Vesperman,Danamania(thecameradoesnotlie),Colby,
Evilpig,AlmutBehrens,Andrew(MandrakeGuru),Hamster,

Piglet,ValHenson(uppityrabblerouser),H.PeterAnvin(kernel
guruandrabbitrouser),RikRose,DevdasBhagat,DavidNorth
(forcomicrelief),TelsaGwynne,MariaBlackmore,Meredydd
Luff,KaiMacTane,andErinnClark(formoreuppityrabblerousing).Linuxchixrawks!
I'msureImissedsomefolkswhopatientlyenduredmyendless
pestering.Tellmewhoyouare,andI'llfixitinthesecond
edition.


Chapter1.FindingDocumentation
Section1.1.Introduction
Recipe1.2.UnderstandingmanPages
Recipe1.3.FindingAppropriatemanPages
Recipe1.4.FindingLostmanPages
Recipe1.5.ReadingmanPagesWithoutamanViewer
Recipe1.6.ConfiguringYourmanpath
Recipe1.7.UsinginfoPages
Recipe1.8.PrintingmanPages
Recipe1.9.PrintinginfoPages
Recipe1.10.PrintingSelectedmanorinfoPages
Recipe1.11.FindingAlloftheDocumentationfora
Program


×