Start, Stop, and Check the Status of Network Services

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you will learn how to start, stop, and check the status of network services on a Linux system. This is an essential skill for system administrators who need to manage and maintain network services running on their servers.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) linux/BasicSystemCommandsGroup -.-> linux/echo("`Text Display`") subgraph Lab Skills linux/echo -.-> lab-389487{{"`Start, Stop, and Check the Status of Network Services`"}} end

Manage Network Services

Tasks

  • Start the httpd (Apache HTTP Server) service
  • Stop the httpd service
  • Check the status of the httpd service

Requirements

  • All operations should be performed as the labex user
  • The default working directory is ~/project
  • Use the appropriate systemd commands to manage the httpd service

Example

After starting the httpd service, you should see the following output when checking the service status:

$ systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-04-17 12:34:56 UTC; 1min 23s ago
 Main PID: 12345 (httpd)
   Status: "Running, listening on: port 80"
   CGroup: /system.slice/httpd.service
           ├─12345 /usr/sbin/httpd -DFOREGROUND
           ├─12346 /usr/sbin/httpd -DFOREGROUND
           └─12347 /usr/sbin/httpd -DFOREGROUND

Summary

In this challenge, you learned how to start, stop, and check the status of the httpd (Apache HTTP Server) service using systemd commands. This is an essential skill for system administrators who need to manage and maintain network services running on their Linux servers. You practiced using the systemctl command to control the httpd service, and you also learned how to write verification scripts to ensure that the service is in the expected state.

Other Linux Tutorials you may like