Professional Documents
Culture Documents
a ta r A rc h ive
-
Guided exercise
-
I n t h i s l a b, students w i l l c reate a n d extract a r c h i ves w i t h t a r .
Outcomes:
-
Students w i l l b a c k u p a d i rectory t ree a n d extract t h e a rc h ive content to another l ocation.
-
� [student@desktopX -]$ s s h root@se rverX
I [ root@serverX -]#
D 3.1 . C reate t h e target d i rectory / b ac k u p t e s t .
-
mkdir /backuptest
'
I [ root@serverX -]#
e t c . t a r . gz a rc h i ve.
-
cd /bac kuptest
(
-
D 3.3. E x t ract t h e e t c . t a r . gz a rc h i ve to t h e /bac k u p t e s t d i recto ry.
-
-
Objectives -
j yum . conf
I student@serverX ' s password : s tu dent
/etc/host s se rverX : /home/student
I
A user ca n copy a f i l e from a remote accou nt o n a re m ote m a c h i n e to t h e l o c a l f i l e syst e m with -
scp. In this exa m p l e, copy t h e f i l e /e t c/host n ame from t h e accou nt student o n t h e serverX
machine to t h e l o c a l d i rectory /home/ s t u d e n t / .
-
298 R H 1 24- R H E L7-en-1-20140606
-
-
sftp>
-
-
The s f t p session accepts va r i o u s c o m m a n d s t h a t work t h e s a m e way on the re mote f i l e syst e m
a s t h ey d o i n t h e l oca l f i l e syst e m , s u c h a s ls, c d , m k d i r , r m d i r , a n d pwd. I n a d d i t i o n , t h e re a re
t h e p u t a n d get com m a n d s for u p l o a d i n g a n d d ow n l o a d i n g f i l es. T h e exit co m m a n d exits t h e
-
s f t p session.
sftp> cd hostbackup
sf tp> put /etc/hosts
Uploading /etc/hosts to /home/student/hostbackup/hosts I
- ·
/ e tc / h o st s 1 0 0% 2 2 0 . 2K B / s 0 0 : 0
L_sftp>
_-___------�--�-��--�-�-�--7 _____ _ 0-·-����-__J'
_
_
__ __
- _
I
-
References
-
R
s c p(l) a nd sft p(l) m a n pages
-
-
-
Guide d exercise
-
I n t h i s l a b , students w i l l copy f i l es from a remote syste m to a loca l d i rectory by u s i n g scp.
Outcomes:
-
Students w i l l copy fi les from a re m ote host to a d i rectory o n the local m a c h i ne.
[student@desktopX -]$
-
!
i mkdir /home/ s t u d e n t / s e rverbackup
i
-
D 1 .2 . Recurs i ve l y c o p y t h e d i rectory / e t c / s s h from s e rverX to t h e
/home / s t u d e n t / s e rve rbac k u p d i rectory o n d e s ktopX w i t h t h e s c p
c o m m a n d . N ote t h a t o n l y t h e root user can rea d a l l t h e c o n t e n t i n t h e / e t c / s s h -
d i recto ry.
[ student@desktopX -]$
l
s c p - r root@serverX : /e t c / ssh /home/student/ -
serve rbackup
-
-
-
O bjectives
After c o m p l e t i n g t h i s sect i o n , st u d e nts s h o u l d be a b l e to effi c i e n t l y a n d secure l y sync h ro n i ze t h e
contents o f a l oca l f i l e o r d i rectory w i t h a remote co py.
- The rsy n c tool i s a n o t h e r way t o securely copy f i l e s from o n e system t o a n ot h e r. I t d iffers from
scp i n that if two f i l e s o r d i recto ries a re s i m i l a r betwe e n two systems, rsy n c o n l y needs to copy
t h e d i fferences betwee n t h e syste m s , w h i l e s c p wou l d need to copy eve ryt h i n g .
-
- · - 1, sy n c h ro n i z e sym b o l i c l i n ks
• - p, preserve p e r m i s s i o n s
-
· - t , preserve t i m e sta mps
• - o p rese rve t h e o w n e r o f t h e f i l e s
,
- • - D, s y n c h r o n i z e d e v i c e f i l es
-
-
f i l e s to t h e t a rget fi l es , t h e - X option is to b e a d d e d .
[student@desktopX -)$ su
Password : redhat
-
[ root@desktopX - ] # rsync
-
- av /var/log /tmp
Important
W h e n e n t e r i n g t h e s o u rce d i rectory for rsy n c , it i s very i m p o rtant to re m e m b e r t h a t -
w h et h e r a t ra i l i n g s l a s h i s present o n t h e d i rectory n a m e m atters. I t w i l l d ete r m i n e
w h et h e r t h e directory o r j ust t h e contents o f the directory a re syn c h ro n i z e d to t h e
target. N ote: Ta b-com p l et i o n w i l l a utomatica l l y a d d a t ra i l i n g s l a s h to t h e e n d of -
d i rectory n a m es.
-
S i m i l a r to scp, t h e r sync com m a n d ex pects remote fi l e system locations to b e specified i n t h e
fo rmat [ u s e r @ ] h o s t : / p a t h . I n c a s e t h e o pt i o n a l u s e r@ portion is m i s s i n g , t h e u s e r invo k i n g
t h e r s y n c c o m m a n d i s used to c o n n e c t to t h e re m ote l ocat i o n . I t i s poss i b l e to use a remote -
location a s e i t h e r sou rce o r ta rget. In the fo l l o w i n g exa m p le, the local fo l d e r /var /log gets
a sy nchronized copy i n t h e /tmp d i rectory on the serverX m a c h i ne. Fo r rsync to sy n c h ro n i ze
own e rs h i p of t h e t ra n sferred f i l es, t h e t a rget l o c a t i o n m u st be w r itten a s u s e r root, so c o n nect -
to the rem ote system serverX as the root u s e r. The c o n n e c t i n g user root m ust t h e n a ut h e nticate
with t h e SSH server by any of t h e accepted methods; for exa m p l e, password o r SSH keys.
In the s a m e way, the remote fo l d e r /var /log on serverX can be syn c h ro n ized to t h e loca l
d i rectory / t m p o n d e s ktopX: -
-
Sy n c h ro n i z e f i l es a n d fo l d e rs w i t h rsync
References
-
r sync(1 ) m a n p a g e
-·
...
·-
-
-
Guided exercise
-
I n t h i s l a b , st udents w i l l sy n c h ro n ize a fo l d e r w i t h a remote syst e m by u s i n g r sync.
Outcomes:
,-
A d i rectory w i l l be sy n c h ro n i zed from a remote m a c h i n e to t h e loca l m a c h i n e. After files o n the
re mote m a c h i n e have c h a n g e d , it w i l l b e sy n c h ro n ized with t h e loca l m a c h i n e again and o n l y t h e
m o d ifica t i o n s w i l l b e t ra nsferred. Both systems w i l l e n d w i t h i d e ntica l content i n t h e d i rectories
sy n c h ro n ized w i t h rsy n c .
[student@desktopX -]$
Password : redhat
su -
[ root@desktopX -]#
-
!_
-
D 1 .2. C reate t h e ta rget d i rectory /se rve r logs o n d e s ktopX w h e re the l o g f i l es of
se rve rX w i l l b e sy n c h ro n ized.
-
D 1.3. U s e t h e rsync com m a n d to synchronize t h e /var /log d i rectory tree o n s e rverX
to the /s e rve rlogs d i rectory o n d e s ktopX. N ote t h a t only t h e root u s e r can
read a l l t h e content i n the /va r /log d i rectory o n s e rverX. All f i l es w i l l b e
-
t ra n sferred i n t h e i n it i a l s y n c h ro n i z a t i o n .
[ root@desktopX -]#
Password : redhat
s s h root@se rverx ' logger " Log f i l e s synch ronized " ' -
[ root@desktopX -]#
-
D 3. Securely syn c h ro n i z e the /var /log d i rectory t ree o n s e rverX to the /server logs
d i rectory o n d e s kto p X with the r sync co m m a n d a g a i n . N ote that t h i s time o n l y t h e
i [ root@desktopX -]#
-
c h a n g e d l og f i l e (s) w i l l be t ra n sfe rred.
i-
-
G u i d e d exerc i s e
·-
-
-
L a b : A rc h iv i n g a n d Co pyi n g F i l es Betwe e n
-
Syste m s
-
Outcomes:
-
S t u d e nts w i l l sy n c h ro n ize a remote fo l d e r to a local d i rectory; a n arch ive i s then created w i t h the
syn c h ron ized fo l d e r a s content; t h e a rc h ive gets copied to t h e rem ote m a c h i n e and extra cted to
a newly c reated d i recto ry. -
-
-
-
Solution
-
Solution
-
-
Before you begin ...
Reset yo u r se rve rX syste m .
-
1 .1 . To be a b l e to c reate t h e t a rg et d i rectory I configsync, switch to t h e root u s e r a c c o u n t
j [ student@desktopX -]$
u s i n g su.
Password : redhat
su
[ root@desktopX -]#
-
L_ -------�-
-
1 . 3 . Use t h e r sync co m m a n d to sy n c h ro n i z e t h e / e t c d i rectory t ree on serverX to t h e
/configsync d i rectory o n desktopX. Be awa re t h a t o n l y t h e root u s e r ca n read a l l t h e
content i n t h e I e t c d i rectory on serverX.
[ root@desktopX -]#
-
-
I [ root@desktopX -]# tar czf / root /configfile - backup - serverX . t ar . gz /configsync
Password : redhat
-
root@serve rX : /root
-
-
d i rectory o n serve r X .
[ root@desktopX configsync] #
Password : redhat
s s h root@serverX
[ root@serverX -]#
-
-
3.2. C reate t h e t a rget d i rectory / t mp/savedconfig/, w h e re t h e contents o f t h e
/ rootlconfigfile - bac ku p - se rve rX . t a r . g z a rc h ive w i l l b e extracted.
3.4. Extra ct the contents of t h e / root /configf ile - bac ku p - serve rX . t a r . gz a rc h ive
-
to the / t mp/savedconfig/ d i rectory o n serverX.
-
-
Sol ution
-
S u m m a ry
-
-
-
·�
I
310
�
'
red h at ®
®
TRAINING
C H A PT E R 1 3
Overview
Softwa re U pd ates
-
Objectives
-
Reg ister syste m s with yo u r Red H a t accou nt a n d e n t i t l e t h e m to s oftwa re u pdates for i n sta l l ed
prod u cts.
-
Red Hat Su bscription Manage ment
Red Hat S u bscription M a n a g e m e n t p rovides too l s t h a t c a n be u s e d to e n t it l e m a c h i n es to
product s u bscriptions, a l l ow i n g a d m i n istrators to get u pdates to s oftwa re packages and track -
i nfo r m a t i o n a bout s u p p o rt co n tracts a n d s u bscriptions used by t h e syste ms. Sta n d a rd too l s such
a s Pa c k a g e K i t a n d y u m c a n o b ta i n softwa re packages a n d u pd ates t h ro u g h a content d is t r i b u t i o n
-
netwo r k p rovided b y Red Hat.
R e g i ster a system
-
To register a system w i t h the s u bs c r i p t i o n m a n a g e m e n t service, l a u n c h s u b s c r i p t ion
manage r - gu i by s e l e ct i n g A p p l i c a t i o n s > O t h e r > R e d H a t S u b s c r i p t i o n M a n a g e r from t h e m a i n
G N O M E m e n u . E nter t h e password f o r root w h e n prom pted to a u t h e nti cate. T h i s w i l l d i s p l a y t h e -
fo l l o w ing S u b s c r i p t i o n M a n a g e r w i n d ow.
-
Red H a t S u bscription M a n a g e m e n t
Subscription Manager
System H elp
. My I nstalled Products
�
My Subscriptions
�����
j
�� ������������������������----,!
I
Status: your
111••e•·l'@@!l.§i?7�:ft;lji.ft;@E
-
I
1 • Red H a t Enterprise Linux 7 Public Beta 7 . 0 Beta Unknown
I
! I
I
Product's S u b s c ription Details
e rs
Status: System is not registered.
Arch: x86_64
system vv i th u p d a t e s and a l l mN a d d i ti o n a l m a n a g e m e n t .
Cancel N ex t
Login: I demo-accoun �
-
Password: · • • • • • •
u Tip : F o r g ot yo ur L o g in o r pa s sw o r d ? Lo o k it up
at ht t p ://redhat . c o m/f o rg o L pa s sword
-
System N ame: d e mo . e x a m p l e . c o m
-
·-., M a n u a l ly a tt a c h s u b s c r i pti o n s aft e r r e g i s trat i o n
Cancel Register
-
By defa u lt , S u b s c r i p t i o n M a n a g e r w i l l try to find the best s u bscription for this system out of a l l -
-
Click the R e g i st e r b u t t o n to com p l ete t h e reg istra t i o n .
A s s i g n i n g s u bs c r i pt i o n s
-
To a s s i g n s u bs c r i pt i o n s to a syst e m , n a v i g a te to t h e A l l Ava i l a b l e S u bs c r i p t i o n s t a b i n t h e m a i n
wi ndow of S u b s c r i p t i o n M a n a g e r , t h e n c l i c k t h e U p d ate b u t t o n to ret ri eve a l ist o f ava i l a b l e
su bscript i o n s .
-
-
314 R H 1 24-R H EL 7-en-1-20140606
-
Red H a t S u bscription M a nagement
Subscription Manager-
System Help
- -- I
• My Installed Products J My Subscriptions Jr.A ll Available Subsc riptions L _
Red Hat E m oy e
pl e Subscription Both m
Un li i ted
;,
q
Subscription Details
Attach
Figure 13. 4: All Available Subscriptions tab of Red Hat Subscription Manager
Contract Selection
S ubscription: 30 Day Self-Supported Re d Hat E n t e r·prise Linux Server, (2 sockets) (Up to 1 guest) Evaluation
Total Contracts: 4
• Click to Adjust Qu;, ntity
I
!
'
Contract Type U sed I Total Start Date E n d Date Quantity
I
--
I __ _
Cancel 11 Attach
'�-·--
-
• View ava i l a b l e s u b s c r i p t i o n s :
• A u to-attach a s u b s c r i pt i o n :
[ root : @serverX
-
I [ root : @serverx
• View consumed s u b s c r i pt i o n s:
r
-
- ] # subsc ription - manager list - - consumed
�
• U n re g i ster a syste m :
[ [ root :@serverx
-
-4i>.: '
� Note
-
s u b s c r i p t ion - manag e r c a n a l so b e used i n conj u n c t i o n w i t h activation keys,
a l l o w i n g reg istra t i o n a n d a ss i g n m e nt of predef i n e d s u b s c r i pt i o n s, without u s i n g a
u s e r n a m e o r password. T h i s method of reg istra t i o n ca n be very usef u l for a u t o m ated -
i n sta l la t i o n s a n d d e p l oy m e nts. Activation keys a re u s u a l l y issued by a n o n - p re m ise
s u bs c r i pti o n m a n a g e m e n t se rvice, s u c h a s S u bs c r i p t i o n Asset M a n a g e r, and w i l l n o t b e
d i sc u ssed i n deta i l i n t h i s cou rse. -
system .
31 6 RH124- R H E L 7-en-1-20140606 -
-
-
Entit l e m e n t certificates
-
- Important
O l d e r v e rs i o n s of Red H a t Enterprise L i n u x orig i n a l l y s u p ported a d i fferen t s u bscription
m a n a g e m e n t method, RHN Classic. R H N C l a ss i c i s not s u p p o rted by Red Hat
-
E n t e r p rise Linux 7.
- R References
s u b s c r i p t ion - manage r - g u i(8), s u b s c r i p t ion - manag e r (8), a n d r c t (8) m a n
pages
-
G e t started w i t h R e d H a t S u bscri p t i o n M a n a g e m e n t
https ://access.redhat.co m/s ite/a r t i c l es/433903
-
-
-
Quiz -
Descri pt i o n Ta s k
-
Dete rm i n e t h e n u m be r of ava i l a b l e
-
s u bsc r i p t i o n s
P rov i d e softwa re p a c ka g e s -
-
-
Sol ution
-
Solution
-
Desc r i p t i o n Ta s k
-
-
R P M Softwa re Pa c ka g es a n d Yu m -
Objectives -
provided a s a n R P M package.
release . a r c h i t ec t u re:
�----- NAME
-
.------ VERSION
RELEASE
r- ARCH
I
-
I
-
----- - ------ --��- ---�--·__J
• N A M E is o n e o r m o re words desc r i b i n g t h e contents ( httpd -too l s).
-
• S c r i pts which may run when this package i s i n sta l l e d , u pd a t e d , or re moved, o r which a re
t r i g g e red w h e n ot h e r packages a re i nsta l l ed, u pdated, o r re m oved. -
-
320 RH124- R H E L 7-e n-1-20140606
-
-
T h e y u m package m a n a g e r
-
-
U pd a t e s a n d Patc h e s
When t h e u pstream s o u rce code fo r a softwa re packa g e i s patched by Red Hat, a co m p l ete
RPM p a c k a g e i s g e n e rated. I f a p a c k a g e i s n e w l y added to a syste m , o n l y the l a test vers i o n of
-
t h a t p a c k a g e is n e e d e d , n ot every vers i o n of t h e package s i n ce the fi rst re l ease. Fo r syste m s
t h a t n e e d u p d a t i n g , t h e o l d vers i o n of t h e package is actua l l y re m oved a n d t h e new vers ion is
i n sta l l e d . Config u ra t i o n f i l es a re u s u a l l y reta i n e d d u r i n g a n u p g ra d e, b u t t h e exact behavior for a
-
partic u l a r package is defined w h e n t h e new vers i o n of t h e package i s created.
Available Packages
-
-
-
[ root@serverx - ] # y u m l i s t installed
Loaded plugins : langpacks
Installed Packages
-
Input Methods
-
{ R References
�-
· -
yum(8), yum . conf(5), r pm(8), r pm2cpio(8), a n d rpmkeys(8) m a n pages
-·
-
-
-
Quiz
Match t h e fo l l ow i n g i t e m s to t h e i r cou nte rparts i n t h e t a b l e.
Arch itect u re
I I C h a n g e l og G P G s i g n a t u re
I Release
-
Repos itory
18
-
Desc r i p t i o n Te r m
L i st of rea s o n s fo r ea c h p a c ka g e b u i l d
-
T h e ve rs i o n of t h e p a c k a g e b u i l d
-
A co l l ect i o n of R P M p a c ka g e s a n d p a c k a g e
g r o u ps
-
-
U s e d to v e r i fy t h e s o u rce a n d i nteg r ity of a
package
-
-
Solution
-
D e sc r i pt i o n Te r m
-
T h e ve rs i o n of t h e p a c k a g e b u i l d R e l ease
-
p a c ka g e
A co l l ect i o n of R P M p a c ka g es a n d p a c ka g e R e p o s itory
g ro u ps -
U s e d to ve r i fy t h e s o u rce a n d i n teg r i ty of a G PG s i g n a t u re -
p a c ka g e
-
-
324 RH124- R H E L7 - e n -1-20140606
-
-
-
Objectives
After c o m p l et i n g t h i s sect i o n , s t u d e n t s s h o u l d b e a b l e to f i n d , i nsta l l , a n d u pdate softwa re
To search for packages that have " w e b serve r " i n t h e i r n a m e, s u m m a ry, a n d description f i e l d s ,
use s e a r c h all:
mod_revocator . x86_64 : CRL retrieval module for the Apache HTTP server
mod_security . x86_64 security module for the Apache HTTP Server
python-paste . noarch : Tools for using a Web Server Gateway Interface stack
-
-
• yum info PACKAGENAME g ives d eta i l e d i nformation a b o u t a p a c ka g e, i n c l u d i n g t h e d i s k
s p a c e n e e d e d f o r i n sta l l at i o n .
I
i [ root@serverx -]# yum info h t t pd
-
-
-
Available Packages
Name httpd
Arch x86_64
-
Version 2.4.6
Release 17 . el7
Size 1.1 M
Re po rhel_dvd
-
web server .
--
To find packages that p rov i d e the /var /www / h t ml d i recto ry, use:
Filename /var/www/html
-
1 : php- pear -1 . 9 . 4-21 . el7 . noarch PHP Extension and Application Repository
framework
Re po rhel_dvd
-
Matched from :
Filename /var/www/html -
[ root@serverX - ] # y u m install h t t pd
Loaded plugins : langpacks
-
Resolving Dependencies
- -> Running transaction check
- - -> Package httpd . x86_64 0 : 2 . 4 . 6-17 . el7 will be installed
-
- -> Processing Dependency : /etc/mime . types for package : httpd -2 . 4 . 6-17 . el7 . x86_64
- -> Processing Dependency : libapr-1 . so . 0( ) ( 64bit ) for package :
-
-
326 R H 1 24- R H E L7-en-1-20140606
-
-
Wo r k i n g with yum
-
Installing :
httpd x86 64 2 . 4 . 6-17 . el7 rhel_dvd 1.1 M
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = == = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
Installed size : 4 . 3 M
- Is this ok [y/d/N] :
• yum u p d a t e PACKAGENAME obta i n s a n d i n s ta l l s a newe r version of t h e softwa re p a c kage,
-
i n c l u d i n g a ny d e p e n d e n c ies. G e n e ra l l y the p rocess tries to p reserve confi g u ra t i o n files i n p l a ce,
but in s o m e cases, t h ey may be r e n a m e d if t h e p a c ka g e r t h i n ks the o l d one w i l l n ot work after
i [ root@serverX - ]#
t h e u pdate. W i t h n o PAC K AG E N A M E specified, it w i l l i n sta l l a l l rel eva nt u pdates.
-
������-��-------,
i
yum update
I
-
Note
-
U s e yum list k e r n e l to l ist a l l i n st a l l e d a n d a va i l a b l e k e r n e l s . To view t h e
c u r re n t l y r u n n i n g ke r n e l , use t h e u name c o m m a n d . The - r o p t i o n w i l l s h ow o n l y
-
t h e k e r n e l v e rs i o n a n d rel ease, a n d t h e - a o pt i o n w i l l show t h e k e r n e l r e l e a s e a n d
additional information.
Installed Packages
kernel . x86_64 3 . 10 . 0-123 . 0 . 1 . el7 @anaconda/7 . 0
kernel . x86_64 3 . 10 . 0-84 . el7 @rhel-7- server - htb-
-
rpms
[ root@serverx -)# u n ame - r
3 . 10 . 0-123 . el7 . x86_64
[ root@serverX -]# u n ame - a
-
Linux demo . example . com 3 . 10 . 0-123 . el7 . x86_64 #1 SMP Tue Nov 26 16 : 51 : 22 EST
-
2013 x86_64 x86_64 x86 64 GNU/Linux
-
-
Warning
-
yum r emove w i l l re m ove t h e packag e(s) l isted and any package that requires the
package(s) being removed (a n d packa g e (s) w h i c h req u i re t h ose packages, a n d s o
on). T h i s can l e a d to u n ex pected remova l of packages, so c a refu l l y c h e c k t h e l ist o f -
packages to b e re m oved.
I
I
Available environment groups :
Minimal install
Infrastructure Server
File and Print Server
Web Server
-
Virtualization Host
'
-
I
Server with GUI
I
Installed groups :
I
I
Base
I Desktop Debugging and Performance Tools
-
Internet Browser
PostgreSQL Database server
Printing client
I X Window System
-
Available Groups :
Additional Development
Backup Client
Backup Server
I -
I
!
I
I
L..,___ -
-
-
Wo r k i n g w i t h yum
-
M a rker M ea n i n g
-
= Pa c k a g e is i n sta l l e d , was i n sta l l ed as part of t h e group
+ Pa c k a g e i s n ' t i n sta l l e d , wi l l be if t h e g ro u p is i nsta l l ed o r u pdated
-
- Pa c k a g e i s n ' t i n sta l l e d , w i l l not be if t h e g r o u p is i nsta l l ed o r u pdated
no marker Pac k a g e is i n sta l l e d , b u t was n ot i n sta l l e d t h ro u g h t h e g ro u p .
+ipa-admintools
+ipa- server
+pki-ca
Optional Packages :
-
___ I
-
[ root@serverX - ] # y u m g r o u p i n s t all " I nfiniband Suppo r t "
Transaction Summary
Install 17 Packages (+7 Dependent packages )
= = = = = = = = = =============== = = = = = = = = = = = = = = = == ========== = = = = = = = = = = = = = = ==== = = = = = = = ====
-
'
-��- ------j
-
-
-
Important -
V i ew i n g t ra n sact i o n h i st o ry
• A l l i nsta l l a n d remove t ra n s a c t i o n s a re l og g e d i n /var /log/yum . log.
-
-
I I I
-
330 R H 1 24- R H E L7-en-1-20140606
-
-
S u m m a ry of yum com m a n d s
-----
-
Pa ckages c a n be l o cated, i nsta l l e d , u pdated, and removed by n a m e o r by package g ro u ps.
Ta sk: Co m m a nd :
-
List i n sta l l ed a n d ava i l a b l e packages b y n a m e yum list [ NAME - PATTERN ]
List i n sta l l ed a n d a va i l a b l e g ro u p s y u m g r o u plist
-
Search for a package by keyword yum s e a r c h KEYWORD
S h ow deta i l s of a p a c k a g e y u m info PACKAGENAME
-
I nsta l l a package yum i n s t all PACKAGENAME
I nsta l l a package g ro u p yum g rou pinst all " GROUPNAM E "
- Update a l l packages yum update
Remove a package yum r emove PACKAGE NAME
- D i s p l ay t ra n sact i o n h i story yum h i s t o ry
- R References
yum(1 ) a n d yum . conf(5) m a n pages
-
A d d i t io n a l i nfo r m a t i o n o n yum may b e a va i l a b l e in the Red Hat Enterprise Linux System
Administrator's Guide fo r Red Hat E n t e r p r i s e L i n u x 7, w h i c h can be fo u n d a t
http://d o c s . r e d hat.com/
-
-
-
Guided exercise
-
I n t h i s l a b , you w i l l i n sta l l a n d remove packages a n d p a c ka g e g ro u p s .
O u t c o mes:
-
E x p l o re i n sta l l i n g and re m ov i n g packages with d e p e n d e n cies.
[ root@serverX - ] # gnuplot
bash : gnuplot : command not found . . .
-
[ root@serverX - ] # y u m s e a r c h plot
Loaded plugins : langpacks
N/S matched : plot
-
[ root@serverx - ] # yum
Name gnuplot
info gnuplot
Arch x86_64
-
D 2. I n sta l l t h e g n u plot p a c ka g e.
Dependencies Resolved
Package Arch Version Repository Size
-
= = = = = = = = = = == = = = = = = = = = = = = = = = == = = = = = = = = = = = = = = = = = = = = = = = = = = = = = == = = = = = = = = = = = = = = = = =
Installing :
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = == = = = ==
-
-
G u i d e d exercise
-
Transaction summary
Install 1 Package (+1 Dependent package )
=============================================================================
-
D 3. R e m ove packages.
-
D 3.1 . Attempt to re m ove t h e gnu plot packa g e, b u t s a y n o. H ow m a ny packages wou l d
be re moved?
[ root@serverx - ] # yum
l
remove gnuplot
Removing :
-
=======================================================================
Remove 1 Package
Installed size : 1 . 5 M
-
Is this ok [y/N] : n
-
D 3.2. Atte m pt to re m ove t h e gnu plot - common package, but say no. How m a n y
-
p a c k a g e s wo u l d b e removed?
Removing :
gnuplot -common x86_64 4 . 6 . 2-3 . el7 @rhel_dvd 1.4 M
-
Installed size : 2 . 9 M
Is this ok [y/N] : n
-
I [ root@serverX - ] #
I
yum g rouplist
-
l
Loaded plugins : langpacks
" Compatibility Libraries "
-
-
+compat -glibc
+compat -libcap1
+compat -libf2c- 34
+compat -libgfortran-41
-.
+compat -libtiff3
+compat -openldap
+libpng12
+openssl098e
-
Resolving Dependencies
- -> Running transaction check
- - -> Package compat -db47 . x86_64 0 : 4 . 7 . 25-27 . el7 will be installed
- -> Processing Dependency : compat -db-headers 4 . 7 . 25-27 . el7 for package :
-
Dependencies Resolved -
Transaction Summary
Install 9 Packages {+3 Dependent packages )
-
Installed :
compat -db47 . x86_64 0 : 4 . 7 . 25-27 . el7
compat - glibc . x86_64 1 : 2 . 12-4 . el7
-
Dependency Installed :
-
Complete !
-
-
D 5.1 . D i s p l ay recent y u m h i sto ry.
-
-
G u i d e d exerc ise
Return-Code Success
Command Line groupinstall Compatibility Libraries
Transaction performed with :
-
[ root@serverx - ] # y u m hi st o r y u n d o 3
-
-
-
Objectives -
-
I [ root @serverX - ] # yum - config - manager - - e�able rhel -� - pu b;ic - be t a - debu g - rpms
parameter i n the /et c /yum . repos . d / redhat . repo f i l e.
-
a
I [ rhel-7-public- beta-debug- rpms]
= = ======================
j async True
,i·_ bandwidth 0
=
I base_persistdir /var/lib/yum/repos/x86_64/7Server
baseurl https : //cdn . redhat . com/content/beta/rhel/everything/7/x86_64/debug
=
= -
cache 0
=
cost 1000
=
deltarpm_percentage
-
=
enabled 1 =
Put a file i n the / e t c /yum . repos . d / d i rectory to e n a b l e s u pport for a new t h i rd-pa rty
reposito ry. Repository confi g u ration f i l e s m u st end in . repo. The re pository d e f i n i t i o n conta i n s -
-
336 RH124- R H E L7-en-1-20140606
-
-
[ root@serverX -]# yum - config - manager - - add - repo= " h t t p : //dl . fedoraproj ect . o r g/pub/epel/
Loaded plugins : langpacks
beta/7/x86_64/ "
-
enabled=1
A f i l e was c reated i n t h e /et c /yu m . repos . d d i rectory w i t h t h e o u t p u t shown. T h i s f i l e c a n
-
n ow b e m o d ified to provide a c u s t o m i zed n a m e a n d t h e l o c a t i o n o f t h e GPG key. A d m i n ist rators
s h o u l d d ow n l oad the key to a loca l fi l e rat h e r than a l l ow i n g yum to ret rieve t h e key from a n
exte r n a l sou rce.
[EPEL]
-
name=EPEL 7 Beta
baseurl=http : //dl . fedoraproj ect . org/pub/epel/beta/7/x86_64/
enabled=1
gpgcheck=1
-
R P M c o n fi g u ra t i o n p a c k a g e for t h e re pository
Some re pos itories p rov i d e t h is config u ra t i o n f i l e and GPG p u b l ic key a s pa rt of a n RPM pa c k a g e
-
t h a t c a n be down loaded a n d i n sta l l ed u s i n g yum local i n s t all. O n e exa m p l e of t h i s is t h e
vo l u nteer p roject E P E L ( E xtra Pa c k a g es f o r Enterprise L i n u x) , w h i c h p rovides softwa re not
s u ppo rted by Red H a t but co m pat i b l e with Red H a t Enterprise L i n u x .
-
[ root@serverX -]#
[ root@serverX - ] #
-
r p m - - impor t h t t p : //dl . fedoraproj e c t . o r g/pub/epel/RPM - GPG - KEY - EPEL - 7
yum install h t t p : //dl . fedoraproj ect . o r g/pu b/epel/beta/7/x86_64/epe l
release - 7 - 0 . 1 . noarch . rpm
-
enabled=8
gpgkey=file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
-
-
[epel- source]
-
-
enabled=0
gpgkey=file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL- 7
gpgcheck=l -
Warning
I nsta l l t h e R P M G P G key before i n st a l l i n g s i g n ed packages. T h i s w i l l verify t h a t t h e -
packages b e l o n g to a k e y w h i c h h a s been i m ported. O t h e rw i se, y u m w i l l com p l a i n
a bo u t t h e m i s s i n g key. ( T h e - - no g p g c h e c k option c a n b e u s e d to i g n o re m i s s i n g G P G
keys, b u t t h i s cou l d c a u s e forg e d o r i n se c u re packages to b e i n sta l l ed o n t h e system , -
R References
A d d it i o n a l i nfo r m a t i o n may b e a va i l a b l e i n t h e section o n config u ri n g y u m a n d y u m -
-
-
-
Guide d exercise
I n t h i s l a b, yo u w i l l config u re yo u r se rver to u s e a sepa rate yum re pository to o bta i n u pdates, a n d
-
u pdate yo u r m a c h i n e.
Outcomes:
-
The syst e m w i l l b e confi g u red to obta i n softwa re u p dates from a c l a ssroom server and t h e
system w i l l b e r u n n i n g t h e l a test L i n u x ke r n e l .
[ root@serverx -]#
-
[updates]
-
-
-
C h a pt e r 1 3 . I n sta l l i n g a n d U pd a t i n g Softwa re Pa c k a g e s
[ root@serverX
-
- ] # yum update - y
[ root@serverx
-
[ root@serverX - ] # uname - r
D 5. Reboot your serverX, then repeat the p rev i o u s step. W h i c h vers i o n i s c u rrent l y in use?
[ root@serverX
-
[ root@serverX - ] # u name - r -
Resolving Dependencies
-
-
-
E xa m i n i n g R P M Pac k a g e F i l es
-
Exa m i n i n g R P M Pa c ka g e F i l es
-
Objectives
After c o m p l et i n g t h i s sectio n , s t u d e nts s h o u l d be a b l e to exa m i n e a n d i n sta l l down l oa d e d
p a c ka g e f i l es.
-
R P M q u e ries: S e l ect o p t i o n s
-
• - q - a: a l l i n sta l l e d packages
[ root@serverx - ] # rpm -q
yum-3 . 4 . 3-118 . el7 . noarch
yum
-
( root@serverx -q
-
[ root@serverX - ] # rpm -q
-
-
R P M q u e ries: I nfo r m a t i o n a bo u t content of p a c ka g es
• - q: l i sts t h e package's n a m e a n d vers i o n ; c o m p a re to yum list
-
-
· - q - c: l i st j u st t h e confi g u ra t i o n fi l es
re m oved
if [ $1 -eq 8 ] ; then
# Package removal, not upgrade
/usr/bin/systemctl - - no- reload disable sshd . service sshd . socket > /dev/null
-
2>&1 1 1 :
/usr/bin/systemctl stop sshd . service sshd . socket > /dev/null 2>&1 I I :
fi
postuninstall scriptlet ( using /bin/sh ) :
-
I [ root@serverX -]#
Querying a nd i nsta l l i n g package f i l es :
-
342 R H 1 24- R H E L7-en-1-20140606
-
/etc/wonderwidgets . conf
-1
/usr/bin/wonderwidgets
/usr/share/doc/wonderwidgets-1 . 0
/usr/share/doc/wonderwidgets - 1 . 0/README . txt
-
Note
- T h e repoq u e ry c o m m a n d c a n a l so be u s e d to get i nformat i o n a bo u t packages a n d
t h e i r contents. I t d i ffers from r p m by l o o k i n g u p t h a t i nfo r m a t i o n i n y u m ' s re positories
i n stead of t h e loca l database of i n sta l l e d p a c kages.
-
-
Using yum to install local package files
yum local i n s t all PACKAGEFIL E . rpm c a n b e used to i n sta l l p a c ka g e f i l es d i rect l y.
I t au t o m a ti ca l l y d ow n l oa d s a n y d e p e n d e n c i e s t h e package has from a ny confi g u red yum
- repos itories. Packages a re no r m a l l y d i g ita l l y s i g n e d to e n s u re they a re l e g i t i m a te ; i f the package
is not s i g n ed by a key t r u sted by yo u r syst e m , it w i l l be rejected. T h e - - nogpg c h e c k o pt i o n c a n
d i sa b l e t h e s i g n a t u re c h e c k if you a re certa i n t h e p a c k a g e i s l e g it i m ate if a pa c k a g e is i n sta l l ed
- with yum i n s t all In Red H a t Enterprise L i n u x 7 the - - nogpgcheck option is not req u i red if a
package is i n sta l l e d w i t h yum localins t all
-
[ root@serverX - ] # yum localinst all wonde rwidget s - 1 . 0 - 4 . x86_64 . r pm
[ root@serverX - ] # rpm -q wonde rwidgets
- , wonderwidgets- 1 . 0-4 . x86_64
L
-
Note
r pm - ivh PA CKAGEFIL E . rpm can a l s o be used to i nsta l l package f i l es. H oweve r,
u s i n g yum h e l ps m a i n ta i n a t ra ns a ct i o n h istory kept by yum (see yum his t o ry).
- Warning
Be ca ref u l w h e n i n sta l l i n g packages from t h i rd pa rties, not j u st beca u se of t h e softwa re
t h a t t h ey may i n sta l l , but beca u s e t h e R P M may r u n a r b i t ra ry s c r i pts a s root as pa rt of
-
t h e i n sta l la t i o n p rocess.
[ root@serverx
11 blocks
-
- ] # rpm2cpio wonderwidget s - 1 . 0 - 4 . x8 6_64 . r pm I c pio - id " * tx t "
-
-
total 4
- rw- r- - r - - . 1 root root 76 Feb 13 19 : 27 README . txt
Ta sk: Command:
D i s p l a y i nfo r m a t i o n a bo u t a package r pm - q - i NAME
L i st a l l f i l e s i n c l u d e d i n a package r pm - q -1 NAME
L i st confi g u ra t i o n f i l es i n c l uded in a package r pm - q - c NAME
List doc u m e ntation f i l e s i n c l uded i n a package r p m - q - d NAME
S h ow a s h o r t s u m m a ry of t h e reason for a r pm - q - - changelog NAME
new package re l e a s e
D i s p l a y t h e s h e l l s c r i pts i n c l uded i n a package r pm - q - - s c r i p t s NAME
R References
yum(8), r pm(8), repoque ry(1 ) , r pm2cpio(8), a n d c pio(1 ) m a n pages
-
P ra ct i ce: Wo rk i n g wit h R P M Pa c ka g e F i l es
Guided exercise
O ut c o m e s :
A package not prov i d e d by a yum repository is i n sta l l e d o n t h e syste m .
D 2. W h a t f i l e s does it conta i n?
/usr/bin/wonderwidgets
/usr/share/doc/wonderwidgets-1 . 0
/usr/share/doc/wonderwidgets- 1 . 0/README . txt
-
D 3. W h at scripts d o e s it conta i n?
Version 1.0
Release 4
-
Architecture : x86 64
Install Date : ( not installed )
-
Group GLS/Applications
License GPL
Size : 4849
- -
R H 1 24 - R H E L 7 e n 1 -201 4 0606 345
-
-
Signature ( none )
-
Installing :
================================================================================
Transaction Summary
Install 1 Package
================================================================================ -
Total size : 4 . 7 k
Installed size : 4 . 7 k
Is this ok [y/d/N] : y
-
Downloading packages :
Running transaction check
Running transaction test
Transaction test succeeded
-
Running transaction
Installing wonderwidgets - 1 . 0- 4 . x86_64 1/1
Verifying : wonderwidgets - 1 . 0 -4 . x86_64 111
Installed :
wonderwidgets . x86_64 0 : 1 . 0-4 -
Complete !
-
-
-
La b: I nsta l l i n g a n d U pd a t i n g Softwa re
-
Pa c ka g es
Outcomes:
-
N ew and u p d ated packages a re i n sta l l ed o n t h e syste m .
3. Fo r secu rity rea sons, it s h o u l d not have the wvd ial package i n sta l l e d .
-
4. W h e n you a re rea d y to c h e c k yo u r work, r u n lab software g rade on s e rverX.
-
-
Solution
-
Outcomes: -
[updates]
name=Red Hat Updates
-
-
2. Confi g u re serverX to a d h e re t o very specific softwa re req u i re m e nts. I t m u st h a ve t h e l atest
vers i o n of t h e fo l l o w i n g packages i n sta l l e d . D o not i n sta l l a l l u pdates. O n l y i nsta l l u p d ates for
the packages l isted i f they a re ava i l a b l e.
-
yum u p d a t e k e r nel
3. Fo r secu rity rea sons, it s h o u l d not have the wvdial package i n sta l l e d .
-
348 R H 1 24- R H E L7-en-1-20140606
-
Sol ution
-
S u m m a ry
-
E xa m i n i n g R P M Pa ckage F i l es
- Pa ckages down l oa d e d o u t s i d e of y u m repos itories c a n be q u e r ied a n d i n sta l l e d w i t h
rpm.
-
-
350
red h at ®
®
TRAINING
C H A PT E R 14
ACCESSING LI N UX FILE
SYSTEMS
Overview
• U s e h a rd l i n ks a n d s y m l i n k s to m a ke m u lt i p l e na mes.
Objectives
After com p l e t i n g t h i s sect i o n , students s h o u l d be a b l e to i d e ntify a d i rectory i n t h e f i l e system
h i e ra rchy a n d w h a t stora g e device it i s sto red o n .
-
Note
Except i o n s a re h a rd d rives i n v i r t u a l m a c h i n e s , w h i c h ty p i ca l l y s h ow u p a s
/dev/vd<l e t ter> o r /dev/xvd<l e t ter>.
-
-
Exa m i n i n g f i l e syste m s
-
[student@serverx ] $ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 6240256 4003760 2236496 65% I
-
-
The partit i o n i n g o n t h e serve r X m a c h i n e sh ows o n e rea l f i l e system, w h i c h is m o u nted o n /.
T h i s i s c o m m o n for v i rt u a l m a c h i n es. The tmpfs and devtmpfs devices a re f i l e syst e m s i n system
-
m e m o ry. A l l fi les written i nto t m pfs o r devtm pfs d i s a p p e a r after syste m reboot.
[student@serverx -]$
Filesystem Size Used Avail Use% Mounted on
-
df - h
/dev/vda1 6 . 0G 3 . 9G 2 . 2G 65% I
devtmpfs 929M 0 929M 0% /dev
tmpfs 937M 80 K 937M 1% /dev/shm
-
-
S h ow a d i s k usage re p o rt for t h e / root d i rectory on s e rverX:
-
-
4 /root/ . dbus
0 /root/ . config/ibus/bus
0 /root/ . config/ibus
0 /root/ . config
14024 /root
-
-
S h ow a disk usage re port in h u m a n - re a d a b l e fo rmat for the /var /log d i rectory o n serverX:
[ root@serverX - ] # du - h /var/log
4 . 9M /var/log/sa
-
68K /var/log/prelink
0 /var/log/qemu-ga
14M /var/log
-
R References
df(1 ) a n d d u (1 ) m a n pages
-
-
-
Quiz
Match t h e fo l l owi n g items to t h e i r c o u n te r p a rt s i n t h e ta b l e.
I I I I
-
T h e d ev i c e f i l e of a SATA h a rd d ri ve res i d i n g
-
i n /dev.
T h e d ev i ce fi l e of a l og i ca l vo l u m e i n / d ev.
-
The d ev i c e f i l e of t h e seco n d d i s k in a v i rt u a l
-
m a c h i n e i n / d ev.
-
T h e d ev i c e f i l e of t h e t h i rd p a rt i t i o n on t h e
seco n d S ATA h a rd d rive i n / d ev.
-
The d ev i ce fi l e of the t h i rd p a r t i t i o n on t h e
-
seco n d d i s k i n a v i rt u a l m a c h i n e i n / d ev.
-
-
Solution
-
Desc r i p t i o n Device f i l e
-
T h e d e v i c e f i l e of t h e seco n d p a r t i t i o n o n /d ev/s d a 2 -
T h e d e v i c e f i l e of t h e seco n d d i s k i n a v i r t u a l /d ev/vd b
-
m a c h i n e i n / d ev.
T h e d e v i c e fi l e of t h e t h i rd p a r t i t i o n o n t h e /d ev/s d b 3
seco n d S ATA h a rd d rive i n / d ev.
-
T h e d e v i c e f i l e of t h e t h i rd pa rt i t i o n o n t h e /d ev/vdb3
-
s e c o n d d i s k i n a v i rt u a l ma c h i n e i n / d ev.
-
-
M o u nt i n g a n d U n mo u n t i n g F i l e Systems
-
M o u nt i n g a n d U n m o u n t i n g F i l e Systems
-
-
Objectives
After c o m p l et i n g t h i s section, students s h o u l d be a b l e to a ccess t h e contents of f i l e systems by
a d d i n g a n d re mov i n g f i l e syste m s from t h e f i l e system h i e ra rc h y.
-
-
T h e mou n t com m a n d ex pects the fi l e system a rg u m e n t in one of two d iffe rent ways:
- Note
As l o n g as a f i l e system is not recreated, t h e U U I D stays the s a m e. T h e device f i l e c a n
c h a n g e ; f o r exa m p l e, if t h e order of t h e d ev i ces i s c h a n g e d o r if a d d i t i o n a l d e v i c e s a re
-
a d d e d to t h e syste m .
-
T h e blkid co m m a n d g i ves a n overview o f exist i n g partit i o n s w i t h a f i l e system o n t h e m a n d t h e
U U I D o f t h e f i l e syst e m , a s we l l a s t h e f i l e syst e m used to format t h e partition.
�
[ root@serverX -]# blkid
/dev/vdal : UUID="46f543fd- 78c9-4526-a857 -244811be2d88" TYPE="xfs"
-
Note
- A f i l e system ca n b e m o u nted o n a n exist i n g d i recto ry. T h e /mnt d i rectory e x i st s
by defa u l t a n d provides a n e n t ry point for m o u n t p o i nts. I t i s used for m a n u a l l y
m o u n t i n g d isks. I t i s reco m m e n d e d to create a s u b d i rectory u n d e r /mnt a n d u s e t h a t
-
s u b d i rectory a s a m o u n t p o i n t u n l ess t h e re i s a reas o n to m o u n t t h e f i l e syst e m i n
a no t h e r s p e c i f i c l oc a t i o n i n t h e f i l e syste m h i e ra rc hy.
I [ root@serverX -]#
M o u nt by device f i l e of t h e p a r t i t i o n that h o l d s t h e fi l e syste m .
-
mou n t /dev/vdb1 /mnt/mydata
-
M o u nt the fi l e syst e m by u n ive rsa l u n iq u e id, or the U U I D, of t h e f i l e system.
[ root@serverX -]# mou n t U U I D = " 46f543fd - 7Bc9 - 4526 - a857 · 244811be2dB B " /mnt /mydata
-
-
-
Note -
[ root@serverx mydata]# cd
�---- --
I
!
�- =--, -
Note
A c o m m o n cause for t h e f i l e system on t h e m o u nt p o i n t to b e b u sy i s if t h e c u r re n t
wor k i n g d i rectory of a s h e l l p ro m pt i s b e l ow t h e a ctive m o u nt point. T h e p rocess
a ccess i n g the m o u n t point is bash. C h a n g i n g to a d i rectory outside the mount p o i n t
a l l ows t h e device to b e u n mo u nted.
-
-
-
Warn ing
-
To s a fe l y re m ove U S B m e d i a from t h e syst e m , it is req u i red to u n mo u nt it before
p hysica l l y re m o v i n g it from t h e U S B s l ot to sy n c h ro n i z e t h e f i l e system. Removing a
U S B stora g e device without u n m o u n t i n g t h e f i l e syst e m on it c a n res u lt i n data l oss.
-
-
R References
�J_ _