In CentOS 7 and Red Hat Enterprise Linux (RHEL) 7, you can disable the autostart of a service at boot time. This can be useful when you want to prevent a service from starting automatically during the boot process. In this guide, we will go through the steps to disable the autostart of a service at boot on CentOS 7 / RHEL 7.
Step 1: Open the Terminal
The first step is to open the terminal on your CentOS machine. You can do this by clicking on the terminal icon or by using the keyboard shortcut “Ctrl + Alt + T”.
Step 2: Check the Status of the Service
Before disabling the autostart of a service, you should check the current status of the service. You can do this by using the following command:
systemctl status <service-named>
Replace “<service-named>” with the name of the service you want to disable the autostart for.
For example:
[root@centos7 ~]# sudo systemctl disable named-chroot.service rm '/etc/systemd/system/multi-user.target.wants/named-chroot.service'
Step 3: Disable the Autostart of the Service
To disable the autostart of a service, you need to use the “systemctl” command with the “disable” option. You can do this by using the following command:
sudo systemctl disable <service-named>
Replace “<service-named>” with the name of the service you want to disable the autostart for.
Step 4: Verify the Autostart Status of the Service
To verify that the autostart of the service has been disabled, you can use the following command:
systemctl is-enabled <service-named>
If the output is “disabled”, the autostart of the service has been successfully disabled.
Step 5: Restart the System
After disabling the autostart of the service, it is recommended to restart the system to ensure that the changes take effect. You can do this by using the following command:
sudo reboot
Commands Mentioned:
- sudo – a command that allows users to run programs with the security privileges of another user, typically the superuser.
- systemctl – a command that is used to control the systemd system and service manager.
Conclusion:
In this guide, we have gone through the steps to disable the autostart of a service at boot on CentOS 7 / RHEL 7. By disabling the autostart of a service, you can prevent it from starting automatically during the boot process. If you have any questions or suggestions, feel free to comment below.