×



In the old CentOS distribution, you use the service command or directly run a service on your system using the "/etc/init.d/<service-name> start" command. In modern Linux distributions, you can easily start, stop or restart a service on your CentOS system using the systemctl command. The systemctl command is a very useful tool through which you can examine and control the service manager and systemd system. A collection of system management tools, libraries, and daemons gives us complete information about server-wide and systemd services utilization. If systemctl command successfully runs on your system, it will display any output on the terminal window.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux System tools queries.

In this context, we shall look into how to start, stop and restart services on CentOS 8 system using the systemctl utility.


How to start, stop and restart a service in CentOS Linux System ?

Note that Users need sudo privileges to start, stop and restart a service.


1. Start service on CentOS using systemctl command

To start a service on your system, use the following syntax:

$ sudo systemctl start {service-name}

For example, to start the httpd service on your system run the below-given command:

$ sudo systemctl start httpd


2. Check service status using systemctl command

To check the service running status on your CentOS 8 system, follow the following command syntax:

$ sudo systemctl status {service-name}
$ sudo systemctl status httpd

The above command will show the running or deactivate status on the terminal window. If the specified service is running on your system then, active (running) status should display on the screen.


3. Stop service on CentOS using systemctl command

Sometimes, we need to stop service on your system to start a new service. So, to stop or deactivate the running service on your system, use the following syntax:

$ sudo systemctl stop {service-name}
$ sudo systemctl stop httpd

After executing the above command, the running service will stop on your system. Now, check the status. The service deactivate (dead) status will display on the terminal window.


4. Restart a service using systemctl on CentOS 8

To restart a service on CentOS 8, use the below-mentioned syntax:

$ sudo systemctl restart {service-name}

For example, to restart the stopped httpd service, run the following command:

$ sudo systemctl restart httpd


5. Reload service using systemctl command 

To reload all the configuration files forcefully on your system, type the following command to reload a service:

$ sudo systemctl reload {service-name}

To reload the httpd service on your CentOS system, run the below-given command:

$ sudo systemctl reload httpd


6. Enable and disable service using systemctl command

Systemctl service also helps users to enable and disable a service. To enable the httpd service on your system use the below-given command:

$ sudo system enable httpd

If you want to disable the httpd service due to some port issues. Then, run the below-mentioned command to disable it:

$ sudo systemctl disable httpd


[Need help in configuring Apache or Nginx Web Server on Debian Linux System? We can help you. ]


Conclusion


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com