Tải bản đầy đủ (.pdf) (435 trang)

IT training RH254 RHEL7

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


Red Hat System
Administration 111
Student Workbook

RH254-RHEL7-en-1-20140711
MAN-RH254SKE-R2


Comprehensive, hands-on training that solves real world problems

Red Hat System
Administration 111
Student Workbook

©

2014 Red H a t , I n c .

R H 2 54-R H E L 7-en-1 -201 40711


-

-

-

-

-



-

-

-

-

-

-

-

-

-

-

-

-

-

-

-


-

-

RED HAT SYSTEM

ADMINISTRATION
Ill


-

R H254

-

Red Hat Enterprise Linux 7 RH254

Red Hat System Administration Ill

-

Edition 1

-

Authors:

Wander Boessenkool, Chen Chang, Will Dinyes, George Hacker,


Editor:

Steven Bonneville

Rudolf Kastl, Scott McBrien, Douglas Silva, Philip Sweany

Copyright©

2014 Red Hat, Inc.

-

-

The contents of this course and all its modules and related materials, including handouts to
audience members, are Copyright©

-

2014 Red Hat, Inc.

No part of this publication may be stored in a retrieval system, transmitted or reproduced in
any way, including, but not limited to, photocopy, photograph, magnetic, electronic or other
record, without the prior written permission of Red Hat, Inc.
This instructional program, including all material provided herein, is supplied without any
guarantees from Red Hat, Inc. Red Hat, Inc. assumes no liability for damages or legal action
arising from the use or misuse of contents or details contained herein.
If you believe Red Hat training materials are being used, copied, or otherwise improperly
distributed please e-mail or phone toll-free (USA)

or

+1(919)754-3700.

+1 (866) 626-2994

Red Hat. Red Hat Enterprise Linux, the Shadowman logo, JBoss, Hibernate, Fedora, the
Infinity Logo, and RHCE are trademarks of Red Hat. Inc., registered in the United States and
other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other
countries.
Java® is a registered trademark of Oracle and/or its affiliates.

-

-

-

-

-

XFS® is a registered trademark of Silicon Graphics International Corp. or its subsidiaries in
the United States and/or other countries.

-

The OpenStack® Word Mark and OpenStack Logo are either registered trademarks/service
marks or trademarks/service marks of the OpenStack Foundation, in the United States

and other countries and are used with the OpenStack Foundation's permission. We are not
affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack
community.

-

-

All other trademarks are the property of their respective owners.

Contri butors a n d Reviewe rs: C h r i s N e g u s, B r u c e W o l fe, Rob Locke, Bowe S t r i ck l a n d , E l l e n
Fre e m a n , C o n n i e Pet l itzer, B ra nd o n N o lta, N i raj N i g a m , D i rk Davidis, Fo r rest Tay l o r, J i m R i g s bee,
R i c a rdo Ta n i g u c h i

-


-

-

-

-

-

-

D o c u m e nt C o nve n t i o n s

xi
N otes a n d Wa r n i n g s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x i
I nt rod uction
Red H a t Syste m A d m i n istra t i o n I l l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
O r i e ntation to t h e C l assroom Enviro n m e n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I nternati o n a l i z a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.

-

-

2.

-

-

-

3.

-

-

-

-


-

xiii
xiii
xiv
xv

Contro l l i n g Services and D a e m o n s
Contro l l i n g S e rvices w i t h syste mctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
P ra ctice: U s i n g systemct l to M a nage S e rvices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Contro l l i n g t h e Boot P rocess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Practice: S e l e c t i n g a Boot Ta rget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 5
L a b : Contro l l i n g S e rvices a n d D a e m o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
M a n a g i n g 1 Pv6 N etworki n g
Review of 1 Pv4 Netwo r k i n g Confi g u ra t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: Config u r i n g 1 Pv4 N etwork i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 Pv6 N etwo r k i n g Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: I nt e r p ret i n g 1 Pv 6 Add resses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 Pv6 N etwo r k i n g Confi g u ra t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: Confi g u ri n g 1 Pv 6 N etwo r k i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L a b : M a na g i n g 1 Pv 6 N etwo r k i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

24
31
35
41
43
49

54

Confi g u r i n g Li n k A g g re g a t i o n and B ri d g i n g
59
Config u r i n g N etwork Tea m i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Pra ctice: Config u r i n g N etwork Tea m i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
M a n a g i n g N etwork Tea m i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Practice: M a n a g i n g N etwork Tea m i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Config u r i n g Software B r i d g es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8
Practice: Config u r i n g S oftwa re B r i d g es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Lab: Confi g u ri n g L i n k A g g regation and B r i d g i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

4. N etwork Port S e c u rity
89
M a n a g i n g Fi rewa l l d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Practice: Confi g u r i n g a Fi rewa l l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
M a n a g i n g R i c h R u l es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Practice: Writ i n g C u stom R u l es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 01
M a s q u e rad i n g a n d Port Fo rwa rd i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . 1 03
Practice: Fo rwa rd i n g a Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 6
M a n a g i n g S E L i n u x Port L a b e l i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 07
Practice: M a n a g i n g S E L i n u x Port L a be l i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 0
L a b : N etwo r k P o r t S e c u rity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 3
5.

119
M a n a g i n g D N S for S e rvers
D N S Concepts
120
P ractice: D N S Reso u rce Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 8

Config u ri n g a C a c h i n g N a m ese rver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 31
Practice: Config u r i n g u n bo u n d as a C a c h i n g N a m eserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 5
D N S Tro u b l es h o ot i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Practice: Tro u b l es h o o t i n g DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 44
L a b : M a n a g i n g D N S fo r S e rve rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 47
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

-

-

-

-

-

6. Confi g u ri n g E m a i l Tra n s m i ss i o n
155
Config u ri n g S e n d - o n l y E m a i l S e rvice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 5 6

RH254- R H E L 7-en-1 -201 40711

vii


-

-


R H 254
Practice: Confi g u r i n g Sen d-o n l y E m a i l S e rvice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 63
L a b : Confi g u ri n g E m a i l Tra n s m i s s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 6
7.

173
Provi d i n g R e m ote B l o c k Stora g e
i S C S I Concepts
174
Practice: i S C S I C o n ce pts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Provid i n g i S C S I Ta rgets . . . . . . . . . . . . . . . . . . . . .. . . . .. .. .. .. .. . . . . .. . . . .. . . . . . . . . . . . . .. .. . . . . . . . . . . . . . . . . . .. . . . . . . . . 1 8 0
Practice: P rovi d i n g i S C S I Ta rgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 8 6
Access i n g i S C S I Stora g e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 8 9
Practice: Acces s i n g i S C S I Stora g e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 91
L a b : P rov i d i n g B l oc k-based Stora g e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 9 5

-

-

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

201
Provi d i n g F i l e -based Stora g e
Exp o rt i n g N FS F i l e Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Practice: E x p o rt i n g N FS File Syst e m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Protect i n g NFS E x p o rts . . . . . . . . . . . . . .. .. . . . .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . 209
Practice: P rotect i n g N FS Exports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Prov i d i n g S M B F i l e S h a res . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Practice: P rov i d i n g S M B File S h a res . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Perfo r m i n g a M u l ti user SMB M o u n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Practice: Perfo r m i n g a M u lt i u s e r S M B M o u n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
L a b : P rovi d i n g F i l e-based Stora g e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

8.

9.

Confi g u ri n g M aria D B Databases
I n sta l l i n g M a r i a D B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: I n sta l l i n g M a r i a D B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wo r k i n g with M a r i a D B Databases .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. . . . . . . . . . .
Practice: M a r i a D B C o m m a n d s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
M a n a g i n g Database Users a n d Access R i g hts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: M a n a g i n g U se rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creat i n g a n d Resto r i n g M a r i a D B B a c k u p s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: Restor i n g a M a ria D B Data base from Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab: C o n fi g u r i n g M a r i a D B Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.

11.

12.

viii

247

248

254
258
2 64
2 67
272
275
280
282

289
Prov i d i n g Apache HTTPD We b S e rvice
Confi g u r i n g A p a c h e HTTPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Practice: Config u r i n g a Web S e rver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Confi g u r i n g a n d Tro u b l eshoot i n g V i rtu a l H osts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Practice: Confi g u ri n g a V i rt u a l H ost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 01
Config u r i n g HTTPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Practice: Confi g u ri n g a TLS-e n a b l e d V i rt u a l H ost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
I nteg ra t i n g Dynamic Web Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 5
Practice: Config u r i n g a Web A p p l ication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 8
L a b : Prov i d i n g A p a c h e HTTPD W e b S e r v i c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 1

Writ i n g B a s h Scripts
Bash S h e l l S c r i pt i n g Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Practice: Writ i n g Bash Scr i pts . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L a b : Writ i n g B a s h Scri pts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B a s h C o n d it i o n a l s a n d Control S t r u c t u res
E n h a n c i n g Bash S h e l l Scri pts w i t h C o n d i t i o n a l s a n d Control Struct u res . . . . . . . . . . . . . . . . . . . . . .
Practice: E n h a n c i n g Bash S h e l l S c r i pts w i t h C o n d i t i o n a l s a n d Control Struct u res . . . . . . . . .
Lab: Bash C o n d i t i o n a l s and Contro l S t r u c t u res . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


-

-

-

-

-

-

-

-

-

-

-

327

328
341
345
351

352

362
368

R H254- R H E L 7-en-1-20140711

-

-

-

-


-

-

-

13.

-

-

14.

Confi g u ri n g t h e S h e l l Enviro n ment
C h a n g i n g t h e S h e l l Enviro n m e nt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

P ractice: Working with Log i n and N o n- L o g i n S h e l l s . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab: Confi g u r i n g t h e S h e l l E n v i ro n m e nt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

375

376
380
382

Linux Conta i n e rs a n d Doc ker
387
I nt ro d u ct i o n to L i n u x Conta i n e rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8 8
U s i n g Docker
394
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

-

-

15.

C o m p re h e n sive Review
401
Red Hat System A d m i n i stration I l l C o m p re h ensive Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Lab: C o m p re h e n s i ve Review of System A d m i nistrat i o n I l l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

-

-


-

-

-

-

-

-

-

-

-

-

-

-

-

RH254- R H E L 7 - en -1 -20140711

ix



-

Document Conventions

-

-

N otes a n d Wa r n i n g s

-

N ote

-

" N otes" are t i ps, s h o rtcuts or a l te r n a tive a p p ro a c h e s to t h e task at h a n d . I g n o r i n g a
n ote s h o u l d have n o n e g a t i ve conseq u e n ces, b u t you m i g ht m i s s o u t on a t r i c k t h a t
m a kes your l ife e a s i e r.

-

-

R

-


-

-

'

Refe re n ces
" References" d e s c r i b e w h e re to f i n d exte r n a l d o c u m e ntation re l eva nt t o a s u bject.

Im p o rta nt
" I m portant" b o x e s deta i l t h i n g s t h a t a re e a s i l y m issed: config u ra t i o n c h a n g es t h a t
o n l y a p p l y to t h e c u rrent sess i o n , o r services t h a t n e e d resta r t i n g before a n u p d ate
w i l l a p p l y. I g n o r i n g a box l a be l ed " I m porta n t " w i l l n ot ca u se data l oss, but may ca u se
i rrita t i o n a n d f r u st ra t i o n .

-

-

Wa r n i n g
" Wa rn i n g s " s h o u l d n ot b e i g n o red. I g n o r i n g wa r n i n g s w i l l most l i ke l y cause data l oss.

-

-

-

-


-

-

-

-

-

-

R H254- R H E L 7-en-1 -20140711

xi


-

-

-

-

-

-

-


-

-

-

-

-

-

-

Introduction
R e d H a t Syst e m Ad m i n i st ra t i o n Ill
Red Hat System Administration Ill ( R H 254) is d e s i g n e d fo r experi e n ce d L i n u x system
a d m i n i st rators with the Red Hat Certified System A d m i n istrator ( R H CSA) certification or
e q u i va l e nt s k i l l s . This cou rse i s i nt e n d e d to h e l p st u d e n t s broa d e n t h e i r a b i l ity to a d m i n ister
L i n u x syst e m s at an enterprise l eve l .
Red Hat System Administration Ill i s focu s e d o n d e p l oy m e n t a n d m a n a g e m e nt of network se rve rs
r u n n i ng c a c h i n g D N S service, M a r i a D B , A p a c h e H TTPD, Postfi x S M T P n u l l c l ients, network f i l e
s h a r i n g w i t h N FS a n d S M B, i S C S I i n it i ators a n d ta rgets, a d v a n ced n etwo r k i n g a n d fi rewa l l d
confi g u ra t i o n s , a n d t h e u s e o f B a s h s h e l l scri pt i n g t o h e l p a utomate, confi g u re, a n d t ro u b l es h oot
t h e syste m . T h ro u g h the lectu res a n d h a n d s- o n l a bs i n t h i s co u rse, stu d e nts who have a l re a d y
e a r n e d t h e R H CS A certifica ti o n w i l l b e e x p o s e d to a l l com pete ncies covered by t h e R H C E exa m .
T h i s cou rse d oes n ot cover a l l R H C S A t a s k s . S t u d e nts w h o n e e d a review of R H C S A s k i l l s a re
e n c o u ra g e d to attend RHCSA Rapid Track ( R H1 9 9) .


Co u rse O bject ives




B u i l d s k i l l s n e e d e d to b e a s u ccessf u l s e n i o r R e d Hat E n t e r p rise L i n u x system a d m i n istrato r
res p o n s i b l e for m a n a g i n g n etwork services
Pre p a re for atte n d a nce i n an R H C E certification exa m

Au d i e n ce


E x p e r i e n ced L i n u x a d m i n i st rators w i s h i n g to l e a r n a ut o m a t i o n tech n i q u es t h ro u g h script i n g ,
d e p l oy m e n t of key network services a n d how t o m a n a g e featu res of R e d Hat E nterp rise L i n u x .

P re requ i s ites


R H C S A certifi cat i o n o r e q u i va l e nt e x p e r i e n ce.

-

-

-

-

-


-

-

-

R H 2 5 4- R H EL 7 - e n -1 -20140711

xiii


-

-

I nt ro d u c t i o n

O r i e ntat i o n to t h e C l a s s ro o m E nv i ro n m e n t
I n t h i s cou rse, students wi l l d o m ost h a n ds-on practice exercises a n d l a b work with two c o m p u t e r
systems, w h i c h w i l l b e referred to a s desk t o p a n d s e rver. These m a c h i nes h a v e t h e host n a mes
des kto pX.exa m p l e.com a n d serve rX.ex a m p l e.co m , w h e re t h e X i n t h e computers' host n a m e s w i l l
b e a n u m b e r t h a t w i l l va ry from s t u d e n t t o st u d e nt. Both m a c h i n es have a sta n d a rd u s e r acco u nt.
student, w i t h t h e passwo rd student. T h e root pa ssword o n both syste m s i s redhat.
I n a l i ve i n st ructor- l e d c l a ssroom, stude nts w i l l be a s s i g n e d a p hysica l computer ( " f o u n d a t i o nX" )
w h i c h wi l l be used to access t hese two m a c h i nes. T h e d e s k t o p a n d se rver syst e m s a re v i rt u a l
m a c h i n es r u n n i n g o n t h a t host. S t u d e nts shou l d l o g i n t o t h i s m a c h i n e as u s e r kiosk w i t h t h e
p assword redhat.

-


-

-

-

-

On fou n d a t i o nX, a speci a l c o m m a n d c a l l e d r h t - vmc t l is used to work with t h e d e s k t o p
a n d se rve r m a c h i nes. T h e c o m m a n d s i n the t a b l e b e l ow s h o u l d b e r u n as t h e kiosk u s e r o n
fou n d a t i o nx, a n d c a n b e u s e d w i t h se rver ( a s i n t h e exa m p l es) o r desktop.
-

