RedHatEnterpriseLinux7RH254RedHatSystemAdministrationIIIEdition0WanderBoessenkoolChenChangWillDinyesGeorgeHackerRudolfKastlScottMcBrienDouglasSilvaPhilipSweanyEditedbyStevenBonnevilleLegalNoticeDocumentConventions1.NotesandWarningsIntroduction1.RedHatSystemAdministrationIII2.OrientationtotheClassroomEnvironment3.Internationalization3.1.LanguageCodesReference1.ControllingServicesandDaemons1.1.ControllingServiceswithsystemctl1.2.Practice:UsingsystemctltoManageServices1.3.ControllingtheBootProcess1.4.Practice:SelectingaBootTarget1.5.ReviewingtheSystemLogsandJournal1.6.Practice:FindingEventsWithjournalctl1.7.Lab:ControllingServicesandDaemons2.ManagingIPv6Networking2.1.ReviewofIPv4NetworkingConfiguration2.2.Practice:ConfiguringIPv4Networking2.3.IPv6NetworkingConcepts2.4.Practice:InterpretingIPv6Addresses
2.5.IPv6NetworkingConfiguration2.6.Practice:ConfiguringIPv6Networking2.7.Lab:ManagingIPv6Networking3.ConfiguringLinkAggregationandBridging3.1.ConfiguringChannelBonding3.2.Practice:ConfiguringChannelBonding3.3.ConfiguringNetworkTeaming3.4.Practice:ConfiguringNetworkTeaming3.5.ManagingNetworkTeaming3.6.Practice:ManagingNetworkTeaming3.7.ConfiguringSoftwareBridges3.8.Practice:ConfiguringSoftwareBridges3.9.Lab:ConfiguringLinkAggregationandBridging4.NetworkPortSecurity4.1.ManagingFirewalld4.2.Practice:ConfiguringaFirewall4.3.ManagingRichRules4.4.Practice:WritingCustomRules4.5.MasqueradingandPortForwarding4.6.Practice:ForwardingaPort4.7.AddingCustomfirewalldZonesandServices4.8.Practice:ConfigureaCustomFirewall4.9.ManagingSELinuxPortLabeling4.10.Practice:ManagingSELinuxPortLabeling4.11.Lab:NetworkPortSecurity5.ManagingDNSforServers5.1.DNSConcepts5.2.Practice:DNSResourceRecord5.3.ConfiguringaCachingNameserver5.4.Practice:ConfiguringunboundasaCachingNameserver5.5.DNSTroubleshooting5.6.Practice:TroubleshootingDNS5.7.Lab:ManagingDNSforServers6.ConfiguringEmailTransmission6.1.EmailOverview6.2.Practice:SendingEmailwithTelnet6.3.ConfiguringaSend-onlyEmailConfiguration6.4.Practice:ConfiguringaSend-onlyEmailConfiguration6.5.ConfiguringSend-onlyEmailwithMailSubmissionAgents6.6.Practice:ConfiguringSend-onlyEmailwithMailSubmissionAgents6.7.Lab:ConfiguringEmailTransmission7.ProvidingRemoteBlockStorage7.1.iSCSIConcepts
7.2.Practice:iSCSIConcepts7.3.ProvidingiSCSITargets7.4.Practice:ProvidingiSCSITargets7.5.AccessingiSCSIStorage7.6.Practice:AccessingiSCSIStorage7.7.Lab:ProvidingBlock-basedStorage8.ProvidingFile-basedStorage8.1.ExportingNFSFileSystems8.2.Practice:ExportingNFSFileSystems8.3.ProtectingNFSExports8.4.Practice:ProtectingNFSExports8.5.ProvidingSMBFileShares8.6.Practice:ProvidingSMBFileShares8.7.PerformingaMultiuserSMBMount8.8.Practice:PerformingaMultiuserSMBMount8.9.Lab:ProvidingFile-basedStorage9.ConfiguringMariaDBDatabases9.1.InstallingMariaDB9.2.Practice:InstallingMariaDB9.3.WorkingwithMariaDBDatabases9.4.Practice:MariaDBCommands9.5.ManagingDatabaseUsersandAccessRights9.6.Practice:ManagingUsers9.7.CreatingandRestoringMariaDBBackups9.8.Practice:RestoringaMariaDBDatabasefromBackup9.9.Lab:ConfiguringMariaDBDatabases10.ProvidingApacheHTTPDWebService10.1.ConfiguringApacheHTTPD10.2.Practice:ConfiguringaWebServer10.3.ConfiguringandTroubleshootingVirtualHosts10.4.Practice:ConfiguringaVirtualHost10.5.ConfiguringHTTPS10.6.Practice:ConfiguringaTLS-enabledVirtualHost10.7.IntegratingDynamicWebContent10.8.Practice:ConfiguringaWebApplication10.9.Lab:ProvidingApacheHTTPDWebService11.WritingBashScripts11.1.BashShellScriptingBasics11.2.Practice:WritingBashScripts11.3.Lab:WritingBashScripts12.BashConditionalsandControlStructures12.1.EnhancingBashShellScriptswithConditionalsandControlStructures12.2.Practice:EnhancingBashShellScriptswithConditionalsandControlStructures
12.3.Lab:BashConditionalsandControlStructures13.ConfiguringtheShellEnvironment13.1.ChangingtheShellEnvironment13.2.Practice:WorkingwithLoginandNon-LoginShells13.3.Lab:ConfiguringtheShellEnvironment14.LinuxContainersandDocker14.1.IntroductiontoLinuxContainers14.2.UsingDocker15.ComprehensiveReview15.1.RedHatSystemAdministrationIIIComprehensiveReview15.2.Lab:ComprehensiveReviewofSystemAdministrationIIIrh254-en_US-1.0-7-0.r24364fullDocumentConventions1.NotesandWarningsNote"Notes"aretips,shortcutsoralternativeapproachestothetaskathand.Ignoringanoteshouldhavenonegativeconsequences,butyoumightmissoutonatrickthatmakesyourlifeeasier.References"References"describewheretofindexternaldocumentationrelevanttoasubject.Important"Important"boxesdetailthingsthatareeasilymissed:configurationchangesthatonlyapplytothecurrentsession,orservicesthatneedrestartingbeforeanupdatewillapply.Ignoringaboxlabeled"Important"willnotcausedataloss,butmaycauseirritationandfrustration.Warning"Warnings"shouldnotbeignored.Ignoringwarningswillmostlikelycausedataloss.rh254-en_US-1.0-7-0.r24364fullIntroduction1.RedHatSystemAdministrationIIIRedHatSystemAdministrationIII(RH254)isdesignedforexperiencedLinuxsystemadministratorswiththeRedHatCertifiedSystemAdministrator(RHCSA)certificationorequivalentskills.ThiscourseisintendedtohelpstudentsbroadentheirabilitytoadministerLinuxsystemsatanenterpriselevel.RedHatSystemAdministrationIIIisfocusedondeploymentandmanagementofnetworkserversrunningcachingDNSservice,MariaDB,ApacheHTTPD,PostfixSMTPnullclients,networkfilesharingwithNFSandSMB,iSCSIinitiatorsandtargets,advancednetworkingandfirewalldconfigurations,and
theuseofBashshellscriptingtohelpautomate,configure,andtroubleshootthesystem.Throughthelecturesandhands-onlabsinthiscourse,studentswhohavealreadyearnedtheRHCSAcertificationwillbeexposedtoallcompetenciescoveredbytheRHCEexam.ThiscoursedoesnotcoverallRHCSAtasks.StudentswhoneedareviewofRHCSAskillsareencouragedtoattendRHCSARapidTrack(RH199).CourseObjectivesoBuildskillsneededtobeasuccessfulseniorRedHatEnterpriseLinuxsystemadministratorresponsibleformanagingnetworkservicesoPrepareforattendanceinanRHCEcertificationexamAudienceoExperiencedLinuxadministratorswishingtolearnautomationtechniquesthroughscripting,deploymentofkeynetworkservicesandhowtomanagefeaturesofRedHatEnterpriseLinux.PrerequisitesoRHCSAcertificationorequivalentexperience.rh254-en_US-1.0-7-0.r24364full2.OrientationtotheClassroomEnvironmentInthiscourse,studentswilldomosthands-onpracticeexercisesandlabworkwithtwocomputersystems,whichwillbereferredtoasdesktopandserver.ThesemachineshavethehostnamesdesktopX.example.comandserverX.example.com,wheretheXinthecomputers'hostnameswillbeanumberthatwillvaryfromstudenttostudent.Bothmachineshaveastandarduseraccount,student,withthepasswordstudent.Therootpasswordonbothsystemsisredhat.EachstudentisontheIPv4network172.25.X.0/24,wheretheXmatchesthenumberoftheirdesktopXandserverXsystems.TheinstructorrunsacentralutilityserverwhichactsasarouterfortheclassroomnetworksandwhichprovidesDNS,DHCP,HTTP,andothercontentservices,classroom.example.com.ClassroomMachinesMachinenameIPaddressesRoledesktopX.example.com172.25.X.10Student"client"computerserverX.example.com172.25.X.11Student"server"computerclassroom.example.com172.25.254.254Classroomutilityserverrh254-en_US-1.0-7-0.r24364full
3.InternationalizationLanguagesupportRedHatEnterpriseLinux7officiallysupportstwenty-twolanguages:English,Assamese,Bengali,Chinese(Simplified),Chinese(Traditional),French,German,Gujarati,Hindi,Italian,Japanese,Kannada,Korean,Malayalam,Marathi,Odia,Portuguese(Brazilian),Punjabi,Russian,Spanish,Tamil,andTelugu.Per-userlanguageselectionUsersmayprefertouseadifferentlanguagefortheirdesktopenvironmentthanthesystem-widedefault.Theymayalsowanttosettheiraccounttouseadifferentkeyboardlayoutorinputmethod.LanguagesettingsIntheGNOMEdesktopenvironment,theusermaybepromptedtosettheirpreferredlanguageandinputmethodonfirstlogin.Ifnot,thentheeasiestwayforanindividualusertoadjusttheirpreferredlanguageandinputmethodsettingsistousetheRegion&Languageapplication.Runthecommandgnome-control-centerregion,orfromthetopbar,select(User)→Settings.Inthewindowthatopens,selectRegion&Language.TheusercanclickontheLanguageboxandselecttheirpreferredlanguagefromthelistthatappears.ThiswillalsoupdatetheFormatssettingtothedefaultforthatlanguage.Thenexttimetheuserlogsin,thesechangeswilltakefulleffect.ThesesettingsaffecttheGNOMEdesktopenvironmentandanyapplications,includinggnome-terminal,startedinsideit.However,theydonotapplytothataccountifaccessedthroughansshloginfromaremotesystemoralocaltextconsole(suchastty2).NoteAusercanmaketheirshellenvironmentusethesameLANGsettingastheirgraphicalenvironment,evenwhentheyloginthroughatextconsoleoroverssh.Onewaytodothisistoplacecodesimilartothefollowingintheuser's~/.bashrcfile.Thisexamplecodewillsetthelanguageusedonatextlogintomatchtheonecurrentlysetfortheuser'sGNOMEdesktopenvironment:i=$(grep'Language='/var/lib/AccountService/users/${USER}\|sed's/Language=//')if["$i"!=""];thenexportLANG=$ifiJapanese,Korean,Chinese,orotherlanguageswithanon-Latincharactersetmaynotdisplayproperlyonlocaltextconsoles.IndividualcommandscanbemadetouseanotherlanguagebysettingtheLANGvariableonthecommand-line:[user@host~]$LANG=fr_FR.utf8datejeu.avril2417:55:01CDT2014Subsequentcommandswillreverttousingthesystem'sdefaultlanguageforoutput.ThelocalecommandcanbeusedtocheckthecurrentvalueofLANGandotherrelatedenvironmentvariables.
InputmethodsettingsGNOME3inRedHatEnterpriseLinux7automaticallyusestheIBusinputmethodselectionsystem,whichmakesiteasytochangekeyboardlayoutsandinputmethodsquickly.TheRegion&Languageapplicationcanalsobeusedtoenablealternativeinputmethods.IntheRegion&Languageapplication'swindow,theInputSourcesboxshowswhatinputmethodsarecurrentlyavailable.Bydefault,English(US)maybetheonlyavailablemethod.HighlightEnglish(US)andclickthekeyboardicontoseethecurrentkeyboardlayout.Toaddanotherinputmethod,clickonthe+buttonatthebottomleftoftheInputSourceswindow.AnAddanInputSourcewindowwillopen.Selectyourlanguage,andthenyourpreferredinputmethodorkeyboardlayout.Oncemorethanoneinputmethodisconfigured,theusercanswitchbetweenthemquicklybytypingSuper+Space(sometimescalledWindows+Space).AstatusindicatorwillalsoappearintheGNOMEtopbarwhichhastwofunctions.Firstly,itindicateswhichinputmethodisactive.Secondly,itactsasamenuwhichcanbeusedtoswitchbetweeninputmethodsorselectadvancedfeaturesofmorecomplexinputmethods.Someofthemethodsaremarkedwithgears,whichindicatethatthosemethodshaveadvancedconfigurationoptionsandcapabilities.Forexample,theJapaneseJapanese(KanaKanji)inputmethodallowstheusertopre-edittextinLatinanduseDownArrowandUpArrowkeystoselectthecorrectcharacterstouse.USEnglishspeakersmayfindalsothisuseful.Forexample,underEnglish(UnitedStates)isthekeyboardlayoutEnglish(internationalAltGrdeadkeys),whichtreatsAltGr(ortherightAlt)onaPC104/105-keykeyboardasa"secondary-shift"modifierkeyanddeadkeyactivationkeyfortypingadditionalcharacters.TherearealsoDvorakandotheralternativelayoutsavailable.NoteAnyUnicodecharactercanbeenteredintheGNOMEdesktopenvironmentiftheuserknowsthecharacter'sUnicodecodepoint,bytypingCtrl+Shift+U,followedbythecodepoint.AfterCtrl+Shift+Uhasbeentyped,anunderlineduwillbedisplayedtoindicatethatthesystemiswaitingforUnicodecodepointentry.Forexample,thelowercaseGreekletterlambdahasthecodepointU+03BB,andcanbeenteredbytypingCtrl+Shift+U,then03bb,thenEnter.System-widedefaultlanguagesettingsThesystem'sdefaultlanguageissettoUSEnglish,usingtheUTF-8encodingofUnicodeasitscharacterset(en_US.utf8),butthiscanbechangedduringorafterinstallation.Fromthecommandline,rootcanchangethesystem-widelocalesettingswiththelocalectlcommand.Iflocalectlisrunwithnoarguments,itwilldisplaythecurrentsystem-widelocalesettings.Tosetthesystem-widelanguage,runthecommandlocalectlset-localeLANG=locale,wherelocaleistheappropriate$LANGfromthe"LanguageCodesReference"tableinthischapter.Thechangewilltakeeffectforusersontheirnextlogin,andisstoredin/etc/locale.conf.[root@host~]#localectlset-localeLANG=fr_FR.utf8InGNOME,anadministrativeusercanchangethissettingfromRegion&LanguageandclickingontheLoginScreenbuttonattheupperrightcornerofthewindow.ChangingtheLanguageofthe
loginscreenwillalsoadjustthesystem-widedefaultlanguagesettingstoredinthe/etc/locale.confconfigurationfile.ImportantLocaltextconsolessuchastty2aremorelimitedinthefontsthattheycandisplaythangnome-terminalandsshsessions.Forexample,Japanese,Korean,andChinesecharactersmaynotdisplayasexpectedonalocaltextconsole.ForthisreasonitmaymakesensetouseEnglishoranotherlanguagewithaLatincharactersetforthesystem'stextconsole.Likewise,localtextconsolesaremorelimitedintheinputmethodstheysupport,andthisismanagedseparatelyfromthegraphicaldesktopenvironment.TheavailableglobalinputsettingscanbeconfiguredthroughlocalectlforbothlocaltextvirtualconsolesandtheX11graphicalenvironment.Seethelocalectl(1),kbd(4),andvconsole.conf(5)manpagesformoreinformation.LanguagepacksWhenusingnon-Englishlanguages,youmaywanttoinstalladditional"languagepacks"toprovideadditionaltranslations,dictionaries,andsoforth.Toviewthelistofavailablelangpacks,runyumlangavailable.Toviewthelistoflangpackscurrentlyinstalledonthesystem,runyumlanglist.Toaddanadditionallangpacktothesystem,runyumlanginstallcode,wherecodeisthecodeinsquarebracketsafterthelanguagenameintheoutputofyumlangavailable.Referenceslocale(7),localectl(1),kbd(4),locale.conf(5),vconsole.conf(5),unicode(7),utf-8(7),andyum-langpacks(8)manpagesConversionsbetweenthenamesofthegraphicaldesktopenvironment'sX11layoutsandtheirnamesinlocalectlcanbefoundinthefile/usr/share/X11/xkb/rules/base.lst.3.1.LanguageCodesReferenceLanguageCodesLanguage$LANGvalueEnglish(US)en_US.utf8Assameseas_IN.utf8Bengalibn_IN.utf8Chinese(Simplified)zh_CN.utf8Chinese(Traditional)zh_TW.utf8Frenchfr_FR.utf8Germande_DE.utf8Gujaratigu_IN.utf8Hindihi_IN.utf8Italianit_IT.utf8Japaneseja_JP.utf8