How to set up a customized target on CENTOS

How to set up a customized target on CENTOS

You have been handed a server that needs to be customized according to a specific standard. complete the following objectives?

OBJECTIVES

1. carry out a checklist on the default target in order to make sure the custom target you will create works.

2. Your custom target should be identical to your default target. Except that it should want httpd service.

Experience level

Basic


1. verify default target

  • To verify default target: __systemctl get-default
  • To set it to multi user target: _systemctl set-default multiuser.target
  • To isolate the target: __systemctl isolate multiuser.target__


2. CREATE custom.target

a) Change directory: cd/etc/systemd/system


b) create a file by copying multi-user.target into custom.target: /usr/lib/systemd/system/multi-user.target ./custom.target


c) open the file: nano custom.target

d) Edit the [unit] section:

?????[Unit]

?????Description=Custom Target

?????Documentation=man:systemd.special(7)

?????Requires=basic.target

?????Wants=httpd.service

?????Conflicts=rescue.service rescue.target

?????After=basic.target rescue.service rescue.target

?????AllowIsolate=yes

e) use the __ctrl X__ option to save and quit

??check if httpd is already installed in the server: rpm -q httpd

??if not installed, do yum install httpd -y

f) isolate custom.target

g) check status of httpd: systemctl status httpd

If we try to isolate into multi-user.target, we will see that httpd is dead because it is not set up to want Apache service.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了