rht - vm c t l commands
Action

Com m a n d

S t a r t se rve r m ac h i n e

r h t - vmc t l s t a r t se rve r

V i ew " physica l conso l e " to log i n a n d work
w i t h server mach i n e

r h t - vmc t l view se rve r

Reset serve r mach i n e to i t s prev i o u s state
a n d resta rts v i rt u a l m a c h i n e


r h t - vmc t l reset se rve r

At t h e start o f a l a b exercise, if t h e i n s t r u ction " reset y o u r serve r " a p pea rs, t h a t m e a n s t h e
c o m m a n d r h t - vmc t l r e s e t se rve r s h o u l d be r u n i n a prompt on t h e fo u n d a t i o nX system a s
u s e r kiosk. Li kewise, if t h e i n st ruction " reset your d esktop" a p pe a rs, that means t h e c o m m a n d
r h t - vmc t l r e s e t d e s k t o p s h o u l d b e r u n o n fo u n d a t i o nx a s user kiosk.
E a c h stu d e n t is on t h e 1 Pv4 n etwo r k 172.25.X.0/24, w h e re t h e X m a tches the n u m be r of t h e i r
d e s ktopX a n d serverX syste ms. T h e i n st r u ctor r u n s a centra l u t i l ity server w h i c h a c t s a s a router
for t h e c l a ssroom netwo rks and which p rovides DNS, D H C P, H T T P, a n d ot h e r content servi ces,
c l a ssroom .exa m p l e.co m .

-

-

-

-

-

-

C l a ssroom Machines

Machine name

I P a d d resses

Role


d e s ktopX.exa m p l e.com

172.25.X.1 0

Student " c l i e nt " c o m p u t e r

se rverX.exa m p l e.com

172.25.X.11

Student "serve r " c o m puter

c l a ssroom .exa m p l e.com

172.25.254.254

C l a ss room u t i l ity s e rver

-

-

-

-

xiv

R H 254- R H E L7 - e n -1 -20140711


-

-


-

-

-

I nt e r n at i o n a l i z a t i o n

Inte r n at i o n a l iza t i o n

-

-

-

-

-

La n g u a g e s u p po rt
Red H a t Enterprise L i n u x 7 off i c i a l l y s u pports twenty-two l a n g u a g es: E n g l i s h , A s s a m ese, B e ng a l i ,
C h i nese ( S i m p l if i e d ) , C h i nese (Tra d i t i o n a l ) , Fre n c h , G e r m a n , G uj a rati, H i n d i , I ta l i a n , J a p a n ese,
K a n n a d a , Kore a n , M a l a ya l a m , M a ra t h i , O d i a , Po r t u g u e s e ( B ra z i l i a n) , P u n j a b i , R u s s i a n , S pa n is h ,

Ta m i l , a n d Te l u g u .

Pe r- u s e r l a n g u a g e se l e ct i o n
U se rs m a y p refe r to u s e a d i ffe re n t l a n g u a g e for t h e i r d e s ktop e n v i ro n me n t t h a n t h e system­
w i d e defa u l t. They m a y a l so want to set their a cc o u n t to u s e a d i fferent keyboa rd l a y o u t o r i n p u t
method.
L a n g u a g e setti n g s

-

-

-

-

-

-

-

-

-

-

-


-

I n t h e G N O M E desktop e n v i ro n m e nt. t h e u s e r m a y be prom pted to s e t t h e i r preferred l a n g u a g e
a n d i n p u t method o n fi rst l o g i n . I f n o t , t h e n t h e eas iest w a y for a n i n d i v i d u a l u s e r to a dj u st t h e i r
p referred l a n g u a g e a n d i n p u t m e t h o d sett i n g s i s to use t h e R e g i o n & L a n g u a g e a p p l i c a t i o n . R u n
t h e c o m m a n d gnome - cont rol - c e n t e r region, o r f r o m t h e t o p b a r, sel ect ( U s e r) > Sett i n g s .
I n t h e w i n dow t h a t o p e n s , sel ect R e g i o n & L a n g u a g e . T h e u s e r can c l i c k o n t h e L a n g u a g e b o x
a n d s e l ect t h e i r preferred l a n g u a g e f r o m t h e l i st t h a t a p pea rs. This w i l l a l so u pdate t h e Fo rmats
sett i n g to t h e defa u l t for t h a t l a n g u a g e. The next time the user logs in, t h ese c h a n g e s w i l l take
f u l l effect.
These sett i n g s a ffect the G N O M E d e s ktop e n v i ro n me n t a n d any a p p l i catio ns, i n c l u d i n g gnome ­
t e rminal, started i n s i d e it. H oweve r, t h ey d o n ot a p p l y to t h a t acco u nt if accessed t h ro u g h a n
s s h l o g i n from a remote syst e m o r a local text c o n so l e (s u c h a s t t y2).

N ote
A u s e r can m a ke t h e i r s h e l l e n v i ro n m e n t u s e t h e s a m e LANG sett i n g as t h e i r g ra p h ic a l
e n v i ro n ment. e v e n w h e n t h ey l o g i n t h r o u g h a text c o n s o l e o r over s s h . O n e w a y t o d o
t h i s i s to p l a ce code s i m i l a r to t h e fo l l owi n g i n t h e u s e r ' s -I. bas h r c f i l e. T h i s exa m p l e
code w i l l set t h e l a n g u a g e u s e d o n a text l o g i n to m a t c h t h e o n e c u rrent l y s e t f o r t h e
u s e r ' s G N O M E des ktop e n v i ro n m ent:
i=$ ( g r ep ' La n g u age= ' /var/lib/Acc o u n t S e rvice/ u s e r s /${USER} \
I s e d ' s / L a n g u ag e = / / ' )
if [ 11 $i 11 ! = 11 11 ] ; t h e n
expo r t LANG=$i
fi

J a p a n ese, Kore a n , C h i n ese, o r other l a n g u a g es with a n o n - L a t i n c h a racter set may n ot
d i s p l a y pro p e r l y o n l o ca l text consol es.
I n d i v i d u a l co m m a n d s can be m a d e to use a n o t h e r l a n g u a g e by sett i n g the LANG va r i a b l e o n t h e
com m a n d - l i n e :

[ u s e r@h o s t - ] $ LANG=f r_FR . ut f 8 date
jeu . avril 24 17 : 55 : 01 CDT 2014

-

-

-

R H254- R H E L 7-en-1-201 40711

xv


-

-

I ntroduction
S u bseq u e n t co m m a n d s will revert to using t h e syste m ' s defa u lt l a n g u a g e for o u t p u t . T h e locale
com m a n d can b e used to check the c u rrent va l u e of LANG a n d ot h e r related e n v i ro n m e nt
va r i a b l es.

-

-

In p u t met hod sett i n g s

G N O M E 3 i n Red H a t E nterprise L i n u x 7 a ut o m a t i ca l l y u s e s t h e IB u s i n p u t m e t h o d selection

system, w h i c h m a kes it ea sy to cha n ge keyboa rd l ayouts a n d i n p ut methods q u i c k l y.
T h e Reg i o n & L a n g u a g e a p p l ication c a n a l so be used to e n a b l e a l te r n ative i n put methods. In t h e
R e g i o n & L a n g u a g e a p p l i ca t i o n ' s w i n d ow, t h e In put S o u rces box shows w h a t i n p ut m e t h o d s a re
c u rre n t l y ava i l a b l e. By defa u lt, E n g l i s h ( U S) m a y be t h e o n l y ava i l a b l e m e t h o d . H i g h l i g h t E n g l i s h
( U S) a n d c l i c k t h e key board icon to s e e t h e c u rrent keyboard l ayout.
To add a n ot h e r i n p u t method, c l i c k o n the + b utton at t h e bottom l eft of the In put S o u rces
w i n d ow. An A d d a n In put S o u rce w i n d ow wi l l o p e n . S e l ect yo u r l a n g u a ge, a n d then you r
p referred i n p u t method o r keyboa rd l ayo ut.
O n ce m o re t h a n o n e i n p ut method i s config u red, t h e user c a n switch betwe e n them q u i c k l y by
typing S u p e r +Space (so meti mes c a l l e d Windows+Space). A status indicator w i l l a l so a p pear
i n t h e G N O M E top b a r w h i c h has two f u nctions. F i rstly, it i n d icates w h i c h i n p u t method is active.
Seco n d l y, it a cts as a m e n u w h i c h c a n b e used to switch betwee n i n p u t methods o r s e l ect
a d va n ced fea t u res of m o re com p l ex i n p u t methods.
S o m e of t h e methods a re m a rked with g e a rs, which i n d i cate t h a t t h ose methods h a ve adva n ced
confi g u ra t i o n options a n d capa b i l ities. Fo r exa m p l e, the J a pa n ese Ja p a n e s e ( Ka n a Ka n ji) i n put
method a l l ows t h e u s e r to pre-edit text in L a t i n and use DownA r r ow and U pA r r ow keys to sel ect
the correct c h a ra ct e rs to use.
U S E n g l i s h spea ke rs may find a l s o this u sefu l . Fo r exa m p l e, u n d e r E n g l i s h ( U n ited States) i s the
keyboard layout E n g l i s h ( i nternat i o n a l AltGr d e a d keys), which t reats Alt G r (or the r i g ht Alt )
o n a P C 1 04/1 0 5 - key keyboa rd as a "seco n d a ry-shift" modifier key a n d d e a d k e y a ctivation key
for typi n g a d d i t i o n a l c h a racters. T h e re a re a l so Dvora k a n d other a l ternat ive l ayo uts ava i l a ble.

-

-

-

-


-

-

-

-

-

-

N ote
Any U n icode c h a racter can b e en tered i n t h e G N O M E d e s ktop e n v i ro n m e n t if t h e user
k n ows t h e c h a racte r ' s U n icode code point, by t y p i n g Ct r l+Shif t + U , fo l l owed by t h e
c o d e p o i n t . Afte r Ct rl +Shift+U h a s b e e n t y p e d , a n u n d e r l i ned u w i l l b e d i s p l ayed t o
i n d icate t h a t t h e system i s wa i t i n g for U n icode c o d e point e n t ry.

-

Fo r exa m p le, t h e l owercase Greek l etter l a m bd a has t h e code p o i n t U + 03 B B, a n d c a n be
ente red by typ i n g Ct rl+Shift+U, t h e n 03bb, t h e n E n t e r .
-

Syst e m - w i d e d efa u l t l a n g u a g e sett i n g s
The syste m ' s d e fa u l t l a n g u a g e i s set to U S E n g l i s h , u s i n g t h e U T F-8 e n co d i n g of U n icode a s its
c h a racter set (en_US . u t f8), but t h i s can be c h a n g e d d u ri n g o r after i nsta l l a t i o n .
From t h e c o m m a n d l i n e, root can c h a n g e t h e syste m-wide loca l e sett i n g s w i t h t h e localectl
command. I f locale c t l i s r u n with n o a rg u m e nts, it will d i s p l ay t h e c u rrent syste m-wide l oca l e
sett i ngs.

To set t h e syste m-wide l a n g u a ge, run t h e co m m a n d locale c t l set - locale LANG=1oca1e,
w h e re locale is t h e a p p ro p r i ate $LANG from t h e " La n g u a g e Codes Refe rence" ta b l e

-

-

-

-

xvi

R H254- R H E L7-en-1 -20140711

-

-


...

-

L a n g u a g e p a c ks
i n t h i s c h a pt e r. T h e c h a n g e w i l l ta ke effect for u se rs o n t h e i r n ext l o g i n , a n d is stored i n
/ e t c/locale . cont.
[ r o o t @ h o s t - ] # localec tl set - locale LANG=fr_FR . utfB

In G N O M E , an a d m i n i st rative user can c h a n g e t h i s sett i n g from Region & L a n g u a g e and c l ic k i n g

o n t h e Log i n Screen b u tton at t h e u p p e r r i g h t corner o f t h e w i n d ow. C h a n g i ng t h e L a n g u a g e
of t h e l o g i n s c re e n w i l l a l so a dj u st t h e syste m - w i d e defa u lt l a n g u a g e sett i n g stored i n t h e
/ e t c /locale . conf confi g u ra t i o n fi l e.

'

I m p o rta nt
Loca l text c o n s o l es s u c h a s t ty2 a re m o re l i mited i n t h e fo nts t h a t t h ey c a n d i s p l ay
t h a n g nome - t e rminal a n d s s h sessions. Fo r exa m p l e, J a p a n ese, Ko rea n , a n d C h i nese
c h a racters m a y not d i s p l a y a s expected o n a loca l text conso l e. Fo r this reason it may
m a ke s e n se to u s e E n g l i s h o r a no t h e r l a n g u a g e w i t h a Latin c h a racter set for the
syst e m ' s text c o n s o l e.
L i kewise, l o c a l text consoles a re m o re l i m ited i n t h e i n pu t m e t h o d s t h ey s u p port, a n d
t h i s i s m a n a g e d s e p a rate l y from t h e g ra p h i c a l d e s ktop e n v i ro n m e n t . The avai l a b l e
g l o b a l i n pu t sett i n g s c a n b e config u re d t h ro u g h locale c t l f o r b o t h loca l text vi rtua l
c o n s o l e s a n d t h e X11 g ra p h i c a l e n v i ro n m e n t . See t h e locale c t l(l ) , kbd(4), a n d
vconsole . conf(5) m a n p a g e s f o r m o re i nformat i o n .

La n g u a g e pa c ks
W h e n u s i n g n o n - E n g l i s h l a n g u a g es, you m a y want to i n sta l l a d d it i o n a l " l a n g u a g e packs" to
p rov i d e a d d i t i o n a l t ra n s l at i o n s , d i c t i o n a ries, a n d so forth. To v i ew t h e l i st of ava i l a b l e l a n g pa c ks,
run yum langavailable. To view the l i st of l a n g pa c ks c u rre n t l y i n sta l l e d on the system,
r u n yum langli s t . To a d d an a d d i t i o n a l l a n g pa c k to t h e system, run yum langinst all
code, w h e re code is t h e cod e in s q u a re b ra c kets after t h e l a n g u a g e n a m e in t h e o u t p u t of yum
lan gavailable.

I�
:

R


;

Refe re n ces
locale(7), locale c t l(l), kbd(4), locale . conf(5), vconsole . conf(5),
u n icode(7 ), u t f - 8(7), a n d yum - langpac k s(8) m a n p a g es
Convers i o n s between t h e n a m e s of t h e g ra p h ica l desktop e n v i ro n m e nt ' s
X11 l ayouts a n d t h e i r n a m e s i n localec t l c a n b e fo u n d i n t h e f i l e
/ u s r / share/Xll/xkb/ r u le s / b as e . l s t .

-

-

-

-

-

-

RH254- R H E L 7-en-1-201 40711

xvii


-

Introduction


-

L a n g u a g e Codes Refe re n ce

-

Language Codes

Language

$LANG value

En g l i s h ( U S)

en_U S.utf8

Assamese

as_I N .utf8

Ben g a l i

bn_I N . u tf8

C h inese ( S i m p l ified)

zh_C N .utfB

C h inese (Tra d i t i ona l )


z h_TW.utfB

Fren ch

f r_FR.utfB

German

de_D E.utfB

Gujarati

g u_I N .utfB

H in d i

h i_I N .utf8

I t a l ian

it_IT.utf8

J a panese

j a_J P.utfB

Kann ada

kn_I N .utf8


Korean

ko_K R.utf8

M a l a ya l a m

m l_I N . utfB

M a ra t h i

m r_I N . u tf8

Odia

o r_I N .utf8

Port u g u ese ( Braz i l ian)

pt_BR.utf8

Punj a b i

pa_ I N .utf8

R u ssian

ru_R U.utf8

Spanish


es_ES.utfB

Ta m i l

ta_I N . u tfB

Te l u g u

te_ I N . utfB

-

-

-

-

-

-

-

-

-

-


-

-

-

-

-

xviii

R H 254- R H E L 7 -en-1 -20140711

-

-


red h at

®

®

TRAINING

C H A PT E R 1


CONTROLLING SERVICES AND
DAEMONS

Overview
Goal

To review how to m a n a g e services and the boot - u p p rocess
using syst emc t l.

Objectives



M a n a g e h ow syst emd starts up syst em d a e m o n s a n d
network services, u s i n g syst emc t l.



Control a n d troubleshoot system b o ot u s i n g s y s t emd
t a rgets.

Sections

Lab

RH254- R H E L7-en-1-20140711



Contro l l i n g S e rvices w i t h sys t emc t l ( a n d Practi ce)




Contro l l i n g the B oot P rocess (and P ract i ce)



Contro l l i n g Services a n d D a e m o n s


-

-

C h a pter 1 . C o n t ro l l i n g Se rvices a n d D a e m o n s

Cont ro l l i n g S e rv i ces w i t h syst e m ct l

-

-

O bject ives

-

After co m p l et i n g t h i s sect i o n , stu d e nts s h o u l d b e a b l e to:


List syst e m d a e m o n s and n etwo rk se rvi ces started by the syst emd service and socket u n its.




Contro l syste m d a e m o n s a n d netwo r k services u s i n g sys t emc t l.

I nt ro d u c t i o n to systemd

-

System sta r t u p a n d s e rver p rocesses a re m a n a g e d by t h e systemd System and Service Manager.
T h i s pro g ra m p rovides a method for activati n g system resou rces, server d a e m ons, a n d other
p rocesses, bot h a t b oot time a n d o n a r u n n i n g syst e m .

Daemons a re p rocesses t h a t w a i t o r r u n i n t h e b a c kg ro u n d p e rfo r m i n g va r i o u s t a s k s . To l i sten fo r
con nect i o n s, a d a e m o n uses a socket. Soc kets m a y be created by d a e m o n s o r may be separated
from t h e d a e m o n and be c reated by a n ot h e r p rocess, s u c h as systemd, w h i c h then passes the
soc ket to the d a e m o n when a c o n n e c t i o n i s esta b l i s h e d by a c l i e nt.
A service ofte n refers to one or more d a e m o n s , but start i n g o r sto p p i n g a se rvice may
i n stead m a ke a one-t i m e c h a n ge to the state of the system (for exa m p l e, to confi g u re network
i nte rfaces), w h i c h does n ot i nvo l ve l e a v i n g a d a e m o n p rocess r u n n i n g afte rwa rd.
A bit of h i story

Fo r many yea rs, p rocess ID 1 of L i n u x and U N I X systems has been t h e init p rocess. This process
was res p o n s i b l e for a ct i vat i n g ot h e r servi ces o n the system. Freq u e n t l y used d a e m o n s were
started o n systems at boot t i m e with System V a n d L i n u x Sta n d a rd Base (LSB) init scri pts.
Less freq u e n t l y u sed d a e m o n s were started o n d e m a n d by a n ot h e r service, s u c h a s initd or
xine t d . These systems have seve ra l l i m itations, w h i c h a re a d d ressed with syste m d .
I n R e d H at E nterprise L i n u x 7, process I D 1 is sys t emd, t h e new i n it syst e m . A few of t h e new
featu res p rovi d e d by syste m d i n c l u d e :



Pa ra l l e l iz a t i o n capa b i l iti es, w h i c h i n c rease t h e b o o t s p e e d of a system.



O n -d e m a n d sta rt i n g of d a e m o n s w i t h o u t req u i r i n g a sepa rate service.





-

Automatic se rvice d e p e n d ency m a n a g e m e n t p revents long t i m eouts, s u c h a s not sta rti n g a
n etwo r k service w h e n t h e netwo r k is not ava i l a b l e.
A met h o d of t ra c k i n g re l ated p rocesses toget h e r u s i n g L i n u x control g ro u ps.

-

-

-

-

-

-

-


-

-

-

-

N ote
W i t h syste m d , s h e l l-ba sed service scripts a re used o n l y for a few l e g a cy services.
Therefore, confi g u ra t i o n files with s h e l l va ria b l es, such a s t hose fou n d i n
/ e t c / sysconfig, a re b e i n g re p l a ced. Those sti l l i n use a re i n c l u d e d a s syst e m d
e nv iro n m e nt f i l es a n d r e a d a s N A M E=VA L U E p a i rs. T h e y a re no l o n g e r s o u rced a s a
s h e l l s c r i pt.

-

-

-

2

R H 254-R H E L 7-en-1 -20140711

-

-



-

-

-

-

I nt rod u c t i o n to sys t emd

syst emc t l and syst emd u n its
T h e sys t emc t l c o m m a n d is used to m a n a g e d i ffere n t types of syste m d o bj e cts, ca l l ed units. A
l i st of a va i l a b l e u n it types ca n be d i s p l ayed w i t h systemc t l - t help.

I m p o rta nt

-

T h e systemc t l m a y a b b reviate o r " e l l i psize" u n it n a m es, p rocess t ree e n t ries, and
u n it d e s c r i p t i o n s u n l ess run w i t h t h e - 1 o p t i on.

-

-

-

S o m e c o m m o n u n i t types a re l i sted as fo l l ows:





-

-



-

Service units h a ve a .service exte n s i o n and re p rese n t system services. T h is type of u n it is u s e d
to s t a r t freq u e n t l y a ccessed d a e m ons, s u c h a s a web server.
Socket units h ave a .socket exte n s i o n a n d re p resent i nt e r p rocess c o m m u n i c a t i o n ( I PC ) sockets.
Control of the soc ket w i l l b e passed to a d a e m o n o r newly started service when a c l i e nt
c o n n e c t i o n is m a d e. Socket u n its a re u s e d to d e l a y t h e start of a service at boot t i m e a n d to
start l ess freq u e n t l y u sed services on d e m a n d . These a re s i m i l a r in p r i n c i p l e to servi ces w h i c h
use t h e xine t d s u p e rse rve r to sta rt o n d e m a n d .
Path units h a v e a . p a t h exte n s i o n a n d a re used to d e l a y t h e activat i o n of a service u nt i l
a s p e c i f i c f i l e syst e m c h a n g e occ u rs. T h i s i s c o m m o n l y u s e d f o r services w h i c h u s e spool
d i rectories, such a s a printing syste m .

Service states
-

-

-

-


-

The sta t u s of a service can be vi ewed with sys t emc t l s t a t u s name . type. If the u n i t type is
not p rovi d e d , sys temctl wi l l s h ow t h e sta t u s of a service u n it, if one exi sts.

r-·
! [ ro o t @ s e r v e r x
'

- ] # systemc t l s t a t u s sshd . s e rvice
s s h d . s e rvice - OpenSSH s e r v e r d aemon
Loaded : loaded ( / u s r/lib/sys t e m d / s y s t e m/ s s h d . se rvic e ; enabled )
Act ive : ac t ive ( r u n n i n g ) s i n c e T h u 2 0 14 - 02 - 2 7 11 : 51 : 39 EST ; 7 h ago
Main P I O : 1073 ( s s h d )
CG r o u p : / s y s t e m . slice/ s s h d . s e r vice
L.._ 10 73 / u s r / s b i n / s s h d -D

F e b 27 11 : 51 : 39 s e rve r 0 . example . com s y s t em d [ 1 ] : S t a r t ed OpenSSH s e r v e r d aemon .
F e b 27 11 : 5 1 : 39 s e r ve r 0 . example . com s s h d [ 10 7 3 ] : Could n o t load h o s t key : / e t . . . y
F e b 27 11 : 51 : 39 s e r ve r 0 . example . com s s h d [ 10 73 ] : Serve r lis t e n i n g o n 0 . 0 . 0 . 0 . . . .
F e b 27 11 : 51 : 39 s e r ve r 0 . example . com s s h d [ 10 7 3 ] : Serve r l i s t e n i n g on : : p o r t 22 .
F e b 27 11 : 53 : 21 s e r ve r 0 . example . com s s h d [ 12 70 ] : e r r o r : Could n o t load h o s t k . . . y
F e b 27 11 : 53 : 22 s e r ve r 0 . example . c om s s h d [ 12 70 ] : Ac c e p t e d pas swo r d f o r r o o t f . . . 2
H i n t : Some l i n e s we r e ellip s i z e d , u s e -1 t o s h ow in full .

Seve ra l keywords i n d i c a t i n g t h e state of t h e service c a n be fo u n d i n t h e status o u t p ut:
-

-


-

Keyword:

Descri p t i o n :

loaded

U n it confi g u ra t i o n f i l e h a s been p rocessed.

active ( r u n n i n g )

R u n n i n g w i t h o n e o r m o re cont i n u i n g p rocesses.

a c t i ve (ex ited)

S u ccessfu l l y c o m p l eted a o n e-t i m e config u ra t i o n .

a c t i v e (wa i t i n g )

R u n n i n g b u t wa i t i n g fo r a n eve nt.

i n a ctive

N ot r u n n i n g .

-

-


-

R H254- R H E L 7 - en -1-20140711

3


-

-

C h a pter l . Contro l l i n g S e rv i ces a n d D a e m o n s
-

Keyword:

Desc r i pt i o n :

enabled

W i l l be started at boot t i m e.

disabled

W i l l not be sta rted a t b o o t ti me.

sta t i c

C a n not be e n a b l e d , b u t m a y be started by a n e n a b l e d u n it

a utomatica l l y.

-

-

N ote
T h e sys t emc t l s t a t u s NAME c o m m a n d rep l a ces t h e se rvice
com m a n d u s e d i n prev i o u s vers i o n s o f R e d H a t Enterprise L i n u x .

NAME s t a t u s

-

L i st i n g u n it fi l es w i t h systemctl



-

Q u e ry t h e state of a l l u n its to verify a system sta rtup.

r
:

-

[ r oo t@se r v e r x - ] # sys temctl

L_






-

Q u ery t h e state of o n l y t h e service u n its.

f

� � � - type :: ervice

[ r o o t @ s e r v e r x - ]# sys t e ct

--

-�- --�------------

I nvest i g ate a n y u n its w h i c h a re i n a fa i l ed or m a i nt e n a n ce state. Option a l l y, add t h e
to show t h e f u l l output.

!;


-- �---'

-1

option


[ ro o t @ s e r v e r X - ] # systemctl s t a t u s rngd . se rvice -1

T h e s t a t u s a rg u m e n t m a y a l so be used to determ i n e if a pa rti c u l a r u n it is active a n d s h ow if
t h e u n it i s e n a b led to start at boot ti me. A l te r n ate com m a n d s c a n a l so easily show t h e a ctive
and e n a b l ed states:

I

-

-

l� ot@s ;� v e r X - ]� systemct� �� - act �ve sshd


-

--

-

-

[ root@se r v e r x - ] # systemctl is - enabled sshd

L ist the active state of a l l l o a d e d u n its. Optio n a l l y, l i m it the type of u n it. The
a d d i n active u n its.

- - all


option w i l l

-

-

[ r oot@se r v e r X - ] # systemctl lis t - units - - type=service
[ r oot@se r v e r x - ] # sys temctl list - units - - type=service - - all




View t h e e n a b l ed a n d d i sa b l ed sett i n g s for a l l u n its. Optio n a l l y, l i m it t h e type of u n it.

j

_,

- -- - ----- - ---�
-

--

- - ----- -�-

View o n l y fa i l ed services.

l


: :



��

--�
-.----T-��-;�[ root@se r v e r X - ] # syst mct
- f led

4

-

[ r oot@s e r v e r X - ] # systemctl list - u nit - files - - type=se rvice


_

-

�- ty�e=se rvice

--�-��-�
-

- ·-----·

��---- -


-----�

-

-

R H 254- R H E L 7-en-1 -20140711

-

-


-

-

Sta r t i n g a n d sto p p i n g system d a e m o n s o n a r u n n i n g system

Sta rt i n g a n d sto p p i n g syste m d a e m o n s on a r u n n i n g
-

-

syste m
Start i n g , stoppi n g , resta r t i n g , re l o a d i n g , a n d verify i n g sta t u s a re c o m m o n act i o n s performed
when a d m i n iste r i n g services.


-


[ r oot@serverx - ] # systemc t l status sshd . se rvice
s s h d . s e r vice - O p e n SSH s e r v e r daemon
Loaded : loaded ( / u s r /l i b / s y s t emd / s y s t em /s s h d . s e rvice ; enabled )
Ac t ive : a c t ive ( r u n n i n g ) s i n c e T h u 2014 - 02 - 2 7 11 : 51 : 39 EST ; 7h ago
Main P I O : 1073 ( s s h d )
CG r o u p : / s y s t e m . s lice/s s h d . s e r vice
L.__ 10 73 / u s r / s b i n / s s h d - D

-

-

-







-

-

-

-

RSS TTY

3612 ?

STAT START
Ss
15 : 15

T I M E COMMAND
0 : 00 /u s r / s b i n / s s h d - D

Stop t h e service a n d verify t h e status.
[ r o o t @ s e r v e r x - ] # systemctl s t o p sshd . service
[ r oo t @ s e r v e r x - ] # sys t emctl status sshd . se rvice
s s h d . s e r vice - O p e nSSH s e rve r daemon
Loaded : loaded ( / u s r / l i b / s y s t e m d / s y s t e m/ s s h d . s e rvice ; enabled )
Ac t ive : i n a c t ive ( d ead ) s i n c e T h u 2014 - 02 - 2 7 18 : 51 : 39 EST ; 2s ago
Main P I O : 1073 ( c o d e = e x i t e d , s t a t u s = 0/SUCCESS )

-

-

Verify t h a t t h e process i s r u n n i n g .
[ r oot@se rve r X - ] # ps - up 1673
USER
P I O %CPU %M E M
VSZ
root
10 73 0 . 1 0 . 0 8 2 9 9 2

-


-

View t h e stat u s of the sshd se rvi ce.

Start t h e service a n d v i ew t h e stat u s. The p rocess I D h a s c h a n g e d .
[ r o o t @ s e r v e r X - ] # systemctl s t a r t sshd . se rvice
[ r oot@serverX - ] # systemctl s t a t u s sshd . s e rvice
s s h d . s e rvice - O p e nSSH s e r v e r daemon
Loaded : loaded ( / u s r / l i b / s y s t em d / s y s t em/ s s h d . s e rvic e ; enable d )
Ac t ive : ac t ive ( r u n n in g ) s i n c e T h u 2014 - 02 - 2 7 18 : 52 : 3 9 EST ; 2s ago
Main P I O : 1253 ( s s h d )
CG r o u p : / s y s t e m . slice/ s s h d . s e rvice
L.__ 1253 / u s r / s bi n / s s h d - D



Stop, t h e n sta rt. t h e service i n a s i n g l e co m m a n d .
[ r oot@serverX - ] # systemctl restart sshd . se rvice
[ r oo t @ s e r v e r x - ] # systemctl s t at u s sshd . se rvice
s s h d . s e rvice - O p e nSSH s e r v e r d aemon
Loaded : loaded ( / u s r /l i b / s y s t em d / s y s t em/ s s h d . se rvice ; enabled )
Ac t ive : ac t ive ( r u n n i n g ) s i n c e T h u 2 0 14 - 02 - 2 7 18 : 54 : 39 EST ; 2s ago
Main P I O : 1268 ( s s h d )
CG r o u p : / s y s t e m . slice/ s s h d . se rvice
L.__ 1268 / u s r / s b i n / s s h d - D

-

-


R H 254- R H E L 7-en-1 -201 40711

5


-

-

C h a pter 1 . C o n t ro l l i n g S e rvices a n d D a e m o n s



I ss u e i nst r u c t i o n s for a service to r e a d a n d re l o a d its confi g u ra t i o n fi l e w i t h o ut a co m p l ete sto p
a n d start. T h e p rocess I D w i l l n o t c h a nge.
[ ro o t @ s e r v e r x - ] # systemctl reload sshd . se rvice
[ root@s e r v e r x - ] # systemctl s t a t u s sshd . se rvice
s s h d . s e rvice - OpenSSH s e r v e r daemon
Loaded : loaded ( / u s r/lib/sys t em d / s y s t e m/ s s h d . se rvice ; enabled }
Ac t ive : act ive ( r u n n ing ) s i n c e T h u 2014 - 02 - 2 7 18 : 55 : 09 EST ; 3 2 s ago
Main P I O : 1268 ( s s h d )
C G r o u p : / s y s t em . slice/ s s h d . se rvice
L._ 1268 / u s r / s b i n/ s s h d - D

U n i t d e p e n d e n c i es

Se rvi ces m a y be sta rted as d e p e n d e n cies of ot h e r se rvices. I f a socket u n i t i s e na b l ed a n d t h e
service u n it w i t h t h e s a m e n a m e i s not, t h e s e r v i c e w i l l automatica l ly be s t a r t e d w h e n a req uest
i s made on the n etwo r k soc ket. S e rvices may a l so be t r i g g e re d by path u n its w h e n a f i l e syste m

condition i s met.
The sys t emc t l list - dependencies UNIT co m m a n d c a n be u sed to d i s p l ay a t ree of other
u n its which m u st be started i n conj u n c t i o n w i t h a specific u n it. T h e - - r eve r s e o p t i o n to this
command w i l l s h ow w h a t u n i t s need to have t h e specified unit started i n order to r u n .

-

-

-

-

-

-

-

-

M a s k i n g services

A syste m m a y h a ve c o n f l i c t i n g services i n sta l l e d for a cert a i n f u n c t i o n , such a s fi rewa l l s ( i pta b l es
a n d firewa l l d ) . To prevent a n a d m i n istrator f ro m a c c i d e nta l l y start i n g a se rvice, a service may be
masked. M a s k i n g c reates a l i n k i n t h e config u ra t i o n d i recto ries so t h a t if the service is started,
nothing w i l l h a p p e n .

�1
L.


[ r oot@s e r v e r x - ] # systemctl mask netwo r k
ln - s ' /dev/n ull ' ' /e t c / s y s t emd / s y s t em/ n e t wo r k . s e rvice '
[ r oot@s e r v e r x - ] # systemctl unmask netwo r k
rm ' /e t c / s y s t em d / s y s t em/netwo r k . s e rvice '

-

I m po rta nt

E n a b l i n g syste m d a e m o n s to sta rt o r sto p a t boot
Services a re sta rted at boot t i m e w h e n l i n ks a re c reated i n t h e a p p ropriate syst emd
config u ra ti o n d i rectories. These l i n ks a re created a n d removed with sys temc t l c o m m a nds.

-

-

-

View t h e sta t u s of a service.
-

[ root@s e r v e r x - ] # systemctl s t a t u s sshd . se rvice



-

-


A d i s a b l e d service w i l l n ot be started a utomatica l l y at boot o r by other unit f i l es,
b u t can b e started m a n u a l l y. A m a s ked service ca n n ot b e started m a n u a l l y or
a u t o m a t i ca l l y.



-

D i sa b l e the service a n d verify the sta t u s. N ote t h a t disa b l i n g a service does not stop t h e
se rvice.

-

-

6

R H 254- R H E L 7 - e n -1 -20140711

-

-


-

S u m m a ry of sys t em c t l com m a n d s

-


�-�--

t

-

E n a b l e t h e service a n d verify t h e status.

-

I

;

-

I

Services c a n b e sta rted a n d sto p p e d o n a r u n n i n g syst e m a n d e n a b l ed o r d i s a b l e d for a ut o m a t i c
s t a r t a t boot t i m e.

-

-

-

-


-

-

-

Co mma n d :

Ta s k :

sys t em c t l s t a t u s UNIT

V iew deta i l e d i n fo r m a t i o n a b o u t a u n it state.

sys t em c t l s t o p UNIT

Stop a service o n a r u n n i ng syste m .

sys t emc t l r e s t a r t UNIT

Restart a service o n a r u n n i n g syste m .

sys t emc t l mas k UNIT

Co m p l et e l y d i s a b l e a service from b e i n g
sta rte d , both m a n u a l l y a n d at boot.

sys t emc t l u nmas k UNIT

M a ke a m a s ked service ava i l a b le.


sys t emc t l s t a r t UNIT

Start a service o n a r u n n i n g syste m .

sys t emc t l reload UNIT

Reload confi g u rat i o n f i l e of a r u n n i n g service.

sys t emc t l enable UNIT

Config u re a service to start at boot t i m e.

sys t emc t l list - dependencies UNIT

L i st u n its w h i c h a re req u i re d a n d wa nted by
t h e s p e c i f i e d u n it.

sys t emc t l disable UNIT

-

...

[ r o o t @ s e r v e r X - ] # systemc t l enable sshd . service
[ ro o t @ s e r v e r X - ] # systemct l is - enabled sshd . se rvice

S u m m a ry of systemctl co m m a n d s

-


-

·---�---·

[ r oo t @ s e r v e r x - ] # systemc t l disable sshd . se rvice
[ ro o t @ s e r v e r X - ] # systemct l s t a t u s sshd . se rvice

R

D i sa b l e a service from start i n g at boot t i me.

Refe re n ces
sys t emd(2), syst emd . u n i t (5), syst emd . se rvice(5), syst emd . soc k e t (5), a n d
syst emct l(1 ) m a n pages
A d d i t i o n a l i n fo r m a t i o n m a y b e a va i l a b l e i n t h e c h a pter o n m a n a g i n g services with
syst emd i n the Red Hat Enterprise Linux System Administrator's Guide for Red H at
E n t e r p rise L i n u x 7, w h i c h c a n be fo u n d a t
http://d ocs.re d hat.com/

-

-

-

-

-..


-

R H 254- R H E L 7-en-1 -20140711

7


-

C h a pter 1 . C o n t ro l l i n g S e rvices a n d Dae m o n s

P ra ct i ce : U s i n g syste m ct l to M a n a g e S e rv i ces

-

-

G u i d e d exe rc i s e

-

I n t h i s l a b, you w i l l m a n a g e a service u n it that i s a l ready i n sta l l e d o n t h e system.

r'*'*�
Machlnes�

-

.....


O utcomes:

T h e ch r onyd service is d i s a b l e d and n o l o n g e r r u n n i n g o n the system.

-

Before y o u begin. ..
-

Reset y o u r serverX syste m .
D 1.

Observe t h e res u l ts o f t h e systemc t l r e s t a r t a n d syst emc t l reload co m m a nd s .
D 1 .1 .

D i s p l a y t h e stat u s o f t h e sshd service. N ote t h e p rocess I D o f t h e d a e m o n .
- --·------ -----

[ s t u d e n t @ s e r v e r X - ] $ sudo systemct l s t a t u s sshd
s h d . se rvice - Ope nSSH s e r v e r daemon
Loaded : loaded ( / u s r/lib/sy s t emd / sy s t e m/ s s h d . se rvice ; enabled )
Ac t ive : ac t ive ( r u n n i n g ) since Tue 2014 - 0 6 - 10 09 : 09 : 50 EDT ; 35min ago
P r o c e s s : 1061 ExecS t a r t P r e=/ u s r / s b i n / s s h d - keygen ( c ode=exit ed , s t a t u s=0/
SUCCESS )
Main P I D : 1077 ( s s h d )
CG r o u p : / s y s t em . s lice/ s s h d . se rvice
L.. 1077 / u s r / s b i n / s s h d - D

D 1 .2.


Rest a rt t h e sshd service a n d view t h e sta t u s. T h e process ID of t h e d a e m o n h a s
changed.
[ s t u d e n t@ s e r v e r X - ] $ s u d o systemc t l r e s t a r t sshd
[ s t u d e n t@s e r v e r X - ] $ sudo systemc t l s t a t u s sshd
s s h d . se rvice - OpenSSH server daemon
Loaded : loaded ( / u s r/lib/sy s t emd / s y s t em / s s h d . se rvice ; enable d )
Ac t ive : a c t ive ( r u n n i n g ) s i n c e Tue 2014 - 0 6 - 10 09 : 48 : 00 EDT ; ls ago
P r o c e s s : 2851 Execs t a r t P r e = / u s r/ s b i n / s s h d - keygen ( c ode=exi t e d , s t a t u s=0/
SUCCESS )
Main P I D : 2852 ( s s h d )
CG r ou p : / s y s t e m . s lice / s s h d . s e r vice
L.. 2052 / u s r / s b i n / s s h d - D

D 1.3.

Reload t h e sshd service a n d view t h e sta t u s. T h e p rocess ID of t h e d a e m o n h a s
n ot c h a n g e d a n d co n n ections h a v e n ot been i nterrupted.

-

-

-

-

-

-


-

-

-

-

-

-

8

R H 254-R H E L 7 - e n -1 -20140711

-


-

G u i d e d exercise
-

[ s t u d e n t@se r v e r x - ] $ sudo systemc t l reload sshd
[ s t u d e n t@ s e r v e r X - ] $ sudo systemctl s t a t u s sshd
s s h d. s e r vice - OpenSSH s e r v e r daemon
L o a d e d : loaded ( / u s r/lib/sys temd/ s y s t em/ s s hd. s e rvice ; enabled )
Ac t ive : a c t ive ( r u n n i n g ) s i n c e Tue 2 0 14 - 06 - 10 0 9 : 48 : 00 EDT ; 1 2 s ago
P r o c e s s : 2860 ExecReload = / b in / k ill - HU P $MAI N P I D ( code=exi t e d , s t a t u s=0/

SUCCESS )
P r o c es s : 2851 ExecS t a r t P r e=/ u s r / s b i n / s s h d - keygen ( code=ex i t e d , s t a t u s =0/
SUCCESS )
Main P I O : 2 8 5 2 ( s s h d )
C G r o up : / s y s t e m . slice/ s s h d. s e r vice
L,_ 2 8 5 2 / u s r / s bi n / s s h d - D

-

-

-

-

-

D 2.

Verify that t h e c h r onyd service i s r u n n i n g .
[ s t u d e n t @ s e r v e r X - ] $ sudo systemctl status c h r o nyd
c h r o nyd . s e rvice - NTP c l ie n t / s e r v e r
Loaded : loaded ( / u s r / l i b / s y s t e m d / s y s t em/c h r o nyd . se rvice ; e n able d )
Ac t ive : a c t ive ( r u n n in g ) since Tue 2 0 14 - 06 - 10 0 9 : 09 : 44 EDT ; 43min ago
P r o c es s : 4 9 0 ExecS t a r t Po s t = / u s r /libexec/c h r o n y - h e l p e r add - d hclie n t - s e r ve r s
( code=exi t e d , s t a t u s=0/SUCCESS )
P r oce s s : 450 ExecS t a r t = / u s r / s b i n / c h r onyd - u c h r o n y $OPTIONS ( co d e = e x i t e d ,
s t a t u s =0/SUCCESS )
Main P I O : 467 ( c h r onyd )
C G r o up : / s y s t em.slice/c h r onyd. s e rvice

L._ 457 / u s r / s b i n /c h r o nyd -u c h r o n y

-

-

-

-

D 3.

Stop t h e c h r onyd service and view t h e status.
[ s t u de n t @ s e r v e r X - ] $ sudo syst emc t l stop c h ronyd
[ s t u d e n t @ s e r v e r X - ] $ sudo systemctl s t a t u s c h ronyd
c h r onyd. s e rvice - NTP c l ie n t / s e r v e r
Loaded : l o a d e d ( / u s r / l i b / s y s t e md / s y s t em/c h ro n y d. s e rvice ; e n abled )
Ac t ive : i n a c t ive ( d ead ) since Tue 2 0 14 - 06 - 10 0 9 : 5 3 : 36 EDT ; 4s ago
P r oce s s : 490 Execs t a r t Po s t = / u s r/libexec/c h ro n y - h e l p e r add - d hclien t - s e r v e r s
( code=exi t e d , s t a t u s =0/SUCCESS )
P r oce s s : 450 Execs t a r t = / u s r / s b i n / c h r o nyd - u c h r o n y $OPTIONS ( code=ex i t e d ,
s t a t u s=0/SUCCESS )
Main P I O : 4 6 7 ( co d e = e x i t e d , s t a t u s = 0/SUCCESS )

-

-

-


...

D 4.

Dete r m i n e if t h e ch ronyd s e rvice i s e n a b l ed to start at system boot.

-

-

...

-

[ s t u d e n t @ s e r v e r X - ] $ sudo syst emct l is - enabled ch ronyd
enabled

D 5.

D 6.

I

Reboot the syste m .
[ s t u d e n t @ s e r v e r x - ] $ sudo reboot

Log i n to the se rverX system and view the stat u s of the c h ronyd se rvice.

-


-

-

R H254- R H EL 7-en-1 -20140711

9


-

C h a pter l . C o n t ro l l i n g S e rvi ces a n d D a e m o n s

[ s t u d e n t@s e rve r X - ] $ sudo syst emct l s t a t u s ch ronyd
c h r o nyd.se rvice - NTP c l ie n t / se r v e r
Loaded : l o a d e d ( / u s r /l i b / s y s t e md / s y s t em/c h r onyd. s e rvice ; enabled )
Ac t ive : a c t ive ( r u nni n g ) s i n c e T u e 2 0 14 - 06 - 10 09 : 5 5 : 22 EDT ; 9min ago
P r oc e s s : 487 Execs t a r t P o s t = / u s r/libexec / c h r o n y - h e lp e r add - d h clie n t - s e r v e r s
( c od e = e x i t e d , s t a tus=0/SUCCESS )
P r oc e s s : 451 Execst a r t = / u s r / s b i n / c h r o n y d - u c h r o n y $OPT I O N S ( c ode=exit e d ,
s t a t u s =0/SUCCESS )
Main P I O : 474 ( c h r onyd )
C G r o up : / s y s tem . slice/c h ro n y d.se rvice
1._ 474 / u s r / s bi n / c h ronyd -u c h rony

D 7.

D i sa b l e t h e c h ronyd service so t h a t it does n ot start at system boot, t h e n v i ew t h e
stat u s of t h e servi ce.
[ s t u d e n t@ s e r v e r x - ] $ sudo systemc t l disable chronyd

[ s t ud e n t@ s e r v e r X - ] $ sudo systemc t l s t at u s ch ronyd
c h r o n y d . s e rvice - NTP clie n t / se r v e r
Loaded : loaded ( / u s r /lib/ s y s t e md / s y s t em / c h ronyd . se r vice ; d isabled )
Ac t ive : a c t ive ( r u n n i n g ) s i n c e T u e 2 0 14 - 06 - 10 09 : 55 : 22 EDT ; 9min ago
Main P I O : 474 ( c h r onyd )
C G r o up : / s y s t em. slice/c h r onyd. s e rvice
1._ 474 / u s r / s b i n / c h ronyd -u c h r o n y

D 8.

D 9.

-

-

-

-

-

-

-

-

Re boot t h e syste m.


I

-

-

[ s t u d e n t@se rve rx - ] $ sudo reboot

Log in to t h e serverX system a g a i n a n d view t h e stat u s of t h e c h ronyd service.
[ s t u d e n t@ s e r v e r x - ] $ sudo sys t emct l s t a t u s ch ronyd
c h r o n y d. s e rvice - NTP clien t / s e r v e r
Loaded : loaded ( / u s r/lib/sys t emd / s y s t em/c h r onyd. s e rvice ; d isabled )
Ac t ive : i n ac t ive ( dead )

-

-

-

-

-

-

-

-


10

R H254- R H E L 7-en-1 -20140711

-

-


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×