How to start and enable a unit with systemctl
After the installation of a software package or when configuring a custom unit, it may be needed to start the unit. In most cases, we also want our unit to start during boot time. There are a few ways to achieve this, let’s have a look.
Manual start and enable
First we start the unit using the start command.
systemctl start UNIT
After that, we enable the unit.
systemctl enable UNIT
If everything went well, the unit is now started and will also start during the next boot.
Combine the options
There is a quicker way to achieve the steps above. This is to enable the service and start it right away using the --now option.
systemctl enable --now UNIT
Same result, but in one command!
Check the status
After starting the service, have a look at the status of the unit to see if everything is expected.
systemctl status UNIT
Especially the line in the output with Loaded and Active will reveal if the unit is running and enabled.