0%

0/1 Lessons

Introduction to Linux Server Operating Systems

• 30min

0 / 3 lessons complete

Linux Server Installation and Lab Setup

• 23min

0 / 6 lessons complete

Working with the Linux Command Line Interface

• 1hr 30min

0 / 12 lessons complete

User and Group Management

• 44min

0 / 7 lessons complete

Linux Storage

• 30min

0 / 6 lessons complete

Linux Administration Basics

• 53min

0 / 8 lessons complete

Linux Networking

• 47min

0 / 8 lessons complete

Course Conclusion

• 5min

0 / 1 lessons complete

Managing Services with systemctl

Instructions

Q&A (0)

Notes (0)

Resources (0)

Saving Progress...

Resources

There are no resources for this lesson.

Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.

Create note

In this lesson, you will learn how to manage system services in Linux using systemctl, a command-line utility for controlling the systemd system and service manager. Our focus will be on managing NGINX, a popular web server and reverse proxy service, using systemd.

Objectives

By the end of this lesson, you will understand how to:

  • Start, stop, and restart the NGINX service.
  • Enable and disable NGINX to start on boot.
  • Check the status of NGINX.
  • Reload NGINX configurations.

Starting, Stopping, and Restarting NGINX

Starting NGINX

To start the NGINX service immediately:

sudo systemctl start nginx

Stopping NGINX

To stop the NGINX service:

sudo systemctl stop nginx

Restarting NGINX

To restart the NGINX service (useful for reloading it with the latest configuration):

sudo systemctl restart nginx

Enabling and Disabling NGINX

Enabling NGINX

To enable NGINX to start automatically at boot:

sudo systemctl enable nginx

Disabling NGINX

To prevent NGINX from starting automatically at boot:

sudo systemctl disable nginx

Checking the Status of NGINX

To check the status of NGINX, including whether it is active, enabled, and its recent logs:

sudo systemctl status nginx

Reloading NGINX Configurations

If you've made configuration changes to NGINX and you don't want to restart the service completely, you can reload the configuration:

sudo systemctl reload nginx

Managing All Services

To list all services that systemd knows about, whether active or not:

sudo systemctl list-unit-files --type=service

Best Practices

  • Always check the status of NGINX after starting, stopping, or restarting to ensure it's in the desired state.
  • When enabling or disabling services like NGINX, consider the impact on the system's performance and boot time.
  • Use the reload function judiciously to apply configuration updates to NGINX without disrupting the service.

Conclusion

systemctl is a powerful tool that provides comprehensive control over services in Linux systems using systemd. Understanding how to manage services like NGINX with systemctl is essential for system administrators and users who want to ensure their web services are running efficiently and securely. That is all you need to learn in this lesson! See you in the next one.

Server Academy Members Only

Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments