🚀 Enabling/Disabling Services on Boot
Sticking with our restaurant analogy: Some chefs (services) need to start working automatically when the restaurant opens (system boots), while others only work when needed. Systemd lets you enable or disable services for automatic start.
Enabling a Service
This command makes the service automatically start every time the system boots.
Disabling a Service
This command prevents the service from starting automatically on boot, though you can still start it manually.
Quick Reference Table
| Action | Command | Example | Analogy |
|---|---|---|---|
| Enable | systemctl enable | nginx | Chef starts cooking automatically at opening |
| Disable | systemctl disable | nginx | Chef only works when called manually |
Bonus Tip
If you want to start a service now AND enable it for future boots, you can run:
This command starts the service right now and schedules it to start automatically next time the system boots.
Real-life analogy
For enabling: You tell the chef: "Always start cooking when the restaurant opens!" For disabling: You tell the chef: "Don't start automatically; only come in when I call you." For the bonus tip: The chef starts cooking right now and is scheduled to start automatically next time the restaurant opens. We've now covered how to make services automatic or manual.