SUSE Linux Enterprise 12 Administration -WorkbookVersion: 1.0.0 Date: 2017-0-07
!roprietar" Statement
Dis#$aimer
Copyright © 2015 SUSE LLC. All rights reserved.
SUSE LLC, aes no representations or $arranties $ith respect to the contents or use o# this docuentation, and speci#ically disclais any e%press SUSE LLC, has intellectual property rights relating to or iplied $arranties o# erchanta!ility or #itness #or technology e!odied in the product that is descri!ed in any particular purpose. this docuent. "o part o# this pu!lication ay !e reproduced, photocopied, stored on a retrieval syste, or transitted $ithout the e%press $ritten consent o# the pu!lisher. SUSE &a%#eldstrasse 5 '0(0' "ure!erg )erany
urther, SUSE LLC, reserves the right to revise this pu!lication and to ae changes to its content, at any tie, $ithout o!ligation to noti#y any person or entity o# such revisions or changes. urther, SUSE LLC, aes no representations or $arranties $ith respect to any so#t$are, and speci#ically disclais any e%press or iplied $arranties o# erchanta!ility or #itness #or any particular purpose. urther, SUSE LLC, reserves the right to ae changes to any and all parts o# SUSE so#t$are, at any tie, $ithout any o!ligation to noti#y any person or entity o# such changes.
$$$.suse.co *C+ 201 SUSE LLC. All -ights -eserved. SUSE and the SUSE logo are registered tradears o# SUSE LLC in the United States and other countries. All third/party tradears are the property o# their respective o$ners. # you no$ o# illegal copying o# so#t$are, contact your local So#t$are Antipiracy otline.
Any products or technical in#oration provided under this Agreeent ay !e su!3ect to U.S. e%port controls and the trade la$s o# other countries. 4ou agree to coply $ith all e%port control regulations and to o!tain any reuired licenses or classi#ication to e%port, re/ e%port or iport delivera!les. 4ou agree not to e%port or re/e%port to entities on the current U.S. e%port e%clusion lists or to any e!argoed or terrorist countries as speci#ied in the U.S. e%port la$s. 4ou agree to not use delivera!les #or prohi!ited nuclear, issile, or cheical !iological $eaponry end uses. SUSE assues no responsi!ility #or your #ailure to o!tain any necessary e%port approvals. 6his SUSE 6raining &anual is pu!lished solely to instruct students in the use o# SUSE net$oring so#t$are. Although third/party application so#t$are pacages ay !e used in SUSE training courses, this is #or deonstration purposes only and shall not constitute an endorseent o# any o# these so#t$are applications. urther, SUSE LLC does not represent itsel# as having any particular e%pertise in these application so#t$are pacages and any use !y students o# the sae shall !e done at the student7s o$n ris.
Table of Contents 8ocuentation Conventions9...................................................................................................................:
Se#tion 1: %&er&ie' o( SUSE Linux Enterprise..............................10 E%ercise 19 Understand 4aS6.................................................................................................11 6as 19 Start 4aS6..................................................................................................................................11 6as 29 ;ie$ the contents o# a Syste Log ile.....................................................................................11 6as 9 Change the 6ie and 8ate........................................................................................................11 6as (9 Start the ncurses inter#ace o# 4aS6...........................................................................................11 6as 59 ;ie$ the Content o# a Syste Log ile......................................................................................12
E%ercise 29 &anage avorite Applications.............................................................................1 6as 19 Log into the 8estop *i# reuired+..............................................................................................1 6as 29 Add an Application to your avorite Applications.......................................................................1 6as 9 -eove an Application #ro your avorite Applications...........................................................1
E%ercise 9 Use "autilus ile &anager..................................................................................1( 6as 19 Copy a ile $ith "autilus...........................................................................................................1( 6as 29 -enae a copied ile................................................................................................................1( 6as 9 8elete a ile...............................................................................................................................1(
E%ercise (9 Change Screen Settings.....................................................................................1< 6as 19 Change Screen Settings............................................................................................................1<
Se#tion 2: )*e Linux +i$es"stem.......................................................17 Se#tion : Work 'it* t*e ,ommand Line.........................................1 E%ercise 19 Access and use an and in#o =ages..................................................................1' 6as 19 Use the $hatis and an Coands.........................................................................................1' 6as 29 Use the in#o Coand..............................................................................................................1'
E%ercise 29 Use the Shell istory...........................................................................................21 6as 19 Use the Shell istory.................................................................................................................21
E%ercise 9 Use =iping and -edirection.................................................................................22 6as 19 Use =iping and -edirection.......................................................................................................22
E%ercise (9 Change 8irectories and List 8irectory Contents.................................................2( 6as 19 Change 8irectories and List 8irectory Contents.......................................................................2(
E%ercise 59 =er#or &ultiple ile >perations.........................................................................2< 6as 19 Use the cp and v Coands.................................................................................................2< 6as 29 Create 8irectories......................................................................................................................2? 6as 9 8elete iles and 8irectories.......................................................................................................2? 6as (9 Lin iles....................................................................................................................................2:
E%ercise <9 Use Shell Coands to @or $ith iles............................................................0 6as 19 Use Shell Coand to @or $ith iles....................................................................................0
E%ercise ?9 Create ile acup..............................................................................................2 6as 19 Create a 6ar Archive..................................................................................................................2 6as 29 Sync 6ar Archive........................................................................................................................2 6as 9 Change Content in the Source 8irectory...................................................................................
E%ercise :9 Search ile Content.............................................................................................( 6as 19 Search ile Content...................................................................................................................(
Se#tion : )*e Vim Editor................................................................../ E%ercise 19 Learn ore a!out vi $ith vitutor....................................................................? 6as 19 -un vitutor...............................................................................................................................?
Se#tion : emote Administration.................................................... E%ercise 19 =ractice using >penSS Utilities........................................................................' 6as 19 Access a reote server using SS...........................................................................................' 6as 29 Use scp to Copy iles to and #ro a -eote Server................................................................' 6as 9 Use s#tp......................................................................................................................................(0
E%ercise 29 Con#igure Bey ased Authentication in >penSS.............................................(2 6as 19 )enerate an SS Bey =air........................................................................................................(2 6as 29 Upload the =u!lic Bey to a -eote Server...............................................................................(2 6as 9 ;eri#y Bey ased Login and Store the =rivate Bey in the SS Agent.......................................(2 6as (9 8isa!le =ass$ord ased Logins...............................................................................................(
E%ercise 9 -eote Adinistration using ;"C......................................................................(5 6as 19 Chec reote adinistration is not ena!led on server2...........................................................(5 6as 29 6ry to reotely adinister server1 #ro server2.......................................................................(5 6as 9 Ena!le reote anageent on server2...................................................................................(5 6as (9 -eotely adinister server2 #ro server1................................................................................(<
Se#tion /: S"stem nitia$i3ation.........................................................7 E%ercise 19 Secure )-U $ith a =ass$ord..........................................................................(: 6as 19 Secure Access to )-U $ith a =ass$ord................................................................................(: 6as 29 6est the )-U =ass$ord.........................................................................................................(:
E%ercise 29 &anage Services.................................................................................................50 6as 19 &anage Services.......................................................................................................................50
E%ercise 9 @or $ith systed 6argets..................................................................................5 6as 19 Change to 8i##erent 6argets.......................................................................................................5 6as 29 oot into a 8i##erent 6arget........................................................................................................5 6as 9 Add Services to and -eove Services #ro a 6arget Unit........................................................5(
Se#tion 7: !ro#ess 4ana5ement....................................................../ E%ercise 19 &odi#y =rocess =riorities.....................................................................................5? 6as 19 &odi#y =rocess =riority..............................................................................................................5? 6as 29 Speci#y =rocess =riority at =rogra Start.................................................................................5: 6as 9 6erinate =rocesses.................................................................................................................5:
E%ercise 29 &anage Linu% =rocesses and o!s....................................................................5' 6as 19 8isplay Linu% =rocesses............................................................................................................5' 6as 29 &anage Linu% o!s....................................................................................................................5' 6as 9 Start =rocesses that gnore A")U=.......................................................................................<0 6as (9 6erinate Linu% =rocesses........................................................................................................<1
E%ercise 9 Use the screen Coand...................................................................................<2 6as 19 Use the screen Coand.........................................................................................................<2
E%ercise (9 Schedule o!s $ith cron and at..........................................................................<5 6as 19 Schedule o!s $ith at................................................................................................................<5 6as 29 Schedule o!s $ith cron............................................................................................................<< 6as 9 Schedule a cron o! as root......................................................................................................
E%ercise 59 Con#igure %inetd..................................................................................................<'
SUSE Linu% Enterprise 12 Adinistration
6as 19 Ena!le t#tp via %inetd $ith 4aS6................................................................................................<' 6as 29 Ena!le the rsync 8aeon via %inetd &anually..........................................................................?0
Se#tion : dentit" and Se#urit"........................................................71 E%ercise 19 &anage Users $ith 4aS6....................................................................................?2 6as 19 Create a "e$ User Account $ith 4aS6.....................................................................................?2 6as 29 Log in as the "e$ User.............................................................................................................?2 6as 9 ;ie$ the pass$d ile.................................................................................................................?2 6as (9 -eove the "e$ User Account.................................................................................................?
E%ercise 29 &anage Users and )roups #ro the Coand Line.........................................?( 6as 19 Create a Local User Account #ro the Coand Line.............................................................?( 6as 29 Create and Add Users to a "e$ Local )roup...........................................................................?5 6as 9 Create a "e$ User Account $ith a ;alid =ass$ord Autoatically............................................?5
E%ercise 9 &anage ile =erissions....................................................................................?? 6as 19 Create a =rivate and a =u!lic 8irectory....................................................................................?? 6as 29 Create a ile as a "oral User in !oth 8irectories...................................................................??
E%ercise (9 Con#igure =osi% ACLs..........................................................................................?' 6as 19 Con#igure the ACLs o# a 8irectory.............................................................................................?' 6as 29 Con#igure 8e#ault ACLs #or a 8irectory.....................................................................................:0 6as 9 8elete ACLs...............................................................................................................................:1
E%ercise 59 Use the su Coand to Elevate =rivileges........................................................:2 6as 19 Use the su Coand................................................................................................................:2
E%ercise <9 Con#igure sudo #or 8elegation o# Adinistration.................................................:( 6as 19 Con#igure sudo..........................................................................................................................:( 6as 29 8e#ine sudo Aliases...................................................................................................................:( 6as 9 6est the sudo Aliases.................................................................................................................:5 6as (9 )rant the 6u% User the A!ility to Change Users =ass$ords.....................................................:5
E%ercise ?9 )rant Adinistrative =rivilege $ith =olicyBit.......................................................:< 6as 19 6ry to Use the )">&E 8ate D 6ie 6ool.................................................................................:< 6as 29 )rant the =rivilege to Use )">&E 8ate D 6ie 6ool..............................................................:< 6as 9 E%ecute a Coand as Another User......................................................................................:?
Se#tion 6: So(t'are 4ana5ement..................................................... E%ercise 19 &anage So#t$are $ith -=&................................................................................:' 6as 19 )et n#oration on So#t$are =acages.....................................................................................:' 6as 29 nstall So#t$are $ith -=&..........................................................................................................'0 6as 9 -eove So#t$are $ith -=&......................................................................................................'0
E%ercise 29 nstall So#t$are $ith ypper.................................................................................'2 6as 19 nstall a So#t$are =acage $ith ypper.....................................................................................'2 6as 29 Use ypper to nstall a =attern...................................................................................................'
E%ercise 9 &anage So#t$are Sources $ith ypper...............................................................'( 6as 19 Add an nstallation source $ith ypper......................................................................................'( 6as 29 nstall a So#t$are =acage #ro the "e$ -epository...............................................................'( 6as 9 -enae an nstallation Source $ith ypper..............................................................................'(
5
SUSE Linu% Enterprise 12 Adinistration
6as (9 -eove an nstallation Source $ith ypper..............................................................................'5
E%ercise (9 &anage So#t$are $ith 4aS6...............................................................................'< 6as 19 nstall So#t$are =acages $ith 4aS6........................................................................................'< 6as 29 -eove So#t$are =acages $ith 4aS6....................................................................................'<
Se#tion 10: et'ork Administration.................................................6 E%ercise 19 Con#igure the "et$or Connection &anually......................................................'' 6as 19 "ote the Current "et$or Con#iguration...................................................................................'' 6as 29 8elete the Current "et$or Setup $ith 4aS6............................................................................'' 6as 9 Con#igure the "et$or &anually.............................................................................................100
E%ercise 29 Con#igure Local "ae -esolution....................................................................101 6as 19 Con#igure Local "ae -esolution...........................................................................................101 6as 29 6est "ae -esolution..............................................................................................................101
E%ercise 9 Save the "et$or Con#iguration to a ile..........................................................102 6as 19 Save the "et$or Con#iguration to a ile................................................................................102 6as 29 6est the "et$or Con#iguration................................................................................................102
E%ercise (9 &anage "et$or Con#iguration $ith @iced....................................................10( 6as 19 &anage "et$or Con#iguration $ith @iced...........................................................................10(
E%ercise 59 Con#igure a ost ased ire$all $ith SuSE#ire$all2........................................10< 6as 19 Use SuSE#ire$all2 to Con#igure the ire$all...........................................................................10<
Se#tion 11: Stora5e Administration................................................10 E%ercise 19 &anage =artitions $ith 4aS6............................................................................10' 6as 19 &anage partitions $ith 4aS6...................................................................................................10' 6as 29 ;ie$ the ne$ partitions and #ilesystes..................................................................................110
E%ercise 29 &anage =artitions $ith parted...........................................................................112 6as 19 ;ie$ the E%isting =artitions......................................................................................................112 6as 29 Create a "e$ =artition.............................................................................................................112
E%ercise 9 Create a ile Syste in an Epty =artition.......................................................11< 6as 19 Create and e%t ile Syste....................................................................................................11<
E%ercise (9 Con#igure a L;& ;olue )roups and a Logical ;olue..................................11: 6as 19 Add partitions to a dis.............................................................................................................11: 6as 29 Con#igure an L;& )roup.........................................................................................................11: 6as 9 Con#igure a asic L;& Logical ;olue...................................................................................11' 6as (9 orat the asic L;& ;olue $ith a ile Syste..................................................................11' 6as 59 -esie the voluegroup and e%t( #ile syste.........................................................................120 6as 59 -enae and E%isting Logical ;olue.....................................................................................120
E%ercise 59 Create a Linear -A81 Array.............................................................................122 6as 19 =repare the diss.....................................................................................................................122 6as 29 Create a -A81 Array..............................................................................................................122 6as 29 &ount the -A8 Array into the ilesyste...............................................................................12
E%ercise <9 Siulate a ailed -A8 8is.............................................................................12( 6as 19 Siulate a ailing 8is in the -A8.........................................................................................12( 6as 29 Add a "e$ Spare 8is to the Array.........................................................................................125
<
SUSE Linu% Enterprise 12 Adinistration
E%ercise ?9 Create a trS #ilesyste.................................................................................12< 6as 19 Create soe #ree space #or a trS #ilesyste.......................................................................12< 6as 29 Create a trS #ilesyste........................................................................................................12<
E%ercise :9 Convert and E%isting 8irectory into a Su!volue.............................................12: 6as 19 6his is 6as >ne......................................................................................................................12:
E%ercise '9 @or $ith trS.................................................................................................10 6as 19 @or $ith trS.......................................................................................................................10 6as 29 @or $ith trS Su!volues..................................................................................................1
E%ercise 109 trS9 n/=lace &igration and &aintenance...................................................15 6as 19 Convert an e%t( ilesyste to trS.......................................................................................15 6as 29 =er#or trS &aintenance 6ass..........................................................................................1<
E%ercise 119 Con#igure "S.................................................................................................1: 6as 19 Setup and "S Server.............................................................................................................1: 6as 29 Setup and "S Client..............................................................................................................1'
Se#tion 12: Administration and 4onitorin5...................................11 E%ercise 19 Con#igure "6= Service......................................................................................1(2 6as 19 Con#igure the "6= Server.......................................................................................................1(2
E%ercise 29 &anage Syste Logging...................................................................................1( 6as 19 &odi#y the rsyslog Con#iguration.............................................................................................1( 6as 29 Con#igure logrotate..................................................................................................................1((
Se#tion 1: insta$$ SUSE Linux Enterprise....................................1/ E%ercise 19 nstall SUSE Linu% Enterprise Server 12..........................................................1(? 6as 19 =o$er on an Epty ;irtual &achine........................................................................................1(? 6as 29 nstall SLES12.........................................................................................................................1(? La!
;aria!les9.......................................................................................................................................150
?
SUSE Linu% Enterprise 12 Adinistration
Do#umentation ,on&entions:
6he #ollo$ing typographical conventions are used in this anual9
8o$d
-epresents things you should pay attention to or !uttons you clic, te%t or options that you should clicFselectFtype in a )U.
8o$d 9ra"
-epresents the nae o# a 6as or in the conte%t o# $hat is seen on the screen, the screen nae, a ta! nae, colun nae, #ield nae, etc.
8o$d ed
-epresents $arnings or very iportant in#oration.
%ption %ption %ption
-epresents a chain o# ites selected #ro a enu.
BOLD_UPPERCASE_ITALIC -epresents an Ge%ercise varia!leH that you replace $ith another value.
bold monospace
-epresents te%t displayed in a terinal or entered in a #ile.
bold monospace blue
-epresents coands entered at the coand line.
bold monospace green
-epresents a #ile nae.
:
SUSE Linu% Enterprise 12 Adinistration
'
SUSE Linu% Enterprise 12 Adinistration
1 %&er&ie' o( SUSE Linux Enterprise Des#ription: n this section you $ill !e introduced to 4aS6, anage the Linu% 8estop and use "autilus to anage the #ilesyste.
10
SUSE Linu% Enterprise 12 Adinistration
1- 1
Understand ;aS)
Des#ription: n this e%ercise, you learn ho$ to use the di##erent inter#aces o# 4aS6 and ho$ to start soe 4aS6 odules.
)ask 1: Start ;aS) 1. Using ser&er1 ae sure you are logged in as tux. 2. 6o start 4aS6, #ro the App$i#ations enu select s"stem )oo$s ;aS) and enter the root pass$ord o# linux $hen propted. 6he ;aS) ,ontro$ ,enter appears
)ask 2: Vie' t*e #ontents o( a S"stem Lo5 +i$e 1. 2. . (.
Start the ;aS) S"stem Lo5 odule !y selecting 4is#e$$aneous I S"stem Lo5 6he essages log is displayed !y de#ault # you lie you can vie$ other log #iles !y selecting other entries #ro the drop/do$n list Close the log $indo$ !y selecting %<
)ask : ,*an5e t*e )ime and Date 1. @ith the ;aS) ,ontro$ ,enter open select S"stem I Date and )ime 2. Change the e5ion and 6ieone to the #ollo$ing9 -egion9 9$oba$ 6oe Jone9 U), Clic %< to save your changes . Close the ;aS) ,ontro$ ,enter
)ask : Start t*e n#urses inter(a#e o( ;aS) 1. >pen a terinal $indo$ !y right/clicing on the destop !acground and selecting %pen )ermina$ 2. S$itch to the root user account !y entering9
su – in the terinal $indo$ enter the root pass$ord $inux $hen propted
11
SUSE Linu% Enterprise 12 Adinistration
. 6o vie$ a list o# the avail a!le 4aS6 odules enter the #ollo$ing coand9
yast -l (. 6o start the ncurses inter#ace o# 4aS6 enter the #ollo$ing coand9
yast
)ask : Vie' t*e ,ontent o( a S"stem Lo5 +i$e 1. =ress the do'n-arro' ey until the #ollo$ing is highlighted in the le#t #rae9 4is#e$$aneous and press )ab 2. =ress the do'n-arro' ey until the #ollo$ing is highlighted in the le#t #rae9 S"stem Lo5 and press Enter . =ress the do'n-arro' ey until the #ollo$ing is highlighted9
/var/log/messages.log And press Enter (. =ress the )ab ey until %< is highlighted and press Enter 5. =ress Alt+Q to =uit <. Log out #ro the root account !y entering9
exit ?. Close the terinal $indo$ !y entering9
exit
Summar": 4ou should no$ !e #ailiar $ith using the graphical and te%t versions o# 4aS6 to vie$ syste log #iles.
*End o# E%ercise+
12
SUSE Linu% Enterprise 12 Adinistration
1- 2
4ana5e +a&orite App$i#ations
Des#ription: n this e%ercise you add and reove an application to your #avorite applications.
)ask 1: Lo5 into t*e Desktop >i( re?uired@ 1. # not already logged in on ser&er1, in the log in screen, clic )ux !en5uin and enter the pass$ord $inux. 2. Clic Si5n n and the )">&E destop should start
)ask 2: Add an App$i#ation to "our +a&orite App$i#ations 1. 6o open the ain enu clic App$i#ations in the !otto le#t corner 2. &ove the ouse pointer over S"stem )oo$s and right/clic the )ermina$ icon on the right . Select Add to +a&orites #ro the pop/up enu and the 6erinal icon should appear under avorites in the ain enu
)ask : emo&e an App$i#ation (rom "our +a&orite App$i#ations 1. 6o open the ain enu, clic App$i#ations in the !otto le#t corner 2. &ove the ouse pointer over +a&orites and right/clic the e$p icon on the right . Select emo&e (rom +a&orites #ro the pop/up enu the elp icon should disappear #ro avorites in the ain enu.
Summar": n this e%ercise, you added an application to your #avorite applications. 4ou also reoved an application #ro your #avorite applications.
*End o# E%ercise+
1
SUSE Linu% Enterprise 12 Adinistration
1-
Use auti$us +i$e 4ana5er
Des#ription: n this e%ercise you practice using the "autilus #ile anager.
)ask 1: ,op" a +i$e 'it* auti$us 1. &ae sure you are logged in to ser&er1 as tux 2. 6o start the "autilus #ile anager dou!le/clic the ome icon on the destop . 6o vie$ the contents o# the /etc directory, select%t*er Lo#ations then #ro the right #rae select ,omputer (. 8ou!le/clic the /etc icon 5. 6o copy the /etc/DIR_!"!R# #ile onto the destop, scroll do$n to the DIR_!"!R# #ile icon and right/clic the icon. ro the pop/up enu, select ,op" )o n the Se$e#t Destination $indo$ clic the ome icon in the le#t #rae and then dou!le/clic the Desktop icon in the right #rae. 6hen press the Se$e#t !utton <. S$itch !ac to your hoe directory !y selecting ome #older in the le#t side panel ?. 6o ove the DIR_!"!R# #ile #ro the Des$top directory into your hoe directory do the #ollo$ing9 8ou!le/clic the Desktop icon in the right #rae to see the content o# the directory Clic the DIR_!"!R# #ile icon and eep the ouse !utton pressed 8rag the ouse pointer $ith the #ile icon over the ome icon in the le#t side panel and release the ouse !utton
)ask 2: ename a #opied +i$e 1. ;ie$ the contents o# the ome #older 2. -enae the copied #ile !y right/clicing the DIR_!"!R# #ile icon and select ename #ro the conte%t enu . or the ne$ #ile nae type example.txt and then press Enter
)ask : De$ete a +i$e
1. 8elete the example.txt #ile !y dragging the #ile icon over the )ras* icon in the le#t side panel and releasing the ouse !utton 2. Close the auti$us #ile !ro$ser $indo$ . -ight/clic the )ras* icon on the destop and select Empt" )ras* #ro the conte%t enu 1(
SUSE Linu% Enterprise 12 Adinistration
n the con#iration dialog select Empt" )ras* Summar": n this e%ercise, you copied a #ile, renaed it and oved it into the trash.
*End o# E%ercise+
15
SUSE Linu% Enterprise 12 Adinistration
1-
,*an5e S#reen S ettin5s
Des#ription: n this e%ercise, you change the screen settings.
)ask 1: ,*an5e S#reen Settin5s 1. &ae sure you are logged in to ser&er1 as tux 2. 6o start the display con#iguration tool #ro the App$i#ations enu select S"stem )oo$s Settin5s and in the ard'are section clic Disp$a"s . n the display con#iguration tool there should !e one display la!eled G Unkno'n Disp$a"H listed. Se$e#t this ite !y clicing on it. (. ro the -esolution enu, select 10x600 >1/:10@ and select App$" 5. n the con#iration dialog select
*End o# E%ercise+
1<
SUSE Linu% Enterprise 12 Adinistration
2 )*e L inux + i$es"stem Des#ription: 6here are no la!s in this section.
1?
SUSE Linu% Enterprise 12 Adinistration
Work 'it* t*e ,ommand Line Des#ription:
n this section you $illusing learnthe ho$ to use then !ecoe #ailiar $ith shell. 4outhe $illavaila!le then usehelp the systes. coand 4ou line $ill to anage #iles and #olders.
1:
SUSE Linu% Enterprise 12 Adinistration
- 1
A##ess and use man and in(o !a5es
Des#ription: n this e%ercise, you use the %&atis, man and in'o coands and navigate through the help te%t.
)ask 1: Use t*e '*atis and man ,ommands 1. Using ser&er1 logged in as tux, right/clic on the )">&E destop, and select %pen )ermina$ #ro the conte%t enu 2. ind the sections o# the an pages #or the in'o coand !y entering9
%&atis in'o . -ead the #irst section *user coands+ o# the an pages o# the in#o coand !y entering9
man ( in'o (. 6o loo #or G#ilenae,H enter9
/'ilename 5. Scroll through the te%t $ith the up and do$n arro$ eys. <. @hen you #inish vie$ing the in#oration e%it *uit+ the an page !y typing ?
)ask 2: Use t*e in(o ,ommand 1. ro the terinal $indo$ display the in#o pages #or the in'o coand !y entering9
in'o in'o 2. &ove the cursor to the third re#erence * n&okin5 n(o+ !y pressing )ab three ties . ollo$ the re#erence !y pressing Enter (. &ove the cursor to the re#erence ote ,ustom
1'
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise, you used the %&atis, man and in'o coands and navigated through the help te%t.
*End o# E%ercise+
20
SUSE Linu% Enterprise 12 Adinistration
- 2
Use t*e S*e$$ istor"
Des#ription: n this e%ercise, you use the shell history to retrieve and e%ecute previously entered coands.
)ask 1: Use t*e S*e$$ istor" 1. Using ser&er1 ae sure you are logged in as tux, right/clic on the )">&E destop, and select %pen )ermina$ #ro the conte%t enu 2. 6o vie$ the history cache in a terinal $indo$ enter9
&istory . =ress the Up-arro' until you see a coand you $ould lie to e%ecute then press Enter (. 6ype & and press !a5e Up once, you should see the &istory coand at the coand line again 5. =ress Enter to e%ecute the &istory coand Summar": n this e%ercise, you used the history coand to retrieve and e%ecute previously entered coands.
*End o# E%ercise+
21
SUSE Linu% Enterprise 12 Adinistration
-
Use !ipin5 and edire#tion
Des#ription: n this e%ercise, you redirect the output o# coands into #iles and pipe the output o# coands to other coands.
)ask 1: Use !ipin5 and edire#tion 1. Using ser&er1 logged in as tux n a terinal $indo$ pipe the output o# the ls coand #or the hoe directory *G~H+ to a #ile !y entering the #ollo$ing9
ls ) * &ome_directory.txt 2. 8isplay the content o# the #ile !y entering9
cat &ome_directory.txt . Append the output o# the ls coand #or the root directory *G/H+ to the hoeKdirectory.t%t #ile !y entering the #ollo$ing9
ls / ** &ome_directory.txt (. 8isplay the content o# the #ile !y entering9
cat &ome_directory.txt 5. >ver$rite the &ome_directory.txt #ile $ith the output o# the ls coand !y entering the #ollo$ing9
ls / * &ome_directory.txt <. 8isplay the content o# the #ile !y entering9
cat &ome_directory.txt ?. @rite the output o# the ls coand on the screen and into the &ome_directory.txt #ile !y entering the #ollo$ing9
ls ) tee &ome_directory.txt :. 8isplay the content o# the #ile !y entering9
cat &ome_directory.txt '. -eove the
home_directory.txt #ile
!y entering9
rm &ome_directory.txt 10.;eri#y that the #ile $as reoved !y entering9
22
SUSE Linu% Enterprise 12 Adinistration
ls -l 11. Close the terinal $indo$
Summar": n this e%ercise, you redirected the output o# a coand.
*End o# E%ercise+
2
SUSE Linu% Enterprise 12 Adinistration
-
,*an5e Dire#tories and List Dire#tor" ,ontents
Des#ription: n this e%ercise, you learn ho$ to use the cd, p%d, and ls coands, change the current directory and list the directory contents.
)ask 1: ,*an5e Dire#tories and List Dire#tor" ,ontents 1. >n ser&er1 logged in as tux descri!e $hat directories the #ollo$ing characters re#er to9
. .. 2. Launch a 9nome )ermina$ $indo$ and change to the /tmp directory !y entering9
cd /tmp . 8isplay the nae o# the current directory !y entering9
p%d (. Change to the hoe directory !y entering9
cd ) 5. 8isplay the nae o# the current directory !y entering9
p%d <. Change to the /usr/s&are/doc directory !y entering9
cd /usr/s&are/doc ?. 8isplay the nae o# the current directory !y entering9
p%d :. Change !ac to tuxBs hoe directory !y entering9
cd '. 8isplay the nae o# the current directory !y entering9
p%d 10.8isplay the content o# the current directory !y entering9
ls 11. 8isplay the content o# the current directory, including the hidden #iles, !y entering9
2(
SUSE Linu% Enterprise 12 Adinistration
ls -a 12.;ie$ the perissions and the #ile sies o# all the #iles in the current directory !y entering9
ls -la
Summar": n this e%ercise, you the #ile syste and displayed the content o# the current directory.
*End o# E%ercise+
25
SUSE Linu% Enterprise 12 Adinistration
-
!er(orm 4 u$tip$e + i$e % perations
Des#ription: n this e%ercise, you copy and ove #iles $ith the cp and mv coands, create directories $ith the m$dir coand, delete #iles and directories $ith the rm and
rmdir coands and lin #iles $ith the ln coand.
)ask 1: Use t*e #p and m& ,ommands 1. Logged to ser&er1 as tux open a terinal $indo$ 2. Create a ne%_'ile #ile, i# it does not e%ist use the #ollo$ing coand9
cd , touc& ne%_'ile . -enae ne%_'ile to my_'ile !y entering the #ollo$ing9
mv ne%_'ile my_'ile (. ;eri#y that the #ile $as renaed !y entering9
ls -l 5. &ae a copy o# my_'ile and nae it my_'ile( !y entering the #ollo$ing9
cp my_'ile my_'ile( <. ;eri#y that my_'ile( $as created !y entering9
ls -l my ?. Copy the /usr/bin/rename and /usr/bin/tac #iles to the /tmp/ directory !y entering the #ollo$ing9
cp /usr/bin/rename /usr/bin/tac /tmp :. ;eri#y that the #iles $ere copied !y entering9
ls -l /tmp '. &ove the /tmp/tac #ile to the hoe directory *~+ !y entering the #ollo$ing9
mv /tmp/tac ) 10.;eri#y the ove !y entering9
ls -l 11. &ove and renae the /tmp/rename #ile to )/my_'ile !y entering the #ollo$ing9
2<
SUSE Linu% Enterprise 12 Adinistration
mv /tmp/rename )/my_'ile 12.;eri#y that the my_'ile #ile e%ists !y entering9
ls -l 1. Copy the coplet e /bin/ directory to the hoe directory $ith the ne$ directory !eing naed my_dir !y entering the #ollo$ing9
cp -r /bin )/my_dir 1(.;eri#y that the #iles $ere copied !y entering9
ls -l )/my_dir
)ask 2: ,reate Dire#tories 1. Create a directory naed ne%_dir inside the my_dir directory !y entering the #ollo$ing9
m$dir )/my_dir/ne%_dir 2. ;eri#y that the directory $as created !y entering the #ollo$ing9
ls )/my_dir . Create a directory tux_dir including a ne$ directory empty_dir !y entering the #ollo$ing9
m$dir -p )/tux_dir/empty_dir (. ;eri#y that tux_dir $as created !y entering9
ls 5. ;eri#y that empty_dir $as created !y entering9
ls tux_dir
)ask : De$ete +i$es and Dire#tories 1. 6ry to reove the )/tux_dir directory !y entering9
rmdir tux_dir A essage is displayed indicating that the directory cannot !e reoved. 6his is !ecause the directory is not epty. 2. -eove the )/tux_dir/empty_dir directory !y entering the #ollo$ing9
rmdir )/tux_dir/empty_dir . ;eri#y that the empty_dir directory has !een reoved !y entering9
ls tux_dir 2?
SUSE Linu% Enterprise 12 Adinistration
(. -eove the )/tux_dir directory !y entering9
rmdir tux_dir 5. ;eri#y that the directory $as reoved !y entering9
ls <. -eove the
~/my_dir/login #ile
!y entering9
rm )/my_dir/login ?. ;eri#y that the #ile has !een reoved !y entering9 ls
)/my_dir/login
:. -eove all #iles $ith naes that !egin $ith GaH in the /&ome/tux/my_dir/ directory !y entering the #ollo$ing9
rm -i )/my_dir/a Con#ir every $arning !y entering9
y '. -eove the /&ome/tux/my_dir/ directory including its content !y entering the #ollo$ing9
rm -r )/my_dir and i# propted con#ir every $arning !y entering9
y 10.;eri#y that the directory has !een reoved !y entering9
ls )/my_dir
)ask : Link +i$es 1. Enter the #ollo$ing to create a sy!olic lin to the my_'ile #ile in your hoe directory9
ln -s )/my_'ile symlin$ 2. Enter the #ollo$ing to create a hard lin to the my_'ile( #ile in your hoe directory9
ln )/my_'ile( &ardlin$ . 8isplay the lins !y entering9
ls -l "otice that the sy!olic lin identi#ies the #ile it is lined to
2:
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise, you copied and oved #iles. 4ou also created and deleted directories and lins.
*End o# E%ercise+
2'
SUSE Linu% Enterprise 12 Adinistration
- /
Use S*e$$ ,ommands to Work 'it* +i$es
Des#ription: n this e%ercise, you create an epty #ile and vie$ the content o# a #ile !y using the
cat, less, &ead, and tail coands.
)ask 1: Use S*e$$ ,ommand to Work 'it* +i$es 1. &ae sure you are logged in as tux and open a terinal $indo$ 2. >pen a second terinal $indo$ and log in as root * su -+. . n the second terinal session display the content o# the /var/log/messages #ile !y entering9
cat /var/log/messages (. 8isplay the content o# /var/log/messages page/!y/page !y entering9
less /var/log/messages 5. ind the #irst occurrence o# the $ord G rootH !y entering9
/root and #ind the ne%t occurrence o# the $ord GrootH !y typing9
n <. "avigate through the output !y using the cursor eys and the !a5e Up and the !a5e Do'n eys ?. uit the display and return to the coand line !y typing9
:. 8isplay the #irst 5 lines o# the /var/log/messages #ile !y entering9
&ead -n 0 /var/log/messages '. ;ie$ a continuously updated display o# the last lines o# the /var/log/messages #ile !y entering9
tail -' /var/log/messages 10.Arrange the terinal $indo$s on the destop so that you can see the content o# !oth 11. n the #irst terinal $indo$ you opened in Step 1, log in as root * su -+ entering an invalid pass$ord such as b$a* 12."otice that the login attept is logged in the second terinal $indo$
0
SUSE Linu% Enterprise 12 Adinistration
1.n the #irst terinal $indo$, log in as root * su -+ using the correct pass$ord 1(.6he login is logged in the second terinal $indo$ 15.Log out as root in the #irst terinal $indo$ !y entering9
exit 1<.Close the #irst terinal $indo$ !y entering9
exit 1?.Stop the tail process in the second terinal $indo$ !y pressing9
trl+ 1:.Log out as root !y entering9
exit 1'.Close the terinal $indo$
Summar": n this e%ercise, you vie$ed #iles. 4ou also created and deleted directories and lins.
*End o# E%ercise+
1
SUSE Linu% Enterprise 12 Adinistration
- 7
,reate +i$e 8a#kup
Des#ription: n this e%ercise, you $ill create archives using the tar coand and sync these archives to another directory using rsync.
)ask 1: ,reate a )ar Ar#*i&e 1. &ae sure you are logged as tux and open a terinal $indo$ 2. 6o create an epty directory, enter9
m$dir )/source_dir . 6o change into the ne$ directory enter9
cd )/source_dir (. 6o create a tar archive out o# the #iles in the /bin directory, enter the #ollo$ing9
tar cv' tar-arc&ive.tar /bin 5. 6o create a gipped tar archive out o# the #iles in the /bin directory, enter the #ollo$ing9
tar c1v' g1ip-arc&ive.tar.g1 /bin <. 6o create a !2/ipped tar archive out o# the #iles in the /bin directory, enter the #ollo$ing9
tar c2v' b1ip-arc&ive.tar.b1 /bin ?. 6o copare the sie o# the three archives enter9
la
)ask 2: S"n# )ar Ar#*i&e 1. 6o create a ne$ directory to sync the archives into enter9
m$dir /tmp/destination_dir 2. 6o sync the content o# the source_dir directory into the destination_dir directory enter9
rsync -av )/source_dir/ /tmp/destination_dir/ . 6o veri#y that the #iles $ere copied enter9
2
SUSE Linu% Enterprise 12 Adinistration
la /tmp/destination_dir
)ask : ,*an5e ,ontent in t*e Sour#e Dire#tor" 1. 6o create ne$ #iles in the source_dir directory, you can e%tract the #ile bin/login #ro the g1ip-arc&ive.tar.g1 archive. Enter the #ollo$ing9
tar x1v' g1ip-arc&ive.tar.g1 bin/login 2. 6o test i# the e%traction $as success#ul enter9
ls -a )/source_dir . 4ou should see a ne$ directory bin (. 6o display the content o# the !in directory enter9
ls -a )/source_dir/bin 5. 4ou should see the e%tracted #ile login <. 6o sync the content o# the source_dir directory into the destination_dir directory enter9
rsync -av )/source_dir/ /tmp/destination_dir/ n the output on the screen you should see that only the bin directory and the login #iles $ere trans#erred
Summar": n this e%ercise, you created archives using the tar coand and synchronied these archives to another directory using rsync.
*End o# E%ercise+
SUSE Linu% Enterprise 12 Adinistration
-
Sear#* +i$e ,ontent
Des#ription: n this e%ercise, you #ind a special character co!ination in a #ile $ith the grep and
egrep coands.
)ask 1: Sear#* +i$e ,ontent 1. Use ser&er1 logged in as tux 2. ro a terinal $indo$ #ind all 6&L headings o# hierarchy 2 in the /usr/s&are/doc/pac$ages/yast-users/users.&tml #ile !y entering the #ollo$ing *on one line+9
grep 34&*3 /usr/s&are/doc/pac$ages/yast-users/users.&tml 6he output ay appear siilar to this9 C*2+eatures >SL6.@C*2 C*2mp$ementationC*2 C*2)*e (i$esC*2 . ind all locations in the 6&L #iles o# the /usr/s&are/doc/pac$ages/yastusers/ directory that include the $ord Gcon#igurationH !y entering the #ollo$ing *on one line+9
grep con'iguration /usr/s&are/doc/pac$ages/yast-users/.&tml 6he output ay appear siilar to this9 C*1;aS)2: Users #on(i5uration modu$eC*1 (. ind all locations in the 6M6 #iles o# all G yastH directories /usr/s&are/doc/pac$ages/yast-/ that include lines !eginning $ith a nu!er !y entering the #ollo$ing *on one line+9
egrep 3567-893 /usr/s&are/doc/pac$ages/yast-/.txt 5. ind all locations in the 6M6 #iles o# all /usr/s&are/doc/pac$ages/yast-/ directories that include lines !eginning $ith the letter GmH or GnH !y entering the #ollo$ing *on one line+9
egrep 356mn93 /usr/s&are/doc/pac$ages/yast-/.txt <. Close the terinal $indo$
(
SUSE Linu% Enterprise 12 Adinistration
Summar": n this tas you used grep and egrep to search #or the string GNh2IH in a 6&L #ile. 4ou then searched #or all 6M6 #iles that include lines !eginning $ith a nu!er and #inally you searched #or 6M6 #iles that include lines !eginning $ith the letter GH or GnH.
*End o# E%ercise+
5
SUSE Linu% Enterprise 12 Adinistration
)*e Vim Editor Des#ription: 4ou $ill learn the !asic #unctions o# the ;i editor.
<
SUSE Linu% Enterprise 12 Adinistration
- 1
Learn more about &im 'it* &imtutor
Des#ription: n this e%ercise, you use the vimtutor application to learn ore a!out vi.
)ask 1: un &imtutor 1. &ae sure you are logged in to ser&er1 as tux 2. -ight/clic on the )">&E destop and select %pen )ermina$ #ro the conte%t enu . 6o run vitutor enter9
vimtutor (. ollo$ the instructions in the vitutor
Summar": n this e%ercise, you used the vitutor application to learn ore a!out vi.
*End o# E%ercise+
?
SUSE Linu% Enterprise 12 Adinistration
emote Administration Des#ription: 4ou $ill use SS and ;"C to reotely anage systes.
:
SUSE Linu% Enterprise 12 Adinistration
- 1
!ra#ti#e usin5 %penSS Uti$ities
Des#ription: n this e%ercise, you practice using the SS suite o# utilities.
)ask 1: A##ess a remote ser&er usin5 SS 1. Using ser&er2 logged in as tux 2. >pen a terinal $indo$ and enter the #ollo$ing coand to connect to the ser&er1 achine9
ss& tux:server( # propted accept server1Os host ey !y entering9
yes . @hen propted enter tu%Os pass$ord #or ser&er1 *$inux+ 4ou are no$ logged in to ser&er1 as tu% (. Log out !y entering9
exit 5. Enter the #ollo$ing on ser&er1 to vie$ the processes running on ser&er29
ss& tux:(;.(;.. ps aux # propted accept host ey !y entering9
yes <. @hen propted enter tu%Os pass$ord #or ser&er2 *$inux+ A#ter entering tu%Os pass$ord, a list o# all processes currently running on ser&er2 should !e displayed
)ask 2: Use s#p to ,op" +i$es to and (rom a emote Ser&er 1. 8o the #ollo$ing on ser&er19 2. Enter the #ollo$ing coand to copy the /etc/&osts #ile #ro ser&er2 to the /tmp directory on ser&er19
scp tux:(;.(;..n ser&er1, enter the #ollo$ing coand to veri#y that the #ile $as trans#erred9
ls /tmp/&osts '
SUSE Linu% Enterprise 12 Adinistration
4ou should see the hosts #ile #ro the ser&er2 server in your /tmp directory (. Enter the #ollo$ing coand on ser&er1 to copy the /etc/&osts #ile #ro ser&er1 to tu%7s hoe directory on ser&er29
scp /etc/&osts tux:(;.(;..<) @hen propted enter tu%Os pass$ord #or ser&er2 5. >n ser&er2 !ro$se to the tu% userOs hoe directory */&ome/tux+ to veri#y that the #ile $as copied 4ou should see the hosts #ile #ro the ser&er1 in the tu% user7s hoe directory on ser&er2
)ask : Use s(tp 1. 8o the #ollo$ing on ser&er1 2. Enter the #ollo$ing coand to connect via s#tp to ser&er29
s'tp tux:(;.(;.. @hen propted enter tu%Os pass$ord #or ser&er2 . 4ou should !e at an s(tp propt on ser&er2 (. Enter the #ollo$ing coand to copy the /bin/date progra #ro ser&er2 to tu%7s hoe directory9
get /bin/date /&ome/tux/ 5. E%it s(tp !y entering9
exit <. ro$se to the tu% userOs hoe directory to veri#y that the #ile $as trans#erred
Summar": n this e%ercise you practiced using the SS suite o# utilities.
*End o# E%ercise+
(0
SUSE Linu% Enterprise 12 Adinistration
(1
SUSE Linu% Enterprise 12 Adinistration
- 2
,on(i5ure
Des#ription: n this e%ercise, you practice using SS $ith pu!lic ey authentication.
)ask 1: 9enerate an SS pen a terinal $indo$ and enter the #ollo$ing coand to generate an SS ey pair9
ss&-$eygen -t rsa -b =78> . Accept the de#ault location #or the ey * /&ome/tux/.ss&/id_rsa+ (. Enter a passphrase o#9 s$es12 n#oration a!out your ey pair, such as the location o# your identi#ication and the pu!lic ey, is displayed
)ask 2: Up$oad t*e !ub$i# n ser&er1 2. Enter the #ollo$ing coand to upload your pu!lic ey to tu% on ser&er29
ss&-copy-id -i )/.ss&/id_rsa.pub tux:(;.(;.. @hen propted, enter tu%Os pass$ord #or ser&er2 . A#ter authentication you should see a essage that the ey $as uploaded success#ully
)ask : Veri("
ss& tux:(;.(;.. 4ou should !e propted #or a passphrase to unloc the private ey *s$es12+ 2. Log in then log out !y entering9
exit
. >n ser&er1, enter the #ollo$ing coand to deterine i# the SS Agent has !een started9
ps aux grep -i ss&-agent (2
SUSE Linu% Enterprise 12 Adinistration
4ou should see an ssh/agent process #or your user account. # the SS Agent is not yet running #or your account, start it !y entering the #ollo$ing coand9
eval ?@ss&-agent -s (. Enter the #ollo$ing coand to add your ey to the SS Agent9
ss&-add 5. @hen propted, enter the passphrase o# each o# the eys that are !eing added to the ssh/agent *s$es12+ <. >n ser&er1, enter the #ollo$ing coand to connect to ser&er2 via ssh as tu% again9
ss& tux:(;.(;.. 6his tie you are not propted #or a pass$ord or passphrase !ecause the ssh/agent provided the ey #or you ?. Stay logged into ser&er2 #or the ne%t tas
)ask : Disab$e !ass'ord 8ased Lo5ins 1. Using ser&er2 enter9
su – $ith pass$ord $inux to !ecoe root 2. n the te%t editor o# your choice, open the /etc/ss&/ss&d_con'ig #ile to !e edited . Locate the line that !egins $ith9 !ass'ordAut*enti#ation and ae sure it is set to9 no (. Locate the line that !egins $ith9 Use!A4 and change the value to9 no 5. Save the #ile and close the te%t editor <. Enter the #ollo$ing coand to restart the ssh daeon9
systemctl restart ss&d ?. @hile still on ser&er2, enter the #ollo$ing coand to connect !ac to localhost9
ss& tux:local&ost and $hen ased $hether you $ant to continue connecting, enter9
yes 4ou should see an error essage and no propt #or a pass$ord :. >n ser&er2, log out as root !y entering9
(
SUSE Linu% Enterprise 12 Adinistration
exit '. Log out #ro ser&er2 !y entering9
exit 10.ro your tu% account on ser&er1, log !ac in to ser&er2 !y entering9
ss& tux:(;.(;.. 11. 8espite your changes o# the sshd con#iguration on ser&er2 you should still !e a!le to log in !ecause you are using pu!lic ey authentication 12.S$itch to the root user account on ser&er2 $ith the su – coand and in the te%t editor o# your choice, open the /etc/ss&/ss&d_con'ig #ile and undo the changes ade at the !eginning o# this tas 1.-estart the ssh daeon9
systemctl restart ss&d 1(.>n ser&er2, log out as root !y entering9
exit 15. Log out #ro ser&er2 !y entering9
exit
Summar": n this e%ercise, you practiced using SS $ith pu!lic ey authentication.
*End o# E%ercise+
((
SUSE Linu% Enterprise 12 Adinistration
-
emote Administration u sin5 V ,
Des#ription: Con#igure and use reote adinistration. n this la! you $ill reotely anage server2 #ro server1 using ;"C.
)ask 1: ,*e#k remote administration is not enab$ed on ser&er2 1. Logged in as tux to ser&er2 run ;ast2 and $hen propted enter the rootOs pass$ord9 $inux 2. >pen the -eote Adinistration *;"C+ odule. "otice that -eote Adinistration is currently disa!led. . Cancel the -eote Adinistration con#iguration dialogue !o%
)ask 2: )r" to remote$" administer ser&er1 (rom ser&er2 1. >n ser&er1 logged in as tux open a terinal $indo$ 2. n the terinal $indo$ run the vncvie$er and attept to connect to ser&er29 vncvie$er server2.suse.co91 6he session does not connect. . 6erinate the vncvie$er9 =ress Enter At this point $e no$ the reote adinistration is disa!led on ser&er2 !ut there could also !e #ire$all issues.
)ask : Enab$e remote mana5ement on ser&er2 1. >n ser&er2 run "ast 2. Select9 -eote Adinistration *;"C+ . Select the #ollo$ing9 A$$o' !ort emote Administration %pen in (ire'a$$: ,*e#kedWit*out Session 4ana5ement: Se$e#ted (. Select9 %< 6o save your changes (5
SUSE Linu% Enterprise 12 Adinistration
5. -ead the $arning and select9 %< <. Change to the #irst virtual console9 ro the enu select Send
)ask : emote$" administer ser&er2 (rom ser&er1 1. >n ser&er1 in a terinal $indo$ as tu% start the vncvie$er and connect to ser&er29 vncvie$er server2.suse.co91 2. At the certi#icate $arning clic9 ;es to continue . At the Certi#icate ssuer unno$n dialogue !o% select9 ;es (. n the ;"C session login as tux 5. Close the reote adinistration session
Summar": Server2 $as con#igured to allo$ reote adinistration and the port in the #ire$all $as opened. A reote session $as initiated #ro server1 using the vncvie$er client.
*End o# E%ercise+
(<
SUSE Linu% Enterprise 12 Adinistration
/ S"stem nitia$i3ation Des#ription: 4o $ill e%aine the !oot process. 4ou $ill then anage services using systed.
(?
SUSE Linu% Enterprise 12 Adinistration
/- 1
Se#ure 9U8 'it* a !ass'ord
Des#ription: n this e%ercise, you set a pass$ord on )-U.
)ask 1: Se#ure A##ess to 9U8 'it* a !ass'ord 1. Using ser&er1 open a terinal $indo$ and i# not already logged in as the root user, enter9
su – to !ecoe root 2. Enter the #ollo$ing coand to generate an encrypted pass$ord to !e used #or )-U9
grub-m$pass%d-pb$d' . Enter the #ollo$ing pass$ord9
secret (. Copy the $hole pass$ord #ro the terinal $indo$ into the clip!oard Attention9 6he pass$ord starts $ith grub.pbkdf2.sha512 and loos lie this9 gru!.p!d#2.sha512.10000.'CEAE58<<:?0'0C?AC8
set superusersB3root3 pass%ord_pb$d' root CRE_FG -eplace GRUB_PW !y the encrypted pass$ord you generated in step 2 ?. Save the #ile and close the te%t editor :. 6o iport your changes, enter the #ollo$ing9
grub-m$con'ig -o /boot/grub/grub.c'g
)ask 2: )est t*e 9U8 !ass'ord 1. -e!oot ser&er1 2. 6o stop the countdo$n, press the up or do$n arro$ ey . 6ry to open edit the enu entry !y pressing9
(:
SUSE Linu% Enterprise 12 Adinistration
e 4ou should !e propted to enter a usernae (. Enter9
root and press Enter 5. 4ou should !e propt ed to enter a pass$o rd. Enter the pass$ord you set previously *se#ret+ <. 4ou should no$ !e a!le to edit the enu ites ?. 6o return to the )-U enu, press9
Hsc
:. Select the de#ault !oot entry and continue to !oot '. Log in as root and undo the changes ade previously in this tas
Summar": n this e%ercise, you set a pass$ord on )-U.
*End o# E%ercise+
('
SUSE Linu% Enterprise 12 Adinistration
2
4ana5e Ser&i#es
Des#ription: n this e%ercise, you anage services $ith the systemctl coand.
)ask 1: 4ana5e Ser&i#es 1. Using ser&er2 logged in as tux open a terinal $indo$ and enter9
su to !ecoe root. 2. ;ie$ the status o# the "et$or 6ie =rotocol *"6=+ daeon9
systemctl status ntpd . Unless it has !een changed #ro the de#ault installation, it is not ena!l ed and not active. 6he output should loo lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled) Active: inactive (dead) Docs: man:ntpd(1)
(. Start the "6= daeon9
systemctl start ntpd 5. Alternatives #or the a!ove coand areQ
service ntpd start or
rcntpd start <. Chec the status again9
systemctl status ntpd ?. 4ou should see that the ser vice is active, $ith the last 10 lines o# log ess ages #ro "6=. 6he output should !egin siilar lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service;
disabled)
Active: active (running) since Thu 2014-10-23 09:09:36 EDT; 1min 0s ago Docs: man:ntpd(1) Process: 5461 ExecStart=/usr/sbin/start-ntpd start (code=exited, status=0/SUCCESS) Main PID: 5474 (ntpd) CGroup: /system.slice/ntpd.service
50
SUSE Linu% Enterprise 12 Adinistration └─5474
/usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u ntp:ntp -i
/v...
:. Chec to see i# the "6= daeon is ena!led9
systemctl is-enabled ntpd "otice that the service is ared as disab$ed '. Ena!le the "6= daeon to ae sure it starts $hen the syste !oots9
systemctl enable ntpd 10.Chec the status again9
systemctl status ntpd 11. 6he output should !egin lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service;
enabled)
"otice that the service is no$ ared as enab$ed 12.-evie$ systed in#oration regarding "6= daeon9
systemctl s&o% ntpd.service less 1.6o e%it less press9
1(.ind out $hich target starts ntpd9
'ind /etc/systemd/ -name 3ntp3 'ind /usr/lib/systemd/ -name 3ntp3 15."6= daeon is started in the ulti/user target 1<.;ie$ the currently active targets9
systemctl list-units --typeBtarget 1?.;ie$ the dependencies #or the ulti/user target9
systemctl s&o% -p 3Reuires3 multi-user.target systemctl s&o% -p 3Gants3 multi-user.target 1:.8isa!le the "6= daeon9
systemctl disable ntpd 1'.Chec the status again9
systemctl status ntpd 20.6he output should !egin lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service;
disabled)
Active: active (running) since Thu 2014-10-23 09:09:36 EDT; 11min ago
"otice that the service is no$ ared as disa!led, !ut it is still running 51
SUSE Linu% Enterprise 12 Adinistration
21.Stop the "6= daeon9
systemctl stop ntpd 22.Chec the status again9
systemctl status ntpd 2.6he output should !egin lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled) Active: inactive (dead)
2(.&as the "6= daeon unit #ile9
systemctl mas$ ntpd
25.Chec the status again9
systemctl status ntpd 2<.6he output should !egin lie this9 ntpd.service Loaded9 ased *FdevFnull+ Active9 inactive *dead+ 2?.6ry to start ntpd again9
systemctl start ntpd 2:."6= does not start !ecause it is ased 2'.Unas the ntpd service9
systemctl unmas$ ntpd 0.Chec the status again9
systemctl status ntpd 1.6he output should !egin lie this9 ntpd.service - NTP Server Daemon Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled) Active: inactive (dead)
Summar": n this e%ercise you started, stopped, ena!led, disa!led, ased and unased the "6= service using the applica!le systemctl coands.
*End o# E%ercise+
52
SUSE Linu% Enterprise 12 Adinistration
/-
Work 'it* s"stemd )ar5ets
Des#ription: n this e%ercise, you $or $ith systedOs target units.
)ask 1: ,*an5e to Di((erent )ar5ets 1. Using ser&er2 logged in as tu% open a terinal $indo$ and s$itch to the root user account9
su 2. ;ie$ the con#igured targets9
systemctl list-units --type target . n the terinal $indo$, enter9
systemctl isolate multi-user.target 6he graphical inter#ace shuts do$n and you are s$itched to the #irst virtual console (. ro the enu select Send
systemctl isolate rescue.target 4ou see a !rie# list o# instructions on ho$ to change to a di##erent target or ho$ to re!oot the syste ?. At the propt, enter the root pass$ord * $inux+
)ask 2: 8oot into a Di((erent )ar5et 1. -e!oot ser&er2 2. @hen the !oot screen appears, press
e to edit the ernel coand line . *Conditional+ # you are propted to enter a !oot pass$ord, enter9
secret
(. &ove the cursor do$n to the line that starts $ith $inux and ove the cursor to the end o# that line. Add the #ollo$ing te%t at the end9 s"stemd.unitGemer5en#".tar5et 5. ro the virtual achine $indo$ select Send
SUSE Linu% Enterprise 12 Adinistration
<. # reuested at the propt, enter the root pass$ord ?. Start the graphical user inter#ace9
systemctl isolate grap&ical.target :. Conditional9 Soeties there is a pro!l e starting the graphical inter#ace on the v achine, i# you have a pro!le restart ser&er2 '. Log in to the graphical environent as tux
)ask : Add Ser&i#es to and emo&e Ser&i#es (rom a )ar5et Unit 1. Using ser&er2, as root log in to a virtual terinal, or, in the graphical environent, open a terinal $indo$ and su - to root 2. Enter the #ollo$ing9
la /etc/systemd/system/multi-user.target.%ants/ grep ss&d 4ou should see in the output that ss&.service is a lin to
/usr/lib/systemd/system/ss&d.service . 6o copy the e%isting ss&d.service #ile to /etc/systemd/system/, enter the #ollo$ing in one line9
cp /usr/lib/systemd/system/ss&d.service /etc/systemd/system/ (. >pen the /etc/systemd/system/ss&d.service #ile in an editor such as vi and replace the e%isting line9
GantedEyBmulti-user.target !y
GantedEyBgrap&ical.target 5. Save the #ile and close the editor <. 6he con#iguration in /etc/systemd/system/ss&d.service $ill override the con#iguration in /usr/lib/systemd/system/ss&d.service ?. Ena!le the ne$ con#iguration9
systemctl reenable ss&d :. Enter the #ollo$ing9
la /etc/systemd/system/multi-user.target.%ants/ grep ss&d 4ou should get no output. 6he lin is reoved '. Enter the #ollo$ing9
la /etc/systemd/system/grap&ical.target.%ants/ grep ss&d 4ou should see in the output that ss&.service is a lin to
/etc/systemd/system/ss&d.service 10.6o undo the change, reove the /etc/systemd/system/ss&d.service #ile and 5(
SUSE Linu% Enterprise 12 Adinistration
reena!le the service again9
rm /etc/systemd/system/ss&d.service systemctl reenable ss&d As there is no /etc/systemd/service/ss&d.service #ile anyore, the installed con#iguration in /usr/lib/systemd/system/ss&d.service is used again
Summar": n this e%ercise, you $ored $ith systedOs target units.
*End o# E%ercise+
55
SUSE Linu% Enterprise 12 Adinistration
7 !ro#ess 4a na5ement Des#ription: n this section you $ill anage processes, schedule 3o!s and use %inetd.
5<
SUSE Linu% Enterprise 12 Adinistration
7- 1
4odi(" !ro#ess !riorities
Des#ription: n this e%ercise you odi#y process priorities using the nice and renice coands.
)ask 1: 4odi(" !ro#ess !riorit" 1. >n ser&er1 logged in as tux start the 9%4E S"stem 4onitor tool9 ro the App$i#ations enu select Uti$ities S"stem 4onitor 2. n the Syste &onitor dialog, clic the !ro#esses ta! and search #or the 5nomes"stem-monitor entry in the list o# processes. -ecord the =8 *colun 8+ #or gnoe/ syste/onitor9 . KKKKKKKKK (. >pen a terinal $indo$ 5. 6o vie$ all running processes enter9
ps xl *lo$er case L+ "otice that the nice value *"+ is currently at 0 <. 8ecrease the priority o# the process to a nice value o# 5 !y entering9
renice 0 -p 4PID_OF_SYSTEM-MONITOR_PROCESS> ?. ncrease the priority o# the process to a nice value o# /5 !y entering9
renice -0 -p 4PID_OF_SYSTEM-MONITOR_PROCESS> "ote9 A regular user can change the nice value !ut is only allo$ed to decrease the priority. :. S$itch to root * su -+ '. 6ry setting the nice value to /5 again !y entering9
renice -0 -p 4PID_OF_SYSTEM-MONITOR_PROCESS> 10.Chec that the setting is e##ective !y entering9
ps xl *lo$er case L+ "otice that the process is not displayed, !ecause only displays processes ps xl $as started !y tu% not root started !y the current user. 6he Syste &onitor progra 11. ;ie$ all processes !y entering9
ps axl *$ith a lo$er case L+ 6he Syste &onitor process is no$ displayed, $ith a nice value o# /5
5?
SUSE Linu% Enterprise 12 Adinistration
12.Change the nice value #or the Syste &onitor process to a higher priority !y entering9
renice -(7 -p 4PID_OF_SYSTEM-MONITOR_PROCESS> 1.;eri#y that the gnoe/syste/onitor process nice value is set to /10 !y entering9
ps axl *$ith a lo$er case L 1(.E%it the shell running as root !y entering9
exit 15.4ou should no$ !e user tu% again
)ask 2: Spe#i(" !ro#ess !riorit" at !ro5ram Start 1. Start the xe"es progra in the !acground $ith the nice value o# R10 !y entering9
nice xeyes 2. ;eri#y that the %eyes process nice value is set to R10 !y entering9
ps axl
)ask : )erminate !ro#esses 1. 6o ill the gnoe/syste/onitor, enter9
$ill 4PID_OF_SYSTEM-MONITOR_PROCESS> 2. 6o ill all %eyes processes, enter9
$illall xeyes . Close your terinal $indo$
Summar": n this e%ercise, you odi#ed process priorities using the nice and renice coands.
*End o# E%ercise+
5:
SUSE Linu% Enterprise 12 Adinistration
7- 2
4ana5e Linux !ro#esses and Hobs
Des#ription: n this e%ercise, you practice starting and stopping processes.
)ask 1: Disp$a" Linux !ro#esses 1. Using ser&er1 open a terinal $indo$ and enter9
su – to !ecoe root 2. At the coand line, display the processes that are currently o$ned !y tu% !y entering9
ps -lu tux *$ith a lo$ercase L+ . 8isplay the processes that are currently o$ned !y root !y entering9
ps -lu root
)ask 2: 4ana5e Linux Hobs 1. n the terinal $indo$, start the )">&E Syste &onitor progra !y entering9
gnome-system-monitor
"otice that the terinal is not availa!le to receive ne$ coands !ecause no coand line is displayed. 6his is !ecause the )">&E Syste &onitor progra is running in the #oreground 2. Arrange the )">&E Syste &onitor $indo$ and the terinal $indo$ so that you can see the !othQ then select the terinal $indo$ to activate it . Suspend the Syste &onitor progra !y pressing9
trl+J (. 6ry using the Syste &onitor tool display processes ecause its process $as suspended, the tool does not respond 5. ;ie$ the 3o! in the !ac ground !y entering9
2obs 4ou should see that the gnoe/syste/onitor 3o! is stopped <. ;ie$ the gnoe/syste/onitor process running #ro the current terinal !y entering9
ps -l 6he process sho$s a status o# 6, $hich indicates that it is !eing traced or stopped 5'
SUSE Linu% Enterprise 12 Adinistration
?. -esue the Syste &onitor progra running in the !acground !y entering9
bg ( "otice that the Syste &onitor progra is running again. ecause it7s running in the !acground, you can no$ use the terinal $indo$ to enter other coands :. ;eri#y that the 3o! status is running !y entering9
2obs 4ou should see that the gnoe/syste/onitor 3o! is no$ running '. ;ie$ the )">&E Syste &onitor !ranch in the process tree !y entering
pstree -p grep - 0 gnome-system-mo *-C
5
displays 5 lines a!ove and 5 lines !elo$ the line that atches+
"otice that the gnoe/syste/onitor process is listed at the end o# the tree 10.ring the gnoe/syste/onitor process into the #oreground !y entering9
'g ( 11. Close the Syste &onitor progra
)ask : Start !ro#esses t*at 5nore A9U! 1. Start the Syste &onitor in the !acground !y entering9
no&up gnome-system-monitor %)E9 6he no&up coand runs a coand in such a $ay that it ignores any A")U= ill signals sent to it. 2. Close the terinal $indo$. . n the $arning dialog, clic ,$ose )ermina$ 6he )">&E Syste &onitor progra reains running (. >pen a ne$ terinal $indo$ and as user tux start the top progra !y entering9
top 5. ;ie$ only the processes started !y root !y typing9
u then entering9
root <. Chec #or the Syste &onitor progra *gnoe/syste/onitor+ listed in top >,onditiona$@ # you cannot #ind the gnoe/syste/onitor process, try a%iiing the terinal $indo$. 4ou can also activate the Syste &onitor $indo$ and s$itch !et$een the =rocesses, -esources and ile Systes lists. 6his should cause the gnoe/ syste/onitor process to !e oved near the top o# the output in top ?. 4ou can also enter K in top and select =8 as the sort colun. # needed, you can also <0
SUSE Linu% Enterprise 12 Adinistration
reverse the sort order !y pressing R :. -ecord the =8 o# the gnoe/syste/onitor process9 '. KKKKKKKKKKKKKK 10. E%it top !y typing9
11. ;ie$ in#oration a!out the gnoe/syste/onitor process !y entering9
ps 4PID_OF_SYSTEM-MONITOR_PROCESS>
)ask : )erminate Linux !ro#esses 1. S$itch to your root user account using the su – coand 2. Stop the Syste &onitor progra and chec the status !y entering the #ollo$ing coands9
$ill 4PID_OF_SYSTEM-MONITOR_PROCESS> ps aux grep gnome-system-monitor . Start the %eyes progra in the !acground !y entering9
xeyes (. Start a second %eyes progra in the !acground !y entering9
xeyes 5. Bill all %eyes progras !y entering9
$illall xeyes
Summar": n this e%ercise you practiced starting and stopping processes.
*End o# E%ercise+
<1
SUSE Linu% Enterprise 12 Adinistration
7-
Use t*e s#reen ,ommand
Des#ription: n this e%ercise you use the screen coand to launch processes in ne$ pseudo terinals and then detach #ro and reattach to these pseudo terinals.
)ask 1: Use t*e s#reen ,ommand 1. Using ser&er1 logged in as tux open a terinal $indo$ 2. 6o log in ser&er2 via SS enter9
ss& (;.(;.. . Enter the #ollo$ing coand to launch a ne$ screen session9
screen (. =ress Enter to close the $elcoe screen and to see a coand propt 5. Enter the #ollo$ing coand to launch the top process in the screen session9
top <. 4ou should see the top coand running ?. Enter the #ollo$ing eystroes to detach #ro the screen sessions9
trl+AL trl+D 4ou should !e detached #ro the screen session :. Enter the #ollo$ing coand to vie$ the list o# currently running screen sessions9
screen -list 4ou should see only one screen session running. ts nae is NPID>.Csession_name, $here NPID> is the process 8 and Csession_name is the nae o# the pseudo terinal and host nae. '. Enter the #ollo$ing coand to reattach to the running screen session9
screen -r 4ou should !e reattached to the screen session and should see the top coand still running 10.8etach #ro the screen session again *trl+AL trl+D+, and log out o# ser&er2 !y entering9
exit
<2
SUSE Linu% Enterprise 12 Adinistration
11. 6o log !ac into ser&er2 again, enter9
ss& (;.(;.. 12.>pen a terinal $indo$ and list the running screen session9
screen -list 4ou should see the screen sessions is still running 1. nstall the s"sstat pacage9
sudo 1ypper in sysstat and ans$er9
y
to install the pacage. 1(.Enter the #ollo$ing coand to launch a ne$ coand in a ne$ screen session, give the screen session a descriptive nae and then iediately detach #ro the screen session9
screen -# mpstat -d -m mpstat 15.List the currently running screen sessions again9
screen -list 4ou should see t$o screen sessions running $ith the ne$ one having the descriptive nae o# GpstatH rather than the pseudo terinal nu!er and host nae 1<.Enter the #ollo$ing coand to reattach to the GtopH screen session9
screen -r 4PID>. *@here the NPID> is the process 8 and Csession_name is the pseudo terinal nu!er and host nae+ 4ou should !e reattached to the GtopH screen session 1?.6erinate the GtopH process !y pressing9
4ou should see that the process is no longer running 1:.List the current screen sessions again9
screen -list 4ou should see that you are still attached to the GtopH screen session 1'.Enter the #ollo$ing coand to terinate the screen session you are attached to9
exit 20.List the screen sessions again9
screen -list 4ou should see that the screen session you $ere previously attached to is gone 21.-eattach to the other screen session9 <
SUSE Linu% Enterprise 12 Adinistration
screen -r 22. 6erinate the mpstat coand !y pressing9
trl+ 4ou should see the coand terinating and the screen session terinating as $ell ote9 6erinating a coand that $as launched in a detached screen session terinates the screen session at the sae tie. 2.List the current running screen sessions again9
screen -list 4ou should see that there are no screen sessions running 2(.6o log out o# ser&er2, enter9
exit
Summar": n this e%ercise you used the screen coand to launch processes in ne$ pseudo terinals and then detached #ro and reattached to these pseudo terinals.
*End o# E%ercise+
<(
SUSE Linu% Enterprise 12 Adinistration
7-
S#*edu$e Hobs 'it* #ron and at
Des#ription: n this e%ercise you practice scheduling 3o!s using the at and cron daeons.
)ask 1: S#*edu$e Hobs 'it* at 1. Using ser&er1 open a terinal $indo$ as tux 2. S$itch to root using the su - coand . Chec to see i# the at service is running !y entering the #ollo$ing at the shell propt9
systemctl status atd.service # the coand returns that the status is inactive, enter the #ollo$ing at the shell propt9
systemctl start atd.service (. 8isplay the current date and tie !y entering the #ollo$ing at the shell propt9
date 5. 6hree inutes #ro no$, log $ho is currently logged in to the /var/log/messages #ile !y entering the #ollo$ing coands9 at HH:MM *-eplace HH:MM $ith an hour and inute setting inutes #ro no$+
'inger ** /var/log/messages <. E%it the at editor !y pressing9
trl+D ?. ;ie$ the scheduled at 3o!s !y entering9
at or
at -l "ote the 3o! nu!er listed9 :. KKKKKKKKKKKKKK '. Enter the #ollo$ing at the sh ell propt9
tail -' /var/log/messages 10.@ait #or the rest o# the three inutes to pass <5
SUSE Linu% Enterprise 12 Adinistration
Login in#oration #or tu% is listed at the end o# the #ile 11. Stop the tail coand !y entering9
trl+ 12.Schedule the sae 3o! to run toorro$ at noon !y entering the #ollo$ing coands9
at noon tomorro% 'inger ** /var/log/messages 1.E%it the at editor !y pressing9
trl+D 1(.Schedule the date to !e logged toorro$ at 2900 p.. to the /var/log/messages #ile !y entering the #ollo$ing9
at (=<77 tomorro% date ** /var/log/messages 15. E%it the at editor !y pressing9
trl+D 1<.;ie$ the scheduled at 3o!s !y entering9
at or
at -l "otice that the t$o 3o!s are listed, each $ith an individual 3o! nu!er 1?.-eove the 3o! scheduled #or toorro$ at 2900 p.. !y entering9
atrm JOB_NUMBER -eplace JOB_NUMBER $ith the 3o! nu!er listed #ro the at coand, a!ove 1:.;ie$ the scheduled at 3o!s !y entering9
at or
at -l >nly the 3o! scheduled #or 12900 p.. should still !e listed
)ask 2: S#*edu$e Hobs 'it* #ron
1. At the shell propt ae sure you are logged in as tu% 2. Schedule a cron 3o! as tu% !y entering the #ollo$ing at the shell propt9
crontab -e 6he vi editor is displayed $ith tu%7s cronta! #ile loaded <<
SUSE Linu% Enterprise 12 Adinistration
. =ress the nsert ey to enter insert ode (. 6o schedule #inger to run every inute and $rite the output to the )/users.log #ile !y enter the #ollo$ing9
'inger ** )/users.log and press9
Hsc 5. 6o save the #ile and e%it the vi editor !y enter9
<% <. @atch the users.log #ile #or a #e$ inutes and validate that it is !eing updated !y entering the #ollo$ing at the shell propt9
tail -K )/users.log 6he -K option is a shortcut #or -' --retry that eeps trying to open a #ile even i# it is inaccessi!le $hen tail starts ?. @hen #inished, press9
trl+ to !rea out o# tail :. -eove tu%7s crontab #ile !y entering the #ollo$ing at the shell propt9
crontab -r '. ;eri#y that the crontab #ile no longer e%ists !y entering the #ollo$ing at the shell propt9
crontab -l 10.;eri#y that the cron 3o! you de#ined in Step 2 is no longer active !y entering the #ollo$ing at the shell propt9
tail -' )/users.log "otice that entries to users.log are no longer !eing added 11. =ress9
trl+
)ask : S#*edu$e a #ron Hob as root 1. At the shell propt, enter9
su -
#ollo$ed !y a pass$ord o# $inux 2. Enter9
crontab -e . =ress the nsert ey.
SUSE Linu% Enterprise 12 Adinistration
(. Add a 3o! that runs at 2900 a.. every 6uesday and creates a tar!all o# /etc that is saved in /tmp !y entering the #ollo$ing9
7 tar c1v' /tmp/etc.tg1 /etc 5. =ress9
Hsc <. 6o save the #ile and e%it the vi editor !y enter9
<% ?. propt9 ;eri#y that the 3o! is in the crontab #ile #or root !y entering the #ollo$ing at the shell
crontab -l :. -eove root7s crontab #ile !y entering the #ollo$ing at the shell propt9
crontab -r '. ;eri#y that the crontab #ile no longer e%ists !y entering the #ollo$ing at the shell propt9
crontab -l 10.Close all open $indo$s
Summar": n this e%ercise you scheduled 3o!s using the at and cron daeons.
*End o# E%ercise+
<:
SUSE Linu% Enterprise 12 Adinistration
7-
,on(i5ure xinetd
Des#ription: n this e%ercise you $ill use the 4aS6 "et$or Services *%inetd+ odule to set services. 4ou then anually setup a service $ith %inetd.
)ask 1: Enab$e t(tp &ia xinetd 'it* ;aS) 1. >n ser&er1 in a terinal $indo$ as user tux chec i# the t(tp pacage is installed9 #n( t(tp 2. nstall the t(tp pacages9 sudo 3"pper --non-intera#ti&e in t(tp . Enter the root pass$ord * $inux+ $hen propted (. Launch the ;aS) ,ontro$ ,enter and enter the root users pass$ord 5. n 4aS6 select et'ork Ser&i#es et'ork Ser&i#es >xinetd@ 6he et'ork Ser&i#es ,on(i5uration >xinetd@ dialog appears <. Select Enab$e 6he list o# currently availa!le services !ecoes active ?. Scroll do$n and select the service t(pd *Ser&er: usrsbinin.t(tpd+, then set the service to %n !y selecting )o55$e Status >%n or %((@ # the t#tpd pacage $as not installed, it $ould !e installed no$. :. Save the con#iguration to the syste !y clicing +inis* '. -evie$ the /etc/xinetd.d/t'tp #ile. Loo #or the server/args line and note the server directory a#ter the -s option9 sr&t(tpboot 10. Change to the root user9
su and enter the root users pass$ord, $inux 11. Copy soe #ile to that directory9
cp /etc/motd /srv/t'tpboot 12. 6est the t#tp server $ith the #ollo$ing coands9
t'tp local&ost get motd uit 1.Chec i# the otd #ile is no$ in your current directory9
ls motd
<'
SUSE Linu% Enterprise 12 Adinistration
)ask 2: Enab$e t*e rs"n# Daemon &ia xinetd 4anua$$" 1. >n ser&er1, in a terinal $indo$ enter su - to !ecoe root 2. n the te%t editor o# your choice, open the /etc/xinetd.d/rsync #ile. . At the !otto o# the #ile, change the #ollo$ing9 disab$e G "es to disab$e G no (. Save the changes and close the te%t editor 5. n the te%t editor o# your choice open the /etc/rsyncd.con' #ile <. Add the #ollo$ing at the end o# the #ile9 IomeJ pat* G *ome #omment G ome Dire#tories ?. Save the #ile and close the te%t editor :. -estart the %inetd service9
systemctl restart xinetd.service '. 6o test the rsync service, open a terinal $indo$ and enter9
rsync local&ost<< 10.4ou should see the oe odule de#ined a!ove
Summar": n this e%ercise you used the 4aS6 "et$or Services *%inetd+ odule to set up a t#tp server on your coputer. 4ou then anually con#igured the rsync server in FetcF%inetd.dF to activate the service.
*End o# E%ercise+
?0
SUSE Linu% Enterprise 12 Adinistration
dentit" and Se#urit" Des#ription: n this section you $ill anage users and groups. 4ou $ill also anage perissions and access control lists. 4ou $ill then con#igure user privileges.
?1
SUSE Linu% Enterprise 12 Adinistration
- 1
4ana5e Users 'it* ;aS)
Des#ription: n this e%ercise you $ill use 4aS6 to create and delete user accounts.
)ask 1: ,reate a e' User A##ount 'it* ;aS) 1. Using ser&er1 log in as tux 2. 6o start ;aS)9 ro the App$i#ations enu select S"stem )oo$s ;aS) . @hen propted enter the root pass$ord * $inux+ (. Scroll do$n to the Se#urit" and Users section and select User and 9roup 4ana5ement 5. >n the Users ta!, add a ne$ user !y selecting Add <. Enter the #ollo$ing in#oration9 UserBs +u$$ ame: Emperor !en5uin Username: emperor !ass'ord: $inux ,on(irm !ass'ord: $inux @hen you #inish, clic %<. ?. Con#ir the pass$ ord $arning !y clic ing ;es :. Save the ne$ settings !y clicing %< '. Close the ;aS) ,ontro$ ,enter $indo$
)ask 2: Lo5 in as t*e e' User 1. Close any open $indo$s and log out as user tux9 Clic on the =o$er icon at the !otto right hand end o# the tas!ar, select )ux !en5uin F Lo5out F Lo5out 2. Log in as user Emperor !en5uin $ith pass$ord $inux . *Conditional+ Close or cancel any displayed dialogs
)ask : Vie' t*e pass'd +i$e 1. Start the +i$e 8ro'ser !y dou!le/clicing ome icon on the destop 6he content o# eperor7s hoe directory is displayed 2. ro$se the ile Syste to the /&ome directory *%t*er Lo#ations F ,omputer F *ome+ ?2
SUSE Linu% Enterprise 12 Adinistration
"otice there are directories #or users emperor and tux . ro$se the ile Syste to the /etc directory *%t*er Lo#ations F ,omputer et# + (. >pen the pass%d #ile !y dou!le/clicing it "otice the entries #or users emperor and tux at the end o# the #ile 5. Close all $indo$s
)ask : emo&e t*e e' User A##ount 1. Log out as user emperor 2. Log in as )ux !en5uin . (. 5. <. ?. :. '.
Start ;aS) and enter the root pass$ord *$inux+ Select Se#urit" and Users section select User and 9roup 4ana5ement ro the list o# users, select emperor then clic De$ete Select De$ete ome Dire#tor" *omeemperor , clic ;es and then %< Close the ;aS) ,ontro$ ,enter $indo$ 6o con#ir that the user eperor has !een reoved continue $ith the ne%t steps Start the "autilus #ile anager
10.ro$se the ile Syste to the /&ome directory "otice there is only one entry #or user tu% 11. ro$se to the /etc directory and open the pass%d #ile "ote that the entry #or emperor has !een reoved #ro the end o# the #ile 12.Close all open $indo$s
Summar": n this e%ercise you used 4aS6 to create and delete user accounts.
*End o# E%ercise+
?
SUSE Linu% Enterprise 12 Adinistration
- 2
4ana5e Users and 9roups (rom t*e ,ommand Line
Des#ription: n this e%ercise you add, odi#y and reove local users and groups using the coand line utilities.
)ask 1: ,reate a Lo#a$ User A##ount (rom t*e ,ommand Line 1. Using ser&er1 open a terinal $indo$ and i# not already logged in as the root user, enter9
su – to !ecoe root. 2. Enter the #ollo$ing coand to create a ne$ local user9
useradd -m -c 3Hmperor Fenguin3 emperor . Enter the #ollo$ing coand to veri#y that the user $as created9
getent pass%d grep emperor 4ou should see the ne$ eperor user listed *getent is a coand to get entries #ro an adinistrative data!ase, such as the user data!ase+ (. Enter the #ollo$ing coand to veri#y that the eperor userOs hoe directory $as created9
ls -l /&ome 4ou should see the eperor userOs hoe directory listed 5. Enter the #ollo$ing coand to vie$ the eperor user entry in the /etc/pass%d #ile9
grep emperor /etc/pass%d 4ou should see the eperor user line listed <. Enter the #ollo$ing coand to vie$ the eperor user entry in the /etc/s&ado% #ile9
grep emperor /etc/s&ado% 4ou should see theemperor user line listed. 4ou should also see that the pass$ord #ield contains a GKH, indicating that no pass$ord is set #or the eperor user ?. Enter the #ollo$ing coand to set the pass$ord #or the eperor user9
pass%d emperor and enter and con#ir the pass$ord o# $inux *ignore any $arnings+
?(
SUSE Linu% Enterprise 12 Adinistration
:. Loo at the eperor entry in the /etc/s&ado% #ile again9
grep emperor /etc/s&ado% 4ou should see the encrypted pass$ord in the eperor user line no$
)ask 2: ,reate and Add Users to a e' Lo#a$ 9roup 1. Enter the #ollo$ing coand create a ne$ local group9
groupadd admins 2. Enter the #ollo$ing coand to veri#y that the group $as created9
getent group 4ou should see the ne$ admins group listed . Enter the #ollo$ing coand to vie$ the admins group line o# the /etc/group #ile9
grep admins /etc/group "otice that there are currently no e!ers o# the group admins (. Enter the #ollo$ing coand to add the eperor user to the admins group9
usermod -a -C admins emperor # you donOt use option -a the previous e!ers o# the group are reoved #ro the group 5. Loo at the admins group line o# the /etc/group #ile again9
grep admins /etc/group 4ou should see that the eperor user is no$ a e!er o# the admins group
)ask : ,reate a e' User A##ount 'it* a Va$id !ass'ord Automati#a$$" 1. 6his is a challenge tas. 4ou are not given the ste p/!y/step instructions to per#or the tas. -ather you ust use no$ledge previously gained to success#ully coplete the tas. 6here are soe ethods availa!le that can !e used to create a user account and set a valid pass$ord #or the account $ithout !eing propted to enter the pass$ord interactively. 6hese ethods can !e used in scripting to autoate the user account creation or aintenance process. 4our tas is to discover ho$ to create a user account and set its pass$ord to a valid pass$ord $ithout !eing propted to enter a pass$ord.
?5
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise you added, odi#ied and reoved local users and groups using coand line coands.
*End o# E%ercise+
?<
SUSE Linu% Enterprise 12 Adinistration
-
4ana5e +i$e !ermissions
Des#ription: n this e%ercise, you $ill anage di##erent #ile perissions.
)ask 1: ,reate a !ri&ate and a !ub$i# Dire#tor" 1. Using ser&er1 logged in as tu%, open a terinal $indo$, and s$itch to root * su -+ 2. Create the /'iles directory !y entering9
m$dir /'iles . Change to the /'iles/ directory !y entering9
cd /'iles (. 6o create the private and pu!lic su!directories under /'iles/, enter9
m$dir private public 5. Change the perissions on the private directory so that only root has read, 'rite, and exe#ute perissions !y entering9
c&mod ;77 private <. Change perissions on the public directory so that everyone has rights to the directory !y entering9
c&mod ;;; public ?. ;eri#y the changes !y entering9
ls -l :. -eturn to the tu% user account !y entering9
exit
)ask 2: ,reate a +i$e as a orma$ User in bot* Dire#tories 1. n a terinal $indo$ as the tux user, change to the /'iles/ directory !y entering9
cd /'iles 2. 6ry to create a #ile naed tux'ile in the private directory !y entering9
touc& private/tux'ile
??
SUSE Linu% Enterprise 12 Adinistration
and you receive the essage !ermission is denied . 6ry to create a #ile naed tux'ile in the pu!lic directory !y entering9
touc& public/tux'ile (. ;eri#y that the #ile is created !y entering9
ls public 5. Change to the public directory !y entering9
cd public <. List the perissions o# the tux'ile #ile !y entering9
ls -l tux'ile "otice that e!ers o# the users group and others have only read perission #or the #ile ?. Change perissions so that e!ers o# the users group have 'rite perissions and ot*ers do not have any perissions !y entering the #ollo$ing9
c&mod g+%Lo-r tux'ile :. ;eri#y the change !y entering9
ls -l '. Close the terinal $indo$
Summar": n this e%ercise you anaged di##erent #ile perissions and o$nership.
*End o# E%ercise+
?:
SUSE Linu% Enterprise 12 Adinistration
-
,on(i5ure ! osix A,Ls
Des#ription: n this e%ercise, you $ill practice using ACLs. n the #irst tas, you $ill create the /tmp/acl_test/ directory as root and set r$% rights #or the o$ner only. 4ou then set ACLs to allo$ the tux user to change into that directory. n the second tas, you $ill create a #ile in the /tmp/acl_test/ directory as root using touch. 6hen you change the de#ault ACLs #or the /tmp/acl_test/ directory to give tux !oth read and $rite access to #iles and directories and create another #ile in that directory to copare the di##erent perissions set #or the t$o #iles. n the third tas o# this e%ercise, you $ill practice reoving the ACLs that you have set.
)ask 1: ,on(i5ure t*e A,Ls o( a Dire#tor" 1. Log in to ser&er1 as tux *pass$ord $inux+ and open a terinal $indo$ and s$itch to the root account $ith9
su *pass$ord $inux+ 2. Change to the directory /tmp/9
cd /tmp . Create a acl_test directory and set the perissions to r$% #or the o$ner *?00+9
m$dir -m ;77 acl_test (. >pen a second terinal $indo$ as the tux user 5. 6ry changing to the acl_test directory9
cd /tmp/acl_test/ 6he coand #ails !ecause tu% *$ho is not the o$ner o# the directory+ has no perission to read and change into the directory <. S$itch to the root ter inal session. 8isplay the iniu ACL o# the directory9
get'acl acl_test t should should sho$ the r'x perissions #or the o$ning user and no perission #or anyone else ?. Add an e%tended ACL9
set'acl -m u
SUSE Linu% Enterprise 12 Adinistration
:. S$itch to the tu% terinal and try to access the directory again !y entering9
cd /tmp/acl_test ecause o# the e%tended ACL, you can no$ change into the directory '. S$itch to the root ter inal and display the e%tended ACL o# the directory9
get'acl /tmp/acl_test/ t should sho$ the additional perissions #or the naed user tu% 10.;ie$ the regular perissions o# the /tmp/acl_test/ directory9
ls -ld /tmp/acl_test 6he R sign signi#ies that ACLs are set #or this #ile. "ote the group perissions T $hen there is a R sign, the group perissions no longer re#lect the perissions o# the o$ning group !ut the setting o# the ACL as.
)ask 2: ,on(i5ure De(au$t A,Ls (or a Dire#tor" 1. n the root terinal $indo$, change to the directory acl_test9
cd /tmp/acl_test 2. Create a #ile9
touc& %it&out_de'ault_acl . 8isplay the ACL o# the ne$ #ile9
get'acl %it&out_de'ault_acl ecause there is no de#ault ACL #or the parent directory, the ne$ #ile does not have an e%tended ACL either (. Set a de#ault ACL #or the acl_test directory9
set'acl -d -m u
5. ;ie$ the ACLs o# /tmp/acl_test/9
get'acl /tmp/acl_test/ <. Create another test #ile9
touc& %it&_de'ault_acl ?. 8isplay the ACL o# the ne$ #ile9
get'acl %it&_de'ault_acl ecause this #ile $as created a#ter the de#ault ACL o# the parent directory $as set, the ne$ #ile inherited the ACL. t has an entry #or the naed user tux :. Create a directory $ithin /tmp/acl_test/9
m$dir subdirectory '. 8isplay the ACL o# the ne$ d irectory9
get'acl subdirectory ecause this directory $as created a#ter the de#ault ACL o# the parent directory $as set, the ne$ directory inherited the de#ault ACL as its ACLs and also the sae de#ault ACLs that $ere set on the parent directory.
:0
SUSE Linu% Enterprise 12 Adinistration
)ask : De$ete A,Ls 1. n the root terinal $indo$, reove the ACL9
set'acl -x u
get'acl %it&_de'ault_acl 6he ACL #or the user tu% has !een reoved. # there $ere ACLs #or other users, they $ould reain una##ected . -epeat the sae #or subdirectory9
set'acl -x u
ls -l %it&_de'ault_acl 6he R sign signi#ies that there are still e%tended attri!utes *such as the as+ set #or the #ile 5. -eove all ACLs !y entering9
set'acl -b %it&_de'ault_acl <. 8isplay the ACL again !y entering the #ollo$ing coands9
get'acl %it&_de'ault_acl ls -l %it&_de'ault_acl "otice that the ACL has !een reoved ?. Close all terinal $indo$s
Summar": n this e%ercise you practiced using =>SM ACLs. n the #irst tas you created the /tmp/acl_test/ directory as root and set r$% rights #or the o$ner only. 4ou then set ACLs to allo$ the tux user to change into that directory. n the second tas you created a #ile in the /tmp/acl_test/ directory as root using touch. 6hen you changed the de#ault ACLs #or the /tmp/acl_test/ directory to give tux !oth read and $rite access to #iles and directories and created another #ile in that directory to copare the di##erent perissions set #or the t$o #iles. n the third tas o# this e%ercise you practiced reoving the ACLs that you have set.
*End o# E%ercise+
:1
SUSE Linu% Enterprise 12 Adinistration
-
Use t*e su ,ommand to E$e&ate !ri&i$e5es
Des#ription: n this e%ercise, you use the su coand to gain root perissions at the coand line.
)ask 1: Use t*e su ,ommand 1. Using ser&er1 logged in as tux open a terinal $indo$ 2. 6ry to Start 4aS6 !y entering9
/sbin/yast 4ou should see ;aS) running in ncurses ode . n the $arning dialog press9 Enter 4ou should see that ;aS) has only a liited set o# odules availa!le (. uit ;aS) !y pressing9 AL) ? 5. S$itch to root !y entering9
su <. Chec to ae sure you are logged in as root !y entering9
id ?. Start ;aS) !y entering9
yast :. 4ou should see ;aS) running in ncurses ode $ith all odules availa!le '. uit ;aS) !y pressing9 AL) ? 10.ecoe the user tu% again !y entering9
exit Summar": n this e%ercise, you used the su coand to gain root perissions at the coand line.
:2
SUSE Linu% Enterprise 12 Adinistration
*End o# E%ercise+
:
SUSE Linu% Enterprise 12 Adinistration
- /
,on(i5ure sudo (or De$e5ation o( Administration
Des#ription: n this e%ercise you con#igure sudo to delegate adinistrative privileges to a non/root user.
)ask 1: ,on(i5ure sudo 1. Using ser&er1 open a terinal $indo$ and i# not already logged in as the root user, enter su – to !ecoe root 2. At the shell propt enter9
visudo 6his opens the /etc/sudoers #ile in the ;& editor . Scroll do$n to the line that starts $ith9 De(au$ts tar5etp' . (. Coent out the #ollo$ing lines !y placing a at the !eginning o# the #ollo$ing t$o lines9
MDe'aults targetp% M GARNINCO as$ 'or t&e pass%ord o'toget&er t&e ... ... MA"" A""B@A"" A"" M !nly use t&is
)ask 2: De(ine sudo A$iases 1. Still in /etc/sudoers de#ine a UserMA$ias naed !%WEUSES that contains the tux user account !y adding the #ollo$ing line to the end o# the #ile9
ser_Alias F!GHR#HR# B tux 2. 8e#ine a ,mndMA$ias naed
mnd_Alias PFR!# B /bin/$illL /usr/bin/$illall . 8e#ine a ostMA$ias naed %S)S that contains the ser&er1 host !y adding the #ollo$ing line to the end o# the #ile9
ost_Alias !## B server( (. Using the aliases de#ined a!ove, allo$ the tux user to run the speci#ied coands on ser&er1 as root !y adding the #ollo$ing line to the end o# the #ile9
F!GHR#HR# !## B @root PFR!#
:(
SUSE Linu% Enterprise 12 Adinistration
5. 6o save your changes and close the te%t editor press9
Hsc <. 6hen enter9
<%
)ask : )est t*e sudo A$iases 1. At the shell propt *as root+, enter9
top to start the top process running 2. >pen a ne$ terinal $indo$ . At the shell propt in the ne$ terinal $indo$ *as tu%+, enter9
sudo $illall top and $hen propted, enter tu%7s pass$ord 4ou should see that top is unloaded in the #irst terinal $indo$ (. Close all open $indo$s on the destop
)ask : 9rant t*e )ux User t*e Abi$it" to ,*an5e Users !ass'ords 1. 6his is a challenge tas. 4ou are not given the ste p/!y/step instructions to per#or the tas. -ather you ust use no$ledge previously gained to success#ully coplete the tas. Use the no$ledge and sills you have learned in the previous tass to grant the tu% user the a!ility to change other usersO pass$ords. tu% should !e a!le to change the pass$ord o# any user !ut the root user $ithout having to no$ their previous pass$ord. 6here is an e%aple in the sudo an page.
Summar": n this e%ercise you con#igured sudo to delegate adinistrative privileges to a non/root user.
*End o# E%ercise+
:5
SUSE Linu% Enterprise 12 Adinistration
- 7
9rant Administrati&e !ri&i$e5e 'it* !o$i#"
Des#ription: n this e%ercise you use =olicyBit to grant the a!ility to change the syste tie to a non/root user.
)ask 1: )r" to Use t*e 9%4E Date N )ime )oo$ 1. Using ser&er1 logged into )">&E as the tux user open the 9%4E ,ontro$ ,enter and select App$i#ations S"stem )oo$s Settin5s 2. 6o open the 8ate D 6ie tool, select Date N )ime under S"stem "ote ost o# the !uttons are not active . Clic the Un$o#k !utton at the top right corner in the Date N )ime $indo$ (. 4ou should !e presented $ith an Aut*enti#ate $indo$ propting you #or the root pass$ord 5. Clic ,an#e$ to close the Aut*enti#ate $indo$ and then close the Date N )ime $indo$
)ask 2: 9rant t*e !ri&i$e5e to Use 9%4E Date N )ime )oo$ 1. As user tux open a terinal $indo$ and s$itch to user root *su -+
2. 6o vie$ the de#ault =olBit settings #or the )">&E 8ate D 6ie 6ool enter the #ollo$ing coand9
less /etc/pol$it-(/rules.d/87-de'ault-privs.rules . Search #or G or5.5nome.#ontro$#enter.datetime.#on(i5ureH 6he privileges should !e aut*MadminMkeep three ties (. 6o change the de#ault settings do the #ollo$ing9 5. >pen the #ile /etc/pol$it-de'ault-privs.local $ith an editor o# your choice <. Add the #ollo$ing at the end o# the #ile9
org.gnome.controlcenter.datetime.con'igure yes ?. Save your changes and e%it the editor :. As root e%ecute the #ollo$ing coand9
set_pol$it_de'ault_privs '. 6o vie$ your changes run the #ollo$ing coand9
less /etc/pol$it-(/rules.d/87-de'ault-privs.rules 10. Search #or Gor5.5nome.#ontro$#enter.datetime.#on(i5ureH :<
SUSE Linu% Enterprise 12 Adinistration
6he privileges should !e "es three ties 11. 6o test your changes, do the #ollo$ing9 12.>pen the )">&E Control Center !y selecting App$i#ations S"stem )oo$s Settin5s. 1.>pen the 8ate D 6ie tool !y selecting Date N )ime under S"stem 1(."ote ost o# the !uttons are active no$ "ote there is no Un$o#k !utton in the top right corner 15. Close the Date N )ime $indo$
)ask : Exe#ute a ,ommand as Anot*er User 1. &ae sure you are logged in a terinal $indo$ as user tu% 2. 6o try to start 4aS6, enter9
/sbin/yast A $arning should appear, that you need root privileges . =ress Enter to select %< (. 6he 4aS6 dialog lists only a #e$ odules. 5. =ress9 <. Alt+Q to uit ;aS) ?. 6o start 4aS6 as root user, enter9
p$exec /sbin/yast 4ou are propted to enter the root pass$ord. Enter $inux ;aS) starts norally and all ;aS) odules are availa!le. :. 6o uit ;aS) press9
Alt+Q
Summar": n this e%ercise you used =olicyBit to grant the a!ility to change the syste tie to a non/root user.
*End o# E%ercise+
:?
SUSE Linu% Enterprise 12 Adinistration
6 So(t'are 4ana5ement Des#ription: 4ou $ill anage so#t$are.
::
SUSE Linu% Enterprise 12 Adinistration
6- 1
4ana5e So(t'are 'it* !4
Des#ription: n this e%ercise, you practice gathering in#oration on installed so#t$are and installing so#t$are pacages.
)ask 1: 9et n(ormation on So(t'are !a#ka5es 1. Using se&er1 log into )">&E as tux 2. >pen a terinal $indo$ and !ecoe root !y entering9
su – pass$ord $inux . 6o #ind out in#oration on the $get pacage enter9
rpm -' /usr/bin/%get "otice that the $get pacage installed the $get #ile (. 6o #ind out in#oration a!out the '5et pacage enter9
rpm -i %get 5. 6o sho$ all the #iles installed !y the $get pacage enter9
rpm -l %get @here can you #ind in#oration on the $get pacage *"otice the location o# the -EA8&E #iles+ "otice that the in#oration includes the install date and a description <. 6o see $hat has changed in the #iles on your hard drive since the $get -=& $as srcinally installed enter9
rpm -S %get # there is no output then no #iles $ere changed ?. Enter the #ollo$ing9
vi /etc/%getrc :. Using the Arro$ eys, ove the cursor to the #irst line and the #irst sp ace a#ter the three coent ars *+ 6o enter ne$ content in vi, press a and type the #ollo$ing9
&is is a test. :'
SUSE Linu% Enterprise 12 Adinistration
'. 6o e%it vi press9
Hsc and type9
<% 4ou are returned to the coand propt 10.6o see $hat has changed in the #iles contained in the $get pacage on your hard drive since the $get -=& $as srcinally installed enter9
rpm -S %get 11. 6he #ollo$ing is displayed9
#.0.... c /etc/%getrc 12. 6o vie$ the docuentation #iles #or the $get progra enter9
rpm -d %get "otice that soe o# the #iles are still copressed *V.g+
)ask 2: nsta$$ So(t'are 'it* !4 1. &ount the SLES12 S=2 installation ediu9 mount -o $oop sour#eSLE-12-S!2-Ser&er-DVDMx/M/2162 mnt 2. 6o list all #iles included in the not/yet/installed gvi pacage enter9
rpm -pl /mnt/suse/xT>_>=/gvim-;.=.U>-.>.xT>_>=.rpm . 6o install the 5&im pacage enter9
rpm -i&v /mnt/suse/xT>_>=/gvim-;.=.U>-.>.xT>_>=.rpm (. 6o test the installation o# the so#t$are pacage enter9
gvim A ;& $indo$ opens 5. Close the ;& $indo$
)ask : emo&e So(t'are 'it* !4 1. 6o list all #iles included in the installed gvi pacage enter9
rpm -l gvim 2. 6o reove the gvi pacage enter9
rpm -e gvim . 6o veri#y that the pacage is no longer installed enter9
rpm -l gvim (. Close the terinal $indo$ !y entering e%it and log out as root '0
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise, you practiced gathering in#oration on installed so#t$are, installing and reoving so#t$are pacages.
*End o# E%ercise+
'1
SUSE Linu% Enterprise 12 Adinistration
6- 2
nsta$$ So(t'are 'it* 3"pper
Des#ription: n this la! you $ill install and reove so#t$are pacages using the ypper coand line tool.
)ask 1: nsta$$ a So(t'are !a#ka5e 'it* 3"pper 1. Using ser&er1 logged in a terinal $indo$s as root coplete the #ollo$ing steps 2. List the availa!le repositories9
1ypper lr "ote the nu!er o# the repository is 1 *one+ . Selectively re#resh the etadata #or the installation source !y entering the #ollo$ing coand9
1ypper re' ( (. 6o search #or a singl e pacage in the act ive nstallation Sources enter the #ollo$ing coand9
1ypper se gv =acages that contain the string 5& in their nae are listed 5. Lets learn soe ypper options. 6o install a pacage enter the #ollo$ing coand9
1ypper in gvim Ans$er n $hen propted to stop the installation
1ypper --non-interactive in gvim --do%nload-only <. 6ry the #ollo$ing ypper coand and options9
1ypper --non-interactive in gvim 6his tie you are not propted, this is a use#ul option to use in scripts ?. 6est the so#t$are !y entering gvim at the coand propt :. 6o reove a pacage enter the #ollo$ing coand9
1ypper rm gvim Ans$er " $hen propted to approve the reoval. 6he Tnon-intera#ti&e option can !e used $hen reoving pacages
'2
SUSE Linu% Enterprise 12 Adinistration
)ask 2: Use 3"pper to nsta$$ a !attern 1. 6his is a challenge tas. 4ou are not given the ste p/!y/step instructions to per#or the tas. -ather you ust use no$ledge previously gained to success#ully coplete the tas. ypper has the a!ility to install entire patterns as $ell as single pacages. 4our tas is to install the &ail and "e$s Server pattern using the ypper coand.
Summar": n this la! you installed and reoved so#t$are pacages using the ypper coand line tool.
*End o# E%ercise+
'
SUSE Linu% Enterprise 12 Adinistration
6-
4ana5e So(t'are Sour#es 'it* 3"pper
Des#ription: n this e%ercise, you add, reove, and renae so#t$are installation sources using the ypper coand.
)ask 1: Add an nsta$$ation sour#e 'it* 3"pper 1. Using ser&er1 open a terinal propt and i# not already logged in as the root user, enter su – to !ecoe root 2. List your e%isting installation sources !y entering the #ollo$ing coand9
1ypper lr . Add the ne$ installation source !y entering the #ollo$ing coand9
1ypper ar /mnt sles(-sp (. List your installation sources again9
1ypper lr 4ou should see the ne$ installation source 5. &ae a note o# the ne$ repository, it should !e nu!er 2. -e#resh the repository to get a current list o# availa!le so#t$are9
1ypper re' 4repo-number*
)ask 2: nsta$$ a So(t'are !a#ka5e (rom t*e e' epositor" 1. 8isa!le the original repository9
1ypper mr -d #"H-(-#F-#erver-DSD_xT>_>=(8 2. Chec the ori ginal repository is di sa!led9
1ypper lr . 6he pacage ema#s #ro the only ena!led repository9
1ypper install emacs ypper identi#ies the dependencies installs all reuired pacages
)ask : ename an nsta$$ation Sour#e 'it* 3"pper 1. 6o renae an installation source enter the #ollo$ing coand9
'(
SUSE Linu% Enterprise 12 Adinistration
1ypper nr sles(-sp sles(-sp-ne% 2. List the installation sources again to see the change9
1ypper lr 4ou should see that the alias #or the repository has changed
)ask : emo&e an nsta$$ation Sour#e 'it* 3"pper 1. 6o reove the installation source enter the #ollo$ing coand9
1ypper rr sles(-sp-ne% 2. List the installation sources again to see the change9
1ypper lr 4ou should no longer see the repository in the list . Ena!le the original repository9
1ypper mr -e ( (. Chec the repository has !een ena!led9
1ypper lr
Summar": n this e%ercise, you added, reoved, and renaed so#t$are installation sources using the ypper coand.
*End o# E%ercise+
'5
SUSE Linu% Enterprise 12 Adinistration
6-
4ana5e So(t'are ' it* ;aS)
Des#ription: n this e%ercise, you install and reove so#t$are $ith 4aS6.
)ask 1: nsta$$ So(t'are !a#ka5es 'it* ;aS) 1.
>n ser&er1 launch the ;aS) So(t'are 4ana5ement odule9 App$i#ations S"stem )oo$s ;aS) So(t'are So(t'are 4ana5ement
2.
n the search #ield at the top le#t, enter xos&ie' "otice that the icon in #ront o# the xos&ie' entry on the right sho$s an epty !o%. 6his indicates that the pacage is not yet installed
3.
ro the list on the right select xos&ie' 6he icon changes to a green chec ar
4.
Clic A##ept to install the xos&ie' pacage
5.
n the nstallation -eport dialog, clic +inis*
<. >pen a terinal $indo$ as tux and enter9
xosvie% ?. Close the xos&ie' $indo$ and the terinal $indo$
)ask 2: emo&e So(t'are !a#ka5es 'it* ;aS) 1.
Launch the ;aS) So(t'are 4ana5ement odule9 App$i#ations S"stem )oo$s ;aS) So(t'are So(t'are 4ana5ement
2.
n the search #ield at the top le#t, enter xos&ie' "otice that the icon in #ront o# %osvie$ no$ sho$s a !o% already checed. 6his eans that the pacage is installed.
3.
n the list on the right either clic xos&ie' t$ice until a red M appears to the le#t or right/ clic on xos&ie' and select De$ete #ro the conte%t enu
4.
Clic A##ept at the !otto right
5.
n the nstallation -eport dialog clic +inis*
<. Close the ;aS) ,ontro$ ,enter $indo$
'<
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise you installed and reoved so#t$are $ith 4aS6.
*End o# E%ercise+
'?
SUSE Linu% Enterprise 12 Adinistration
10et'ork Administration Des#ription: 4ou $ill learn to con#igure net$oring anually and using @iced. 4ou $ill then con#igure the SUSE #ire$all.
':
SUSE Linu% Enterprise 12 Adinistration
10- 1
,on(i5ure t*e et'ork ,onne#tion 4anua$$"
Des#ription: 6he purpose o# this e%ercise is to #ailiarie you $ith anually con#iguring net$or settings.
)ask 1: ote t*e ,urrent et'ork ,on(i5uration 1. Using ser&er1 and i# not already logged in as the root user, open a terinal $indo$ and enter su – to !ecoe root 2. 6o test the net$or connection at the shell propt enter9
ping (;.(;.. 4ou should see that the net$or connection is $oring . 6o e%it ping press9
trl+ (. Enter9
ip address s&o% 5. Under eth0 #ind the line starting $ith inet and record the = address $ith the su!net as displayed in that line9 IP_ADDR: KKKKKKKKKKKKKKKKKKKKKKKKKKK Subnet mask:KKKKKKKKKKKKKKKKKKKKKKKKKK <. Enter9
ip route s&o% ?. ind the line starting $ith de(au$t and record the = address o# the de#ault router9 outer address:MMMMMMMMMMMMMMMMMMMMMMMMMM :. Enter9
ip lin$ s&o% et&7 '. ind the line starting $ith $inket*er and record the &AC address o# the net$or card9 4A, address:MMMMMMMMMMMMMMMMMMMMMMMMMM
)ask 2: De$ete t*e ,urrent et'ork Setup 'it* ;aS) 1. Start ;aS) and enter the root pass$ord 2. Select et'ork Settin5s
''
SUSE Linu% Enterprise 12 Adinistration
. (. 5. <.
Select et*0 then clic De$ete Clic %< Close ;aS) 6o test the net$or connection at the shell propt enter9
ping (;.(;.. 4ou should see a essage indicating that the net$or is unreacha!le ?. At the shell propt enter9
ip address s&o% "ote that the state o# your eth0 device is D%W
)ask : ,on(i5ure t*e et'ork 4anua$$" 1. At the shell propt enter9
ip address add (;.(;..(/= brd + dev et&7 2. 6o activate the net$or device enter9
ip lin$ set et&7 up . 6o set the de#ault route enter9
ip route add de'ault via (;.(;.. (. ;eri#y that the net$or connection is $oring again !y entering9
ping (;.(;..
Summar": n this e%ercise you have anually con#igured your net$or using coand line tools.
*End o# E%ercise+
100
SUSE Linu% Enterprise 12 Adinistration
10- 2
,on(i5ure Lo#a$ ame eso$ution
Des#ription: n this e%ercise you con#igure and test a local host nae resolution.
)ask 1: ,on(i5ure Lo#a$ ame eso$ution 1. Using ser&er1 logged in as root open a terinal $indo$ 2. 6o open /etc/&osts in the vi editor enter9
vi /etc/&osts . At the end o# the #ile there should !e a line lie the #ollo$ing9
(;.(;..(
server(.suse.com server(
(. Add the #ollo$ing line at the end o# the #ile9
(;.(;..
server.suse.com server
5. Save the #ile and e%it &i
)ask 2: )est ame eso$ution 1. 6o test the nae resolution #or ser&er1 enter9
ping server( ser&er1 should reply to the ping pacets 2. 6o test the nae resolution #or ser&er2 enter9
ping server.suse.com . ser&er2 should reply to the ping pacets
Summar": n this e%ercise you have anually con#igured your net$or using coand line tools.
*End o# E%ercise+
101
SUSE Linu% Enterprise 12 Adinistration
10-
Sa&e t*e et'ork ,on(i5uration to a +i$e
Des#ription: n this e%ercise you save your net$or con#iguration to a #ile.
)ask 1: Sa&e t*e et'ork ,on(i5uration to a +i$e 1. Using ser&er1 open a terinal $indo$ and enter su – to !ecoe root 2. n the terinal $indo$ enter9
cd /etc/syscon'ig/net%or$ . &ae a copy o# the net$or con#iguration teplate !y entering9
cp i'c'g.template i'c'g-et&7 (. >pen the copied #ile in a te%t editor !y entering9
vi i'c'g-et&7 5. ind the #ollo$ing options, press the nsert and enter the indicated values9 S)A)4%DEGOautoO 8%%)!%)%GOstati#O !ADDGO1?2.1?.2.21O E)4AS
Hsc then save the #ile and e%it vi !y entering9
<% ?. ;ie$ the /etc/syscon'ig/net%or$/routes #ile $ith less !y entering9
less routes 6he content should !e9 de(au$t 172.17.2.1 - -
)ask 2: )est t*e et'ork ,on(i5uration 1. # reuired log in as tux and open a terinal $indo$ 2. ;eri#y that the net$or con# iguration loaded correctly !y entering the #ollo$ing coands9
102
SUSE Linu% Enterprise 12 Adinistration
ip address s&o% et&7 ip route s&o% . ;eri#y that the net$or connection is $oring properly !y entering9
ping server( (. Close all open $indo$s 5. %)E9 # the net$or con#iguration doesn7t $or properly, use the ;aS) et'ork Settin5s odule to recon#igure the net$or card $ith the proper settings recorded earlier in the la!.
Summar": n this e%ercise you saved your net$or con#iguration to a #ile.
*End o# E%ercise+
10
SUSE Linu% Enterprise 12 Adinistration
10-
4ana5e et'ork ,on(i5uration 'it* Wi#ked
Des#ription: n this e%ercise you anage your net$or inter#ace using $iced.
)ask 1: 4ana5e et'ork ,on(i5uration 'it* Wi#ked 1. Using ser&er1 open a terinal $indo$ and enter su – to !ecoe root 2. 6o display the status o# your net$or inter#aces enter9
systemctl status %ic$ed.service . 6o display the status o# your net$or enter9
systemctl status %ic$edd.service (. 6o display detailed in#oration a!out your net$or inter#aces, enter
%ic$ed s&o% all 5. 6o !ring do$n your eth0 inter#ace enter9
%ic$ed i'do%n et&7 <. 6o display detailed in#oration a!out your net$or inter#aces enter9
%ic$ed s&o% all 4ou should see only soe hard$are in#oration #or eth0 ?. 6o test the eth0 inter#ace enter9
ping (;.(;.. 4ou should see a essage, that the net$or is unreacha!le :. 6o restart your net$or service enter9
systemctl restart net%or$.service '. 6o display detailed in#oration a!out your net$or inter#aces enter9
%ic$ed s&o% all 4ou should see that an = address is assigned to eth0 again 10.6o test the eth0 inter#ace enter9
ping (;.(;.. 11. 6he net$or should !e reacha!le again
10(
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise you anaged your net$or inter#ace using $iced.
*End o# E%ercise+
105
SUSE Linu% Enterprise 12 Adinistration
10-
,on(i5ure a ost 8ased +ire'a$$ 'it* SuSE(ire'a$$2
Des#ription: n this e%ercise you use SuSE#ire$all2 to con#igure a host !ased #ire$all.
)ask 1: Use SuSE(ire'a$$2 to ,on(i5ure t*e +ire'a$$ 1. Using ser&er2 launch the ire$all 4aS6 odule9 ;aS) Se#urit" and Users +ire'a$$ 2. >n the Start-Up screen ae sure Enab$e +ire'a$$ Automati# Startin5 is selected . ro the list on the le#t select nter(a#es (. ro the list o# inter#aces on the right select et*0 and clic ,*an5e 5. >n the Pone (or et'ork nter(a#e pop/up $indo$ select Externa$ Pone #ro the drop/do$n list and then clic %< <. ro the list on the le#t select A$$o'ed Ser&i#es ?. >n the right, #ro the A$$o'ed Ser&i#es (or Se$e#ted Pone drop/do$n list select Externa$ Pone :. # Se#ure S*e$$ Ser&er is not already in the list o# allo$ed services, #ro the Ser&i#e to A$$o' drop/do$n list select Se#ure S*e$$ Ser&er and then clic Add '. ro the Ser&i#e to A$$o' drop/do$n list select +S Ser&er Ser&i#e and then clic Add 10. ro the Ser&i#e to A$$o' drop/do$n list select Samba Ser&er and then clic Add 11. ro the Ser&i#e to A$$o' drop/do$n list select V, and then clic Add 12. ro the Ser&i#e to A$$o' drop/do$n list select xntp Ser&er and then clic Add 1.Clic ext 1(. -evie$ the Summar" screen and then i# everything is correct clic +inis* 15.>pen a terinal $indo$ and enter su – to !ecoe root 1<.Enter less /etc/syscon'ig/#u#H'ire%all and revie$ the varia!les set !y 4aS6 and the varia!les availa!le 1?.=ress9
Q to uit 1:.Enter9 less
iptables -" -nv to vie$ the #ilter rules set !y SUSE#ire$all2 1'.Close all open $indo$s
10<
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise you used SuSE#ire$all2 to con#igure a host !ased #ire$all.
*End o# E%ercise+
10?
SUSE Linu% Enterprise 12 Adinistration
11 Stora5e Administration Des#ription: 4ou $ill learn to partitions diss, create #ilesystes, 4ou $ill then con#igure diss using L;&. 4ou $ill setup a so#t$are -A8. 4ou $ill use the con#igure and use the #eatures o# tr#s. 6he last topic $ill conver con#iguring and using "S
10:
SUSE Linu% Enterprise 12 Adinistration
11- 1
4ana5e !artitions 'it* ;aS)
Des#ription: n this e%ercise you create soe partitions using 4aS6.
)ask 1: 4ana5e partitions 'it* ;aS) 1. 2. . (. 5. <.
Using ser&er1 start 4aS6. @hen propted #or authentication, enter the root pass$ord n the S"stem section clic on !artitioner n the $arning dialog, clic ;es n the Syste ;ie$ panel on the le#t, clic the arro$ icon in #ront o# the ard Disks ite 4ou should see three hard diss, vda, vd! and vdc Clic on the &db ite in the le#t S"stem Vie' panel. 6his dis currently has no partitions on it ?. 6o add a ne$ priary partition, do the #ollo$ing9 Clic the Add !utton :. &ae sure that !rimar" !artition is selected, then clic ext '. &ae sure that ,ustom Si3e is selected and enter 29i8 in the Sie te%t !o%, then clic ext 10. &ae sure that Data and SV App$i#ations is selected, then clic ext 11. &ae sure that +ormat partition is selected and the #ile syste is MS 12.Select 4ount partition and #or the 4ount !oint enter9 data1 1.Clic +inis* 1(.6o add a ne$ e%tended partition to the sae dis, ae sure vd! is still select in the S"stem Vie' and clic the Add !utton 15.Select Extended !artition, then clic ext 1<. &ae sure that 4aximum Si3e is selected, then clic +inis* 1?.6o add a ne$ logical partition clic the Add !utton 1:. &ae sure that ,ustom Si3e is selected and enter 9i8 in the Si3e te%t !o%, then clic ext 1'. &ae sure that Data and SV App$i#ations is selected, then clic ext 20. &ae sure that +ormat partition is selected and the #ile syste is Q+S 21.Select 4ount partition and #or the 4ount !oint enter9 data2 22.Clic +inis* 2.6o add a second logical partition, do the #ollo$ing9
10'
SUSE Linu% Enterprise 12 Adinistration
2(. Clic the Add !utton 25.Select 4aximum Si3e, then clic ext 2<. &ae sure that Data and SV App$i#ations is selected, then clic ext 2?. &ae sure that +ormat partition is selected and the #ile syste is Q+S 2:.Select 4ount partition and #or the 4ount !oint enter9 2'. data and clic +inis* 0.n the Expert !artitioner dialog, clic ext 1.n the Summar" dialog, clic +inis* 2.Close the 4aS6 dialog
)ask 2: Vie' t*e ne' partitions and (i$es"stems 1. >pen a terinal $indo$ as tux 2. 6o vie$ the ounted #ilesystes enter9 mount . At the !otto o# the list the #ollo$ing three ounted #iles systes are listed9 FdevFvd!1 on Fdata1 FdevFvd!5 on Fdata2 FdevFvd!< on Fdata 6here can !e either a a%iu o# #our priary partitions per dis or three priary partitions and one e%tended partition $hich can contain ultiple logical partitions. (. Change to the root user9 su and enter roots pass$ord, $inux 5. Create a ne$ #ile on each o# the ne$ #ile systes9 tou#* data1test(i$e1 data2test(i$e2 datatest(i$e <. List the contents o# data1, data2 and data9 $s -a$ data1 data2 data
110
SUSE Linu% Enterprise 12 Adinistration
Summar": n this e%ercise you create a ne$ priary partition, added a %#s #ilesyste to it and con#igured it to autoatically ount on Fdata1. 4ou then created an e%tended parition and put t$o logical partitions in it, #oratted !oth $ith the %#s #ilesyste and ounted the on Fdata2 and Fdata.
*End o# E%ercise+
111
SUSE Linu% Enterprise 12 Adinistration
11- 2
4ana5e !artitions 'it* parted
Des#ription: n this e%ercise you create a ne$ partition using parted.
)ask 1: Vie' t*e Existin5 !artitions 1. Using ser&er2 logged in as tux open a terinal $indo$ and su to the root user 2. List the !loc devices9
lsbl$ 4ou can see #our virtual dis, *vd%+ devices . 6o start parted and access the #irst dis enter9
parted /dev/vda (. 6o vie$ the e%isting partitions enter9
print A $inux-s'ap partition, a 8tr+S partition and a Q+S partition should !e listed 5. E%it parted #or de&xda !y entering9
uit
)ask 2: ,reate a e' !artition 1. Access de&&db $ith parted9
parted /dev/vdb 2. ;ie$ the current partitions9
print 6here are no partitions on de&&db . Create a ne$ partition ta!le9
m$label msdos (. 6ry the #ollo$ing9 5. m$part primary 7 7V A $arning is displayed a!out the partition not !eing aligned #or !est per#orance.
112
SUSE Linu% Enterprise 12 Adinistration
Enter9
to cancel <. -un the #ollo$ing coands to o!tain the in#oration reuired to aligned the partition9
cat /sys/bloc$/vdb/ueue/optimal_io_si1e cat /sys/bloc$/vdb/alignment_o''set cat /sys/bloc$/vdb/ueue/p&ysical_bloc$_si1e ?. 6he #orula9 *optialKioKsie R alignentKo##set+FphysicalK!locKsie *0 R 512+F512 W 1 :. 6o create a ne$ priary partition using 20X o# the availa!le space in de&&db enter9
m$part primary ( 7V 4ou can use -1 as end value o# a partition i# you $ant the partition to use the $hole le#t space on the hard dis '. 6o vie$ the e%isting partitions enter9
print at the parted propt 6he ne$ partition should !e listed 10.Chec the partition nu!er #ro the previous coand, it should !e 1. Chec the alignent9
align-c&ec$ optimal ( 11. =rint the partition details9
print 12.Change the units used to sectors. 6his is used to !oth display output and the de#ault unit used to enter data i# not speci#ied+9
unit s 1.=rint the partition details and copare the units $ith the previous output9 1(. print "otice the letter s a#ter the Start, End and Sie $hich indicates sectors 15.e#ore you create a ne$ e%tended partition you need to chec $here the #ree space is9
print 'ree
11
SUSE Linu% Enterprise 12 Adinistration
1<.Use the sector nu!ers displayed in the previous coand to create an e%tended partition9
m$part extended 4enter-start-sector-o' 'ree-space* 4end-sectoro'-'ree-space* 1?.8isplay the partition details including the #ree space9
print 'ree "otice there is still soe #ree space availa!le. 1:.Create a logical partition $ithin the #ree space in the e%tended partition9
m$part logical 4start-sector-o' -'ree-space* U7V 1'.At the $arning essage enter9
I to ignore 20. Chec the results 9
print 'ree 21.Create a second logical partition using 50X o# the reaining space in the e%tended partition9
m$part logical 4start-sector-o' -'ree-space* 07V 22.At the $arning essage enter9
W 2.At the second $arning essage enter9
I to ignore 2(.;ie$ the e%isting partitions enter9
print 'ree 25.Create a #inal logical partition using all the reaining dis space9
m$part logical 4start-sector-o' -'ree-space* 4end-sector-o' -'ree-space* 2<.At the $arning essage enter9
W 2?.At the second $arning essage enter9
I to ignore 2:.;ie$ the e%isting partitions enter9
print 'ree 2'.change the units to the de#ault9
unit compact 11(
SUSE Linu% Enterprise 12 Adinistration
0.8isplay the partition details and #ree space9
print 'ree 4ou need the nu!er o# the e%tended partition #or the ne%t coand 1.6o chec the alignent o# your e%tended partition enter9
align-c&ec$ optimal 4extended-partition-number*
6his partition should !e aligned 2. 6o chec the alignent o# your three logical partitions enter9
align-c&ec$ optimal 4logical-partition-number* .6hese partitions are not aligned (. 6o e%it parted enter9
uit
Summar": n this e%ercise you created a ne$ priary and e%tended partitions and checed they are aligned #or !est per#orance. 4ou then changed the de#ault units used !y parted #or displaying data and accepting input. inally three logical partitions $ere added to the e%tended partition. 4ou have not created any #ilesystes on any o# the partitions you created.
*End o# E%ercise+
115
SUSE Linu% Enterprise 12 Adinistration
11-
,reate a +i$e S"stem in an Empt" !artition
Des#ription: n this e%ercise you create a ne$ e%t( #ile syste in an epty partition.
)ask 1: ,reate and ext +i$e S"stem 1. Using ser&er2 logged in as tux open a terinal $indo$ use the su - coand to s$itch to your root account 2. ;ie$ the partitions availa!le on FdevFvd!9 parted FdevFvd! print "otice there are no #ile systes listed in the partitions . Enter the #ollo$ing coands to create a ne$ e%t #ile syste on /dev/sda0 and to give it the la!el data19
m$'s.ext= -" data( /dev/vda( &ae sure you speci#y the correct device in the a!ove coand. # you speci#y the $rong device, no $arning essage $ill !e displayed and the #ile syste on the device $ill !e over$ritten. (. 6o get the !loc 8 *UU8+ o# FdevFsda5, enter the #ollo$ing9
bl$id /dev/vdb(
5. Copy the UU8 to the clip!oard <. Enter the #ollo$ing to create the directory naed data( under /export/9
m$dir -p /export/data( ?. Enter the #ollo$ing to veri#y that the directories $ere created9
ls -l /export :. As root, add entries to the /etc/'stab #ile #or the ne$ #ile systes. At the terinal propt, enter the #ollo$ing to open the #ile /etc/'stab in the vi editor9
vi /etc/'stab '. =ress the nsert ey 10. At the end o# the 'stab #ile, add the #ollo$ing ne$ lines9 UUDGCUUID_of_sda5 exportdata1 ext de(au$ts 1 2 6hese ne$ entries ensure the vdb1 partition is ounted $hen starting or re!ooting the syste 11. Save the changes to /etc/'stab !y pressing9
Hsc 11<
SUSE Linu% Enterprise 12 Adinistration
and then entering9
<% 12.n the terinal $indo$, enter the #ollo$ing to reread the /etc/'stab #ile and ount all o# the ne$ #ile systes9
mount -a 1.Enter the #ollo$ing to vie$ the in#oration a!out ounted #ile systes as listed in /etc/mtab9
mount 1(.4ou should see an entry #or the ne$ partition you 3ust created at the end o# the output9 FdevFvd!1 on Fe%portFdata1 type e%t( *r$,relatie,dataWordered+ 15.Enter to sho$ the ernelOs vie$ o# ounted #ile systes9
cat /proc/mounts 1<.4ou should see an entry #or the ne$ partition you 3ust created at the end o# the output9 FdevFvd!1 Fe%portFdata1 e%t( r$,relatie,dataWordered 0 0 6he mount and umount coands aintain the entries in the /etc/mtab ta!le. 6he /etc/mtab ta!le contains ore in#oration than /proc/mounts, !ut ay not !e as up/to/date as the ernelOs vie$. @henever there is a uestion a!out $hether a #ile syste is ounted or not, re#er to the ernel vie$ in /proc/mounts.
Summar": n this tas you created an e%t( #ile syste la!eled Gdata1H on vd!1. 6he partition $ill !e ounted into the Fe%portFdata1 directory during the syste startup.
*End o# E%ercise+
11?
SUSE Linu% Enterprise 12 Adinistration
11-
,on(i5ure a LV4 Vo$ume 9roups and a Lo5i#a$ Vo$ume
Des#ription: n this e%ercise you $ill use the L;& coand line coands to create a L;& volue group and a !asic logical volue.
)ask 1: Add partitions to a disk 1. Logged in as tux on ser&er1 open a terinal $indo$ as the root user. 2. List the !loc devices on ser&er19 $sb$k "otice /dev/vdc contains no partitions . Start ;aS) and enter the roots pass$ord $hen propted (. -un the !artitioner odule and clic ;es at the $arning 5. ro the Syste ;ie$ select &d# and add the #ollo$ing partitions9 Primary, 10GB, Raw Volume (unformatted) Extended, Maximum Size
<. n the e%tended partition add the #ollo$ing9 7GB, Raw Volume (unformatted) 6GB, Raw Volume (unformatted)
?. Save your changes and e%it ;aS) :. List the !loc devices again9 $sb$k
)ask 2: ,on(i5ure an LV4 9roup '. ;ie$ the current L;& physical volues on ser&er19 p&s#an 10. Enter the #ollo$ing coand to create L;& =hysical ;olue*s+, using the partitions vdc1, vdc5 and vdc< created a!ove9 preate de&&d#1 de&&db de&&db/ 11. ;ie$ the L;& physical volues9 p&s#an 12.;ie$ details o# the ne$ L;& physical volues9 p&disp$a" "otice that there is no ;olue )roup nae listed 1.Use the #ollo$ing coand to create an L;& ;olue )roup naed &50 using the
11:
SUSE Linu% Enterprise 12 Adinistration
physical volues you 3ust created9 &5#reate &50 de&&d#1 de&&d# de&&d#/ 1(.;eri#y that the volue group $as created success#ully !y entering the #ollo$ing coands *notice the siilarities and di##erences in their outputs+9 &5s &5disp$a" 15.6o see ho$ the physical volues created are !eing used, enter the #ollo$ing coands *notice the siilarities and di##erences in their outputs+9 p&s p&disp$a" "otice the Alloc =EFSie is 0 and the ree =EFSie is appro%iately 2)
)ask : ,on(i5ure a 8asi# LV4 Lo5i#a$ Vo$ume 1. ;ie$ the current L;& logical volues, *there are none at present+9 $&s $&disp$a" 2. n the terinal $indo$ as the root user use the #ollo$ing coand to create one Logical ;olue in the &50 ;olue )roup9 $reate -L 98 -n $&Mbasi#0 &50 . ;eri#y that the logical volue $as created !y entering the #ollo$ing coands9 $&s $&disp$a"
)ask : +ormat t*e 8asi# LV4 Vo$ume 'it* a +i$e S"stem 1. Enter the #ollo$ing coand to create a #ile syste in the $&Mbasi#0 logical volue9 mk(s.ext de&&50$&Mbasi#0 2. Enter the #ollo$ing coand to create a ount point #or the logical volue and ount it9 mkdir -p exportdata mount de&&50$&Mbasi#0 exportdata . 6o see that the volu e success#ully ounted, enter the #ollo$ing coand9 mount (. 6o speci#y the UU8 o# the logical volue enter9 b$kid de&mapper&50-$&Mbasi#0 Copy the UU8 to the clip!oard 5. >pen /etc/'stab in an editor o# your choice <. Add the #ollo$ing line at the end o# the #ile9
IDB4ID_o'_/dev/mapper/vg7-lv_basic7* /export/data ext= de'aults ( and save #sta!
11'
SUSE Linu% Enterprise 12 Adinistration
?. Unount /export/data9 umount exportdata :. 6o activate the ne$ /etc/'stab con#iguration, enter9 mount -a '. 6o chec t he correct ounting enter9 mount At the end o# the output the logical volue should !e listed
)ask : esi3e t*e &o$ume5roup and ext (i$e s"stem 1. @hen you created the volue group &50 you did not use all the availa!le space in the three partitions. Chec #or #ree space in the volue group9 &5disp$a" Loo at the Alloc =EFSie and the ree =EFSie. 6here is appro%iately 1() o# #ree space in the physical e%tent *=E+ 2. Chec the sie o# the #ile syste ounted on Fe%portFdata9 d( -* exportdata 6he sie is appro%iately ?.:) . E%tend the logical volues !y adding 10) to it9 $&extend -L 1098 de&mapper&50-$&Mbasi#0 (. ;ie$ the volue group details9 &5disp$a" "otice the Alloc =EFSie and the ree =EFSies 5. Chec the sie o# the #ile syste ounted on Fe%portFdata9 d( -* exportdata 6he sie is still appro%iately ?.:) <. -esie the #ile syste9 resi3e2(s de&mapper&50-$&Mbasi#0 ?. Chec the sie o# the #ile syste ounted on Fe%portFdata9 d( -* exportdata 6he #ile syste sie reported no$ re#lects the e%tra space added to the logical volue
)ask : ename and Existin5 Lo5i#a$ Vo$ume 1. 6his is a challenge tas. 4ou are not given the ste p/!y/step instructions to per#or the
120
SUSE Linu% Enterprise 12 Adinistration
tas. -ather you ust use no$ledge previously gained to success#ully coplete the tas. 2. Logical ;olues can !e renaed a#ter they are created. 4our tas is to rena e the logical volue you 3ust created using only the CL L;& utilities.
Summar": n this e%ercise you used the L;& coand line coands to create a L;& volue group and a !asic logical volue. 4ou then con#igured the volue to ount using the UU8 $hen the syste starts. 4ou then increased the sie o# the logical volue and the e%t( #ile syste.
*End o# E%ercise+
121
SUSE Linu% Enterprise 12 Adinistration
11-
,reate a Linear AD1 Arra"
Des#ription: n this e%ercise, you use the dad coand line utility to create a linear -A81 array.
)ask 1: !repare t*e disks 1. 2. . (. 5. <. ?. :.
Using ser&er2 open a terinal as the root user -un ;aS) F !artitioner Ans$er ;es to the $arning ro the Syste ;ie$ select vd!. t should contain FdevFvd!1 #oratted $ith e%t( and three logical partitions in an e%tended partition. Clic on the Expert !utton and select9 ,reate e' !artition )ab$e Leave the type as 4SD%S and clic %< At the $arning clic ;es to reove everything #ro FdevFvd! Clic ext F +inis* and close ;aS) FdevFvd! FdevFddc and FdevFvdd are no$ epty
)ask 2: ,reate a AD1 Arra" 1. 6o load the -A8 ernel odule enter9
modprobe md_mod 2. Enter the #ollo$ing coand to see the status o# the arrays9 . %atc& -d cat /proc/mdstat (. >pen another terinal $indo$ *as root+ and enter the #ollo$ing coand to create a ne$ -A81 array *enter this coand as a single line+9 5. mdadm - /dev/md7 --'orce --levelB( --bitmapBinternal --raid-
devicesB --spare-devicesB( --assume-clean /dev/vdb /dev/vdc /dev/vdd <. # propted to GContinue creating arrayH enter9 ?. yes :. n the other terinal $indo$, you should see th e ne$ly created array listed along $ith its status and coponent devices. 8epending on the sie o# the coponent devices, you ay see that the array is still syncing. '. Enter the #ollo$ing coand to create the mdadm.con' #ile9 10. mdadm -H -s ** /etc/mdadm.con' 122
SUSE Linu% Enterprise 12 Adinistration
11. 6o see the content o# the /etc/mdadm.con' #ile enter9 12. less /etc/mdadm.con' 1.=ress9 1(. 15. to uit less 1<.Enter the #ollo$ing coand to ensure that the -A8 devices are activated at !oot tie9 1?. systemctl enable dmraid-activation.service
)ask 2: 4ount t*e AD Arra" into t*e +i$es"stem 1. Enter the #ollo$ing coand to create a ount point #or the -A8 device9
m$dir /raiddev 2. Enter the #ollo$ing coand to create a #ilesyste on the -A8 device9
m$'s.ext= /dev/md7 . Enter the #ollo$ing coand to ount the array into the #ilesyste9
mount /dev/md7 /raiddev (. Enter the #ollo$ing coand to veri#y that the device is ounted9
mount 4ou should see the device listed as ounted
Summar": n this tas you created a -A81 array /dev/md7 that includes t$o raid devices and one spare device. 4ou then created the mdadm.con' con#iguration #ile. 4ou copleted the tas !y creating and e%t #ile syste on the -A8 device and ounted it into the
/raiddev directory.
*End o# E%ercise+
12
SUSE Linu% Enterprise 12 Adinistration
11- /
Simu$ate a +ai$ed AD Disk
Des#ription: n this e%ercise you siulate a #ailing dis in the -A8. 4ou then add the dis !ac into the array as a spare.
)ask 1: Simu$ate a +ai$in5 Disk in t*e AD 1. Using ser&er2 logged in as tux 2. >pen a terinal $indo$ and s$itch to the root account9
su . ;ie$ the current -A8 status9
%atc& -d cat /proc/mdstat 6he -A8 devices have naes such as vd!Y0Z and vdcY1Z and their status YUUZ 6he #irst U re#ers to the #irst device, indicated !y Y0Z, the second U to the second, indicated !y Y1Z. # a device #ailed, it $ould !e displayed as YKUZ i# the #irst device #ailed, and as YUKZ i# the second one #ailed (. >pen another terinal $indo$ and s$itch to the root account 5. Enter the #ollo$ing coand to ar one o# the devices as #aulty9
mdadm --manage /dev/md7 --'ail /dev/vdc <. n the other terinal $indo$ you should see the device you ared #aulty is designated $ith an underscore instead o# a U. 4ou $ill also see that the spare device !ecae active and the array !egan to resync. @hen the resync is #inished you should see the status return to UU ote9 As !oth devices $ere currently $oring, it does not atter $hich one you chose, !ut i# you are dealing $ith a daaged hard dis, you have to ar the device #aulty that corresponds to the device $ith the underscore. ?. 6o vie$ the current activity o# the -A8 enter the #ollo$ing coand9
cat /sys/bloc$/md7/md/sync_action # it is still resyncing it should display recover # it has #inished resyncing it should display idle @ait until the synchroniation has copleted !e#ore continuing :. Enter the #ollo$ing coand to reove the #ailed dis #ro the array9
mdadm --manage /dev/md7 --remove /dev/vdc n the other terinal $indo$ you should see the array no$ only contains 2 diss. 6he device you reoved is no longer listed '. 6est i# you can still use the /raiddev directory, #or instance !y creating a #ile in that 12(
SUSE Linu% Enterprise 12 Adinistration
directory
)ask 2: Add a e' Spare Disk to t*e Arra" 1. Enter the #ollo$ing coand to $ipe the e%isting super!loc o# the device 3ust reoved9
mdadm --1ero-superbloc$ /dev/vdc 2. Enter the #ollo$ing coand to add the device !ac into the array9
mdadm --manage /dev/md7 --add /dev/vdc n the other terinal $indo$ you should see the device listed in the array as a spare *S+ . Enter9 #tr$ # to stop the raid onitoring
Summar": n this tas you ared /dev/vdc as #aulty and reoved the #ailed dis #ro the -A8 array. 4ou then $iped the e%isting super!loc o# /dev/vdc to reove the e%isting -A8 etadata. 6hen you $ill added a ne$ /dev/vdc hard drive to the array.
*End o# E%ercise+
125
SUSE Linu% Enterprise 12 Adinistration
11- 7
,reate a 8tr+S (i$es"stem
Des#ription: n this e%ercise you convert an e%isting directory into a trS su!volue.
)ask 1: ,reate some (ree spa#e ( or a 8tr+S (i$es"stem 1. Using ser&er1 logged is as tu% run 4aS6 and enter roots pass$ord $hen propted 2. -un the !artitioner and at the $arning clic ;es . n the S"stem Vie' e%pand ard Disks and select &db T it currently has no #ree space on it (. -eove de&&db and de&&db/9 ro the right select de&&db/ and clic De$ete 5. At the $arning clic Unmount <. At the ea$$" De$ete $arning clic ;es ?. ro the right select de&&db and clic De$ete :. At the $arning clic Unmount '. At the ea$$" De$ete $arning clic ;es 10.Clic ext F +inis* to coit your changes
6as 29 Create a trS #ilesyste 1. -un ;aS) and run the !artitioner 2. At the $arning clic ;es . n the S"stem Vie' e%pand ard Disks and select &db (. Clic Add and enter 129i8 as the sie 5. Clic ext <. or the o$e leave Data and SV App$i#ations selected and clic ext ?. Under the +ormattin5 %ptions #or the +i$e S"stem select 8tr+S :. Under the 4ountin5 %ptions select 4ount partition and #or the ount point enter9 m"btr(s '. Clic +inis* F ext F +inis* 10.Close ;sS)
12<
SUSE Linu% Enterprise 12 Adinistration
11. Chec the #ilesyste is ounted9 ount
Summar": n this tas you created a ne$ trS #ilesyste and ounted it on /mybtr's.
*End o# E%ercise+
12?
SUSE Linu% Enterprise 12 Adinistration
11-
,on&ert and Existin5 Dire#tor" into a Sub&o$ume
Des#ription: n this e%ercise you convert an e%isting directory into a trS su!volue.
)ask 1: )*is is )ask %ne 1. Using ser&er1 in a terinal $indo$ as root create an e%aple directory. 6o create a ne$ directory, enter9
m$dir /btr'ssubvol 2. 6o create soe content #or the data directory, enter
cp /bin/ /btr'ssubvol . >pen a terinal $indo$ and enter the #ollo$ing coand to list the e%isting su!volues in /9
btr's subvolume list / 4ou ay have to scroll !ac to vie$ the su!volues that are not snapshots (. Enter the #ollo$ing coand to vie$ the contents o# the /btr'ssubvol directory9
ls -l /btr'ssubvol 5. Enter the #ollo$ing coand to convert an e%isting directory into a su!volue9
mv /btr'ssubvol /mybtr's-src btr's subvolume create /btr'ssubvol cp -a /mybtr's-src/. /btr'ssubvol/ rm -r /mybtr's-src <. Enter the #ollo$ing coands to vie$ the changes9
ls -l /btr'ssubvol ?. 4ou should see the sae contents in the /btr'ssubvol su!volue as $as in the srcinal /btr'ssubvol directory. :. Enter the #ollo$ing coands to vie$ the changes9
btr's subvolume list / '. 4ou should also see that /btr'ssubvol is listed as a ne$ su!volue.
12:
SUSE Linu% Enterprise 12 Adinistration
Summar": n this tas you created a ne$ directory /btr'ssubvol and copied the content o# the
/bin directory into it. 6his directory $as then converted into a trS su!volue.
*End o# E%ercise+
12'
SUSE Linu% Enterprise 12 Adinistration
11- 6
Work 'it* 8tr+S
Des#ription: n this e%ercise you $ill $or $ith trS.
)ask 1: Work 'it* 8tr+S 1. Log in to ser&er1 as tux, open a terinal $indo$ as root 2. Enter9
mount "otice that /dev/vda appears to !e ounted any ties, !ut $ith di##erent ount points . List the su!volues o# the root #ilesyste9
btr's subvolume list / "otice that snapshots are also listed as su!volues (. ;ie$ the /etc/'stab #ile9
cat /etc/'stab subvol=
Loo #or the in the options colun 5. ;ie$ ho$ #ile systes are ounted !y systed ount units9
systemctl list-units --type mount <. Create a ne$ su!volue using ;aS) Start ;aS) and enter the root users pass$ord $hen propted ?. Select S"stem !artitioner. n the @arning dialog, select ;es :. n the le#t pane, select 8tr(s '. n the right pane, select /dev/vda 10.Clic Edit 11. n the Edit 8tr(s dialog, clic Sub&o$ume and$in5 12.n the e' Sub&o$ume #ield, type Rdata2 and clic Add ne', then clic %< 1.n the Edit 8tr(s dialog, clic +inis* 1(.n the Expert !artitioner dialog, clic ext, revie$ the Summar" and clic +inis* 15.Close ;aS) 1<.;ie$ the content o# the / directory9
ls / 10
SUSE Linu% Enterprise 12 Adinistration
As a su!volue appears as a directory in the #ilesyste, the /data directory e%ists 1?.Create a #ile in /root and try to create a hardlin to it in /data(9
touc& /root/mytest'ile ln /root/mytest'ile /data 8espite the #act that /root and /data reside on the sae harddis partition, the creation o# the lin #ails !ecause hardlins cannot cross su!volues 1:.6o ount the ne$ su!volue autoatically even a#ter a syste roll!ac, open the /etc/'stab #ile in vi, copy the line that ounts the /var/tmp su!volue, paste it and edit it so it loos siilar to this9 UUID=... /data2 btrfs subvol=@/data2 0 0
1'.Save the #ile and e%it the editor 20. &ount the ne$ volu e9
mount -a 21.;ie$ the currently ounted #ilesystes9
mount systemctl list-units --type mount 22.;ie$ the dis space utiliation9
d' -& btr's 'ilesystem d' / btr's 'ilesystem s&o% /dev/vda 2.Create a #ile in the /data su!volue9 touc& /data/ne%'ile
2(.Create a snapshot o# the /data volue9
btr's subvolume snaps&ot /data /data-snaps&ot 25.Copare the content o# /data and /data-snaps&ot
ls /data ls /data-snaps&ot 4ou should see the ne%'ile #ile in !oth directories 2<.-eove the #ile 3ust created9
rm /data/ne%'ile 2?.Copare the content o# /data and /data-snaps&ot again9
ls /data ls /data-snaps&ot 4ou should see the ne%'ile #ile in the /data-snaps&ot directory only. 8eleting a #ile does not #ree any dis space as long as there is a snapshot o# that su!volue. 6his is a reason $hy you need to allocate ore harddis space $ith trS $hen using snapshots than you $ould need $ith e%t, #or instance 2:. -eove the snapshot 9
btr's subvolume delete /data-snaps&ot 11
SUSE Linu% Enterprise 12 Adinistration
2'.6o apli#y the #act entioned in the note a!ove, enter the #ollo$ing9 "ote that it can soeties tae a #e$ oents #or the utiliation values to !ecoe updated, so you ay have to $ait and enter the btr(s coands again to see the e##ects.
d' -& btr's 'ilesystem s&o% / btr's 'ilesystem d' / btr's 'ilesystem usage / 0.Create a !ig #ile and copare the ne$ GusedH values to those #ro the a!ove step9
dd i'B/dev/urandom o'B/data/big'ile bsB(X countB07 d' -& btr's 'ilesystem s&o% / btr's 'ilesystem d' / btr's 'ilesystem usage / 1.Create a snapshot o# the /data su!volue9 btr's subvolume snaps&ot /data /data-snaps&ot ls -l /data ls -l /data-snaps&ot 2.-eove /data/big'ile and copare again9 rm /data/big'ile d' -& btr's 'ilesystem s&o% / btr's 'ilesystem d' / "ote that the GusedH values have not signi#icantly changed copared to the call o# the coands in the previous step, despite the #act that you deleted a 250 & #ile.
btr's 'ilesystem usage / . -eove the /data-snaps&ot su!volue and copare again9
btr's d' -& btr's btr's btr's
subvolume delete /data-snaps&ot 'ilesystem s&o% / 'ilesystem d' / 'ilesystem usage /
(.6o o!serve re#lined copies and ho$ they in#luence dis space utiliation and the values displayed !y various utilities, do the #ollo$ing9 "ote that it can soeties tae a #e$ oents #or the utiliation values to !ecoe updated, so you ay have to $ait and enter the btr(s coands again to see the e##ects.
d' -& / , btr's 'ilesystem s&o% / btr's 'ilesystem d' / , btr's 'ilesystem usage / 12
SUSE Linu% Enterprise 12 Adinistration
5.Create a #ile $ith a sie o# 250 & and copare the ne$ GusedH values to those #ro the a!ove step9
dd i'B/dev/urandom o'B/data/big'ile bsB(X countB07 d' -& / , btr's 'ilesystem s&o% / btr's 'ilesystem d' / , btr's 'ilesystem usage / <.Create a re#lined copy o# the #ile and copare the values again9
cp --re'lin$Bal%ays /data/big'ile /data/re'lin$edcopy d' -& / , btr's 'ilesystem s&o% / btr's 'ilesystem d' / , btr's 'ilesystem usage / ?.-eove the srcinal #ile and chec the values again9
rm /data/big'ile d' -& / , btr's 'ilesystem s&o% / btr's 'ilesystem d' / , btr's 'ilesystem usage / :. -eove the /data/re'lin$edcopy #ile and chec the values again9 rm /data/re'lin$edcopy d' -& / , btr's 'ilesystem s&o% / btr's 'ilesystem d' / , btr's 'ilesystem usage / '.*Conditional+ -epeat the a!ove steps using #p $ithout using --re($inkG and loo at the di##erence
)ask 2: Work 'it* 8tr+S Sub&o$umes 1. Log in to ser&er1 as tux, open a terinal $indo$ as root 2. Using ;aS), create an additional partition on /dev/vdb $ith a sie o# 98, #orat $ith 8tr+S and ount it on btr(s . # you donOt $ant to use 4aS6, use parted, as (disk does not support )=6 (. Create a ne$ trS on the /dev/vdb> device9
m$'s.btr's /dev/vdb> 5. Create a ount point and ount it9
m$dir /btr's mount /dev/vdb> /btr's <. Create t$o s u!volues, subvol( and subvol on /btr's9
btr's subvolume create /btr's/subvol( btr's subvolume create /btr's/subvol ?. Create a #e$ #iles in /btr's and the su!volues9
touc& /btr's/btr'smain.txt touc& /btr's/subvol(/'ileinsubvol(.txt touc& /btr's/subvol/'ileinsubvol.txt
1
SUSE Linu% Enterprise 12 Adinistration
:. List the currently availa!le su!volues in /btr's9
btr's subvolume list /btr's '. Unount /btr's:
umount /btr's 10.&ae su!vol1 the de#ault su!volue instead o# the current root volue9
mount /dev/vdb> /btr's btr's subvolume list /btr's "ote the 8 o# su!vol1 11. &ae su!vol1 the de#ault su!volue9
btr's subvolume set-de'ault 4ID> /btr's umount /btr's 12. &ae sure to not add any su!volW option9
mount /dev/vdb> /btr's ls -l /btr's 4ou should see my'ileinsubvol(.txt 1.Set the de#ault !ac to $hat it $as9
btr's subvolume list /btr's "ote the 8 o# the 8 o# [ 1(.Set the de#ault volue !ac to btr(s
btr's subvolume set-de'ault 4ID* /btr's umount /btr's 15. &ae sure to not add any su!volW option9
mount /dev/vdb> /btr's ls -l /btr's 4ou should see the su!volues again and btr'smain.txt Summar": n this la! you vie$ed trS su!volue in#oration including dis space. 4ou then created a snapshot. inally you changed the de#ault so a snapshot volue $as ounted.
*End o# E%ercise+
1(
SUSE Linu% Enterprise 12 Adinistration
11- 10
8tr+S: n-!$a#e 4i5ration and 4aintenan#e
Des#ription: n this e%ercise you $ill per#or an in/place igration #ro e%t( to trS and per#or aintenance tass.
)ask 1: ,on&ert an ext +i$es"stem to 8tr+S 1. Log in to ser&er1 as tux, open a terinal $indo$ as root 2. Using ;aS), create an additional partition on /dev/vdb using the #ollo$ing details9 Use a$$ t*e a&ai$ab$e spa#e *appro%iately 1)+ or the -ole select9 Data and SV App$i#ations orat9 ext &ount point9 /toconvert . Create a #e$ directories and #iles $ithin the #ilesyste9
m$dir /toconvert/dir-YaLbLcZ touc& /toconvert/dir-YaLbLcZ/'ileYaLbLcZ (. Uount the #ilesyste9
umount /toconvert 5. Convert the #ilesyste to trS9
btr's-convert -l converted's /dev/vdb; <. &ount the #ilesyste again9
mount /dev/vdb; /toconvert ?. ;ie$ the #ilesyste type9
mount "ote that the #ilesyste o# /toconvert is o# type btr :. ;ie$ the trS in#oration9
btr's 'ilesystem s&o% '. ;ie$ the su!volues9
btr's subvolume list /toconvert 10.;ie$ the content o# /toconvert9
ls -a /toconvert 11. Also loo at the content o# /toconvert/ext_saved
ls -a /toconvert/ext_saved 12.Chec the #ile type o# /toconvert/ext_saved/image: 15
SUSE Linu% Enterprise 12 Adinistration
'ile /toconvert/ext_saved/image 1.*Conditional+4ou can ount *and unount+ this iage9
mount -o loop /toconvert/ext_saved/image /mnt mount 1(.*ilesyste9 e%t(+
ls /mnt umount /mnt 15.*Conditional+ 4ou can also ount *and unount+ the su!volue9
mount -o subvolBext_saved /dev/vdb; /mnt mount 1<.*ilesyste9 !tr#s+
ls /mnt umount /mnt 1?.Create a #e$ ore #iles9
m$dir /toconvert/dir-YdLeL'Z touc& /toconvert/dir-YdLeL'Z/btr's'ile 1:.Chec the #iles e%ist9
ls -al /toconvert/dird/ 1'.-oll !ac to the e%t( #ilesyste9
umount /toconvert btr's-convert -r /dev/vdb; 20.&ount the #ilesyste again9
mount /dev/vdb; /toconvert 21.;ie$ the #ilesyste type9
mount "ote that the #ilesyste o# /toconvert is o# type e%t( 22.;ie$ the #iles in /toconvert
ls /toconvert "ote that the directories you created on the trS are gone, only those created initially on the e%t( #ile syste are there 2.Unount the #ilesyste9
umount /toconvert
)ask 2: !er(orm 8tr+S 4aintenan#e )asks 1. Log in to ser&er1 as tux, open t$o terinal $indo$s and9
su 1<
SUSE Linu% Enterprise 12 Adinistration
to root in !oth o# the 2. n one o# the terinals, enter
%atc& btr's scrub status / . S$itch to the other terinal $indo$ and enter9
btr's scrub start / 6he %atc& at the #irst propt $ill sho$ the scru!!ing progress (. n the terinal running %atc& press ,tr$# to end the %atc& process 5. 8e#ragent the #ilesyste recursively, starting #ro F9
btr's 'ilesystem de'ragment -r / <. -evie$ the content o# the !tr#saintenance pacage9
rpm -l btr'smaintenance ?. -evie$ the paraeters that can !e set in /etc/syscon'ig/btr'smaintenance9
less /etc/syscon'ig/btr'smaintenance :. n one o# the terinals, enter 9
%atc& btr's balance status / or no$ the output $ill 3ust !e o ba$an#e (ound on T '. n the other terinal, start a trS tree !alance9
btr's balance start / t taes soe tie #or the propt to return $ith a essage o# ho$ any chuns $ere relocated. Leave the !alance running
Summar": n this la! you converted a e%t( #ileyste to !tr#s. 4ou then converted #ro trS to e%t( proving you can reverse the conversion. 4ou then per#ored soe !asic trS aintenance.
*End o# E%ercise+
1?
SUSE Linu% Enterprise 12 Adinistration
11- 11
,on(i5ure +S
Des#ription: n this e%ercise you $ill con#igure server1 to e%port directories using "Sv( and use server2 as a client to iport the.
)ask 1: Setup and +S Ser&er 1. >n ser&er1, as the tux user, open a terinal $indo$ and s$itch to root using the su coand *pass$ord $inux+ 2. Create the /export/documentation/ directory9
m$dir -p /export/documentation set'acl -m g
cd /export/documentation cp /usr/s&are/doc/manual/sles-admin_en-pd'/ . (. Start the ;aS) +S Ser&er con#iguration odule9
yast n's_server 5. n the +S Ser&er ,on(i5uration dialog, in the +S Ser&er pane ae sure the radio !utton has Start selected <. &ae sure that the Enab$e +S& chec !o% is ena!led, change the +S& domain name to suse.#om and clic ext ?. "o$ you $ill add the /export/documentation/ directory to the list o# directories9 :. Select Add Dire#tor" '. A dialog appears $here you have to speci#y the directory to e%port 10.6ype exportdo#umentation, then select %< 11. A dialog appears $ith #ields #or speci#ying a ost Wi$d ,ard and %ptions 12.Change the preset values to atch the #ollo$ing, then select %< osts Wi$d ,ard: %ptions: r'rootMs?uas*s"n#noMsubtreeM#*e#k *ae sure you replace GroH $ith Gr$H+ @hen copleted clic %< 6he directory is added to the list 1.-epeat the a!ove step to e%port the /&ome directory 1(.Save the changes to the syste !y selecting +inis* 1:
SUSE Linu% Enterprise 12 Adinistration
15.At the terinal $indo$, veri#y that the #ile syste $as e%ported9
s&o%mount -e local&ost 1<.;ie$ the entry ade !y 4aS6 to the /etc/exports #ile
cat /etc/exports 4ou should see the settings you entered in 4aS6
)ask 2: Setup and +S ,$ient 1. >n ser&er2, as the tux user, open a terinal $indo$ and s$itch to root using the su coand *pass$ord $inux+
-
2. Create the /import/ directory9
m$dir /import . Start the +S ,$ient ,on(i5uration #ro the terinal $indo$9
yast n's 6he +S ,$ient ,on(i5uration dialog appears (. Select the +S S*ares ta! and clic Add 5. Enter the #ollo$ing values, then clic %< +S Ser&er ostname: ser&er1.suse.#om emote Dire#tor":
/export/documentation
+S& S*are: se$e#t 4ount !oint >$o#a$@ : Fimport/docs %ptions: de(au$ts
and clic %< <. Select the +S Settin5s ta!, ae sure that the Enab$e +S& chec !o% is ena!led and change9 +S& domain name: $o#a$domain then clic %< ?. ;ie$ the content o# the /import/docs directory9
ls /import/docs :. ind out i# tux can $rite to the directory *in a terinal as tu% user+9
touc& /import/docs/'ile '. ;ie$ the /etc/'stab #ile9 cat /etc/'stab 10.ro a terinal as root ount the pseudo root directory #ro ser&er1 to /mnt9
mount server(.suse.com /mnt
11. ave a loo at the content o# /mnt9
ls /mnt 4ou can see export, &ome and source 12.Unount /mnt again9
1'
SUSE Linu% Enterprise 12 Adinistration
umount /mnt
Summar": n this la! you con#igured t$o directories to !e e%ported #ro server1. 4ou also con#igured e%tended ACL on the e%ported #olders. 4ou then iported to docuentation n#s e%port into server2 and tested tu%7s perissions to the n#s share.
*End o# E%ercise+
1(0
SUSE Linu% Enterprise 12 Adinistration
12Administration and 4onitorin5 Des#ription: 4ou $ill con#igure tie synchroniation $ith "6=. 4ou $ill then con#igure logging.
1(1
SUSE Linu% Enterprise 12 Adinistration
12- 1
,on(i5ure )! Ser&i#e
Des#ription: n this e%ercise you use the 4aS6 "6= Con#iguration odule to con#igure an "6= server. "ote9 n the classroo ser&er2 has no internet access so the connection to the pu!lic ntp server $ill #ail.
)ask 1: ,on(i5ure t*e )! Ser&er 1. Using ser&er2 launch ;aS)9 ;aS) S"stem )ime and Date 2. Clic on %t*er Settin5s . Select S"n#*roni3e 'it* )! Ser&er and select any pu!lic "6= server #ro the )! Ser&er Address list. (. Clic S"n#*roni3e no' "ote9 4ou $ill receive an error !ecause the virtual achine does not have internet access 5. Clic %< at the Error dialogue !o% <. Clic A##ept to save your changes. @ait $hile the "6= 8aeon is restarted and tries to synchronie the tie ?. At the $arning dialogue !o% in#oring you that the selected ntp server can not !e accessed clic o to save the changes :. Clic %< to close the Cloc and 6ie Jone dialogue !o%
Summar": n this e%ercise you used the 4aS6 "6= Con#iguration odule to con#igure an "6= server. "ote9 n the classroo ser&er2 has no internet access so the connection to the pu!lic ntp server $ill #ail.
*End o# E%ercise+
1(2
SUSE Linu% Enterprise 12 Adinistration
12- 2
4ana5e S"stem Lo55in5
Des#ription: n this e%ercise you practice con#iguring rsyslog and logrotate.
)ask 1: 4odi(" t*e rs"s$o5 ,on(i5uration 1. Using ser&er1 as the tux user open a terinal $indo$ and s$itch to root9
su 2. n the te%t editor o# you choice, open the /etc/rsyslog.con' #ile . Add the #ollo$ing lines at the !otto o# the #ile to create entries #or the essages you $ant to log9
local=.Bdebug local=.Bin'o local=.
-/var/log/local=.debug -/var/log/local=.in'o -/var/log/local=
Save the changes and close the editor (. 6o restart the rsyslog daeon enter9
systemctl restart rsyslog.service
5. >pen a ne$ terinal $indo$ and enter9
su – to !ecoe root <. "o$ lets chec the con#iguration !y logging an entry to the in#o level in the local( #acility. Enter the #ollo$ing in one o# your terinal sessions to onitor the activity o# the log #ile9
tail -K /var/log/local=.in'o 4ou $ill see a $arning regarding the #act that the #ile does not yet e%ist. 4ou can disregard this error as the #ile $ill !e created $hen you coplete the ne%t step. ?. n the other terinal $indo$, log an entry to the in# o level in the local ( #acility !y entering9
logger -p local=.in'o 3In'o message (3 Chec the results in the second terinal $indo$ 6he essage should also !e logged in the /var/log/local= #ile and, !ecause o# other entries in /etc/rsyslog.con', in /var/log/localmessages :. n the terinal $indo$ $here the log activity is !eing onitored $ith tail, stop the onitoring !y pressing9
trl+c 1(
SUSE Linu% Enterprise 12 Adinistration
'. -epeat this process #or the de!ug log level !y using the #ollo$ing coand in the #irst terinal $indo$9
tail -K /var/log/local=.debug 10.Use the #ollo$ing coand in the second terinal $indo$9
logger -p local=.debug [Debug In'o message \ >nly those level= log #iles $ith entries $ill !e copressed during log rotation in 6as o# this e%ercise. 11. n the terinal $indo$ $here the log activity is !eing onitored $ith tail, stop the onitoring !y pressing9
trl+c
)ask 2: ,on(i5ure $o5rotate 1. Using ser&er1 at the shell propt as the root user, in the te%t editor o# your choice, open9
/etc/logrotate.d/local= 2. Add the #ollo$ing content to the #ile aing sure the directories in the #irst line are separated $ith spaces9
/var/log/local=.debug /var/log/local=.in'o /var/log/local= Y compress dateext maxage ( rotate 0 si1e 7 postrotate date ** /var/log/local=.in'o endscript Z . Save the changes and close the editor (. S$itch to virtual terinal 1. ro the virtual achine enu select Send Bey and select ,tr$A$t+1 *or enter c&vt ( in the terinal $indo$+ 5. Log in as root $ith a pass$ord o# $inux <. -otate the logs anually9
logrotate /etc/logrotate.con' ?. Chec the directory /var/log #or the copressed local= log #iles9
ls -l /var/log less 4ou see the #ollo$ing #iles9
local=.debug-4!""en#_$a#e>.x1 local=.in'o-4c!""en#_$a#e>.x1 or e%aple, i# the current date is "ove!er 15, 201< then the ipped #ile #or 1((
SUSE Linu% Enterprise 12 Adinistration
local=.in'o $ill !e local=.in'o-7(=(((0.x1 :. 6he
.xz
e%tension is used !ecause the coand to copress #iles is set to
/usr/bin/x1 in /etc/logrotate.con' >nly those log #iles $ith entries are copressed '. E%it less !y entering9
10.Chec the contents o# the local=.in'o ipped archive9
less /var/log/local=.in'o-4!""en#_$a#e>.x1 11. =ress9
to e%it the pager progra 12.Log out as root !y entering9
exit 1.-eturn to the )">&E destop !y pressing9
trl+Alt+K; 1(.Close all open $indo$s
Summar":
*End o# E%ercise+
1(5
SUSE Linu% Enterprise 12 Adinistration
1insta$$ SUSE Linux Enterprise Des#ription: 4ou $il install and con#igure SUSE Linu% Enterprise 12.
1(<
SUSE Linu% Enterprise 12 Adinistration
1- 1
nsta$$ SUSE Linux Enterprise Ser&er 12
Des#ription: n this e%ercise, you install a SUSE Linu% Enterprise Server 12 syste. 6he instructor $ill provide the path to the sles12 installation edia.
)ask 1: !o'er on an Empt" Virtua$ 4a#*ine 1. 4our instructor $ill provided the path to the SLES 12 S=2 iso reuired to install SLES12 S=2 on ser&er 2. # &irt-mana5er is not running #ro a terinal session on the B;& host run9 &irt-mana5er . n &irt-mana5er, select the ser&er (. Select9 %pen 5. ro ser&er virtual achines enu clic Vie' F Detai$s <. ro the ard$are List clic the ,D%4 device ?. n the right clic ,onne#t ne%t to the Sour#e !at*: :. Leave the option S% ma5e Lo#ation selected and !ro$se to the path provided !y the instructor and select the SLES12 S!2 edia '. Clic ,*oose Vo$ume F %< 6he syste ser&er is no$ connected to the installation edia 10.ro the right select 8oot %ptions and ena!le !ooting #ro the ,D%4 !y checing the !o% 11. @ith the ,D%4 selected use the arro$s to ove it to the top o# the list o# !oot devices 12.Clic App$"
)ask 2: nsta$$ SLES12 1. ro ser&erOs virtual achine enu select9 Vie' F ,onso$e 2. @hen ser&er is po$ered on you $ill need to clic in it to get #ocus and press the do$n arro$ ey to select the option nsta$$ation . =o$er on ser&er you can use the !utton or #ro the enus select Virtua$ 4a#*ine F un (. @hen the )-U enu appears, press an arro$ ey to stop the tier 5. *Conditional+ # you $ould lie to use a ey!oard other than the US ey!oard layout, do 1(?
SUSE Linu% Enterprise 12 Adinistration
the #ollo$ing9 =ress 2 #or language settings. Using the arro$ eys, select
SUSE Linu% Enterprise 12 Adinistration
20.n the nsta$$ation Settin5s dialog under ire$all and SS do the #ollo$ing9 Clic open !ehind SS port 'i$$ be b$o#ked Clic nsta$$. 21.n the con#iration dialog select nsta$$ 22.@ait $hile the dis is partitioned and the pacages are installed 2.6he achine $ill re!oot and the login dialog $ill appear
Summar": n this e%ercise, you installed SUSE Linu% Enterprise Server on an epty virtual achine.
*End o# E%ercise+
1('
SUSE Linu% Enterprise 12 Adinistration
Lab Variab$es: LAB_&AR_'WKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK LAB_&AR_(WKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK LAB_&AR_)WKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
150
SUSE Linu% Enterprise 12 Adinistration
151
SUSE Linu% Enterprise 12 Adinistration
152