NETWORKSTIP Networking CCNA,Centos,Ubuntu,Sql,

Made By Muhammad Nafees

Breaking

Monday 17 October 2016

Enabling Apache service on boot in CentOS 7

Enabling Apache service on boot in CentOS 7

Check if the service starts on boot

$ systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
...
The last word, either enabled or disabled, will tell you if the service starts on boot. In the case above, the Apache2 webserver "httpd", it's Enabled.

Disabling a service on boot in CentOS 7

To disable, it's simply a matter of running systemctl disable on the desired service.
$ systemctl disable httpd
rm '/etc/systemd/system/multi-user.target.wants/httpd.service'

$ systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
...
Running systemctl disable removes the symlink to the service in /etc/systemd/system/*. From now on, that service won't start on boot anymore.

Enabling a service on boot in CentOS 7

Very similar to disabling a service, you run systemctl enable on the target service.
$ systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'

$ systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
...
The same symlink that was removed in the disable command above is recreated if you enable a service to start on boot.

No comments:

Post a Comment