- To start a service, we need to use systemctl start command followed by the service name.
sudo systemctl start apache2
- To stop a service, we need to use systemctl stop command followed by the service name.
sudo systemctl stop apache2
- To restart a service, we need to use systemctl restart command.
- This is useful for applying configuration changes without rebooting the system.
sudo systemctl restart apache2
- To enable a service to start automatically at boot, we need to use systemctl enable command.
sudo systemctl enable apache2
- To disable a service from starting automatically at boot, we need to use systemctl disable command.
sudo systemctl disable apache2
- To check the status of the service, we need to use systemctl status command.
- This provides information about the service's current state and any error messages.
sudo systemctl status apache2