> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Start systemd Services on Boot
- URL: https://linuxhandbook.com/systemd-start-service-boot/
- Published: 2023-12-06T04:01:59.000Z
- Updated: 2024-03-13T13:39:04.000Z
- Description: Learn to automatically start systemd services at boot time in this quick Linux tip.
- Author: Sagar Sharma
- Tags: Quick Tip

Most Linux distros use systemd as an init service which is responsible for [starting, managing, and stopping services](https://itsfoss.com/start-stop-restart-services-linux/?ref=linuxhandbook.com).

There are multiple reasons one would want to start the service on boot.

The major reason is you are using Linux as a web server and you want to start certain services automatically when the system boots up.

To start a systemd service on boot, all you have to do is the `enable` flag with the [systemctl command](https://linuxhandbook.com/systemctl-commands/) in the following manner:

```
sudo systemctl enable <service-name>
```

Want more details? I got you!

## How to start a systemd service on boot 

To use the [systemd init service](https://itsfoss.com/systemd-init/?ref=linuxhandbook.com), you have to [utilize the systemctl command](https://linuxhandbook.com/systemctl-commands/) which offers different flags for different purposes.

Let's say you [create a new systemd service](https://linuxhandbook.com/create-systemd-services/). You can start it immediately using the `start` flag. But the problem (or should I call the nature of this flag) is the effect will only remain until the next boot.

This means the service you started will be turned off while you reboot your system which is not a desirable output in most cases.

Therefore, you have a different option `enable`.

To use the `enable` option, you'd have to follow the given command syntax:

```
sudo systemctl enable <service_name>
```

But some users may face the following error while using the systemctl command:

![Failed to enable unit: Unit file apache.service does not exist.](https://linuxhandbook.com/content/images/2023/11/Failed-to-enable-unit--Unit-file-apache.service-does-not-exist..png)

That is simply because you used the wrong name for the service and systemctl can not identify the specified service.

In that case, you can list the available services in Ubuntu using the following command: 

```
service --status-all
```

![Find the name of the service in Ubuntu](https://linuxhandbook.com/content/images/2023/11/Find-the-name-of-the-service-in-Ubuntu.png)

Once you find the name of the service, you can use the systemctl command again to enable the service.

For example, earlier I used `apache` instead of `apache2` so my command to start the apache2 service would look like this:

```
sudo systemctl enable apache2.service
```

![start systemd service at boot in Ubuntu](https://linuxhandbook.com/content/images/2023/11/start-systemd-service-at-boot-in-Ubuntu.png)

There you have it.

## Create a custom systemd service

Did you know that you can create a custom systemd service? Want to know how?

Here's a detailed guide explaining [how you can create custom systemd service:](https://linuxhandbook.com/create-systemd-services/) 

[How to create a systemd service in LinuxLearn the steps for creating systemd services in Linux with the practical example demonstrated in this tutorial.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookPratham Patel![](https://linuxhandbook.com/content/images/2022/09/create-systemd-service-in-linux.png)](https://linuxhandbook.com/create-systemd-services/)

I hope you will find this guide helpful.