Bookmark this page

Lab: Control Services and Daemons

In this lab, you configure several services to be enabled or disabled, and started or stopped, based on a specification that is provided to you.

Outcomes

  • Enable, disable, start, and stop services.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start services-review

Instructions

  1. Use the ssh command to log in to the serverb machine as the student user. On the serverb machine, start the psacct service.

    1. Log in to the serverb machine as the student user and switch to the root user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]#
    2. Verify the status of the psacct service. The psacct service is in an inactive and disabled state. The disabled state confirms that the service does not start at boot time.

      [root@serverb ~]# systemctl status psacct
      ○ psacct.service - Kernel process accounting
           Loaded: loaded (/usr/lib/systemd/system/psacct.service; disabled; vendor preset: disabled)
           Active: inactive (dead)
    3. Start the psacct service.

      [root@serverb ~]# systemctl start psacct
    4. Verify that the psacct service is running.

      [root@serverb ~]# systemctl is-active psacct
      active
  2. Configure the psacct service to start at system boot.

    1. Enable the psacct service to start at system boot.

      [root@serverb ~]# systemctl enable psacct
      Created symlink /etc/systemd/system/multi-user.target.wants/psacct.service → /usr/lib/systemd/system/psacct.service.
    2. Verify that the psacct service is enabled to start at system boot.

      [root@serverb ~]# systemctl is-enabled psacct
      enabled
  3. Stop the rsyslog service.

    1. Verify the status of the rsyslog service. Notice that the rsyslog service is running and enabled to start at boot time. Press q to exit the command.

      [root@serverb ~]# systemctl status rsyslog
      ● rsyslog.service - System Logging Service
           Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
           Active: active (running) since Thu 2022-05-19 04:04:43 EDT; 38min ago
        ...output omitted...
    2. Stop the rsyslog service.

      [root@serverb ~]# systemctl stop rsyslog
    3. Verify that the rsyslog service is stopped.

      [root@serverb ~]# systemctl is-active rsyslog
      inactive
  4. Configure the rsyslog service so that it does not start at system boot.

    1. Disable the rsyslog service so that it does not start at system boot.

      [root@serverb ~]# systemctl disable rsyslog
      Removed /etc/systemd/system/multi-user.target.wants/rsyslog.service.
    2. Verify that the rsyslog service does not start during the boot process.

      [root@serverb ~]# systemctl is-enabled rsyslog
      disabled
  5. Reboot the serverb machine before evaluating the lab.

    [root@serverb ~]# systemctl reboot
    Connection to serverb closed by remote host.
    Connection to serverb closed.
    [student@workstation ~]$

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade services-review

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish services-review

This concludes the section.

Revision: rh124-9.0-398f302