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

# Using systemd Services: How to Create and Manage Daemons on Your Linux VPS
- URL: https://blog.alphavps.com/using-systemd-services-how-to-create-and-manage-daemons-on-your-linux-vps/
- Published: 2026-02-23T08:23:48.000Z
- Updated: 2026-09-08T15:18:07.000Z
- Author: Karim Buzdar
- Tags: Tutorials, Automation & DevOps, Linux Basics

Anyone who manages a Linux virtual private server must be able to efficiently manage background services. Modern Linux distributions, including Ubuntu, Debian, CentOS, AlmaLinux, and Fedora, use systemd, a powerful init system that controls how services start, stop, and behave at boot time. Understanding systemd will improve your server management, whether you are deploying applications, automating a script, or running custom-built daemons. 

This guide will teach you how to create, manage, and configure systemd services by using best practices and practical examples.

## How systemd Services Work

systemd uses unit files, typically located in /etc/systemd/system/, to define how a service behaves. Systemd is a Linux VPS application that allows you to control how your applications are run.

Learn how to use the systemd services, and you can take full control of your Linux VPS. Systemd is a reliable, automated, and stable solution for all your needs, whether you are running a script, setting up a microservice in production, or deploying a website. You can create daemons of professional quality by mastering systemd commands and service files.

## Using systemd Services: How to Create and Manage Daemons on Your Linux VPS

The default service manager in most Linux distributions is systemd. It replaces the older init system and provides a way to manage background daemons, system processes, and boot sequences. In short, systemd gives you complete control over how your applications run on your Linux VPS.

Let’s learn how to create your own custom service.

### Step 1: Create a Script or Application to Run

Create the program that you wish to run as a Daemon. A simple Python script is an example.

```bash
sudo nano /usr/local/bin/hello.py
```

Paste:

```python
#!/usr/bin/env python3
import time
while True:
    with open("/tmp/hello.log", "a") as f:
        f.write("Hello from systemd!\n")
    time.sleep(5)
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-424eb2fc-4576-42cc-9a17-1ced1e6c79dc.png)

Make it executable:

```bash
sudo chmod +x /usr/local/bin/hello.py
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-7b7d6f2c-f240-41fc-b1d4-dcac488b0801.png)

### Step 2: Create a systemd Service Unit File

Create a service file now:

```bash
sudo nano /etc/systemd/system/hello.service
```

Add:

```ini
[Unit]
Description=Hello Demo Service
After=network.target
[Service]
ExecStart=/usr/local/bin/hello.py
Restart=always
User=root
[Install]
WantedBy=multi-user.target
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-f88f0ead-ab5e-4260-932c-621941df299e.png)

**Explanation**:

- Description - identifies a service
- After - ensures that service begins after the network
- ExecStart is the command that runs systemd
- Restart = always - it will restart automatically if the system crashes
- WantedBy – defines the start date of the service

### Step 3: Reload systemd

Reload systemd after adding or editing a unit file:

```bash
sudo systemctl daemon-reload
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-968d42c4-3b54-4c3a-856a-253bb6b30966.png)

### Step 4: Start and Enable the Service

Start the service:

```bash
sudo systemctl start hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-7c02318e-8895-4e5e-943d-1b43c8df7cde.png)

Enable the boot to run:

```bash
sudo systemctl enable hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-a77bcd97-5688-416d-91e7-cd4619228409.png)

Check status:

```bash
sudo systemctl status hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-b22b698a-9c50-4531-9548-cabc1909bc85.png)

Logs and runtime information will be displayed.

### Step 5: Manage the Service

Here are some of the most common commands.

Stop a service:

```bash
sudo systemctl stop hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-4bce1047-e33c-4c64-a25d-3fbb5f4cdd41.png)

Restart

```bash
sudo systemctl restart hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-e5cf62d6-366c-4323-a2e7-a37d21a7100e.png)

View logs

```bash
sudo journalctl -u hello.service -f
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-bd96725f-6bf4-47e6-8ac1-421fef87bac9.png)

Disable autostart

```bash
sudo systemctl disable hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-e84b6b64-aa3b-4bcc-9252-f88dd138eea1.png)

Check if enabled

```bash
sudo systemctl is-enabled hello.service
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-0e8dfdc9-4a08-474c-a2fb-e4e4bfa4e386.png)

### Step 6: Remove a systemd Service

To delete the service:

```bash
sudo systemctl stop hello.service
sudo systemctl disable hello.service
sudo rm /etc/systemd/system/hello.service
sudo systemctl daemon-reload
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-a140bd23-c269-4fdb-ac74-576bd290f363.png)

## Conclusion

To create and manage daemons using systemd on your Linux VPS, you first write the script or application you want to run in the background, then create a service unit file under /etc/systemd/system/ that defines how the service should start, stop, restart, and run at boot.

After saving the unit file, you reload systemd with sudo systemctl daemon-reload, start the service using sudo systemctl start <service>, and enable it at boot with sudo systemctl enable <service>. You can manage it with commands like systemctl stop, restart, and status, and view logs with journalctl -u <service>. To remove the service, stop and disable it, then delete the service file and reload systemd.

Want to create and manage daemons on your [**Cheap VPS**](https://alphavps.com/cheap-vps.html?ref=blog.alphavps.com)? Follow this step-by-step tutorial.