> For the complete documentation index, see [llms.txt](https://tutorials.garnerpcsquad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorials.garnerpcsquad.com/readme/how-to-configure-ersatztv-as-a-systemd-service.md).

# How to configure ErsatzTV as a systemd service

## Introduction

[ErsatzTV](https://ersatztv.org/docs/intro) can be used for creating custom live streaming channels from your media files.

## Installation

1. Create a folder named `ersatztv` in the `/opt` directory.

```
sudo mkdir /opt/ersatztv
```

2. Download and then extract the [latest release from GitHub](https://github.com/ErsatzTV/ErsatzTV/releases) to the `/opt/ersatztv` folder.

```
sudo tar --strip-components=1 -xvf ErsatzTV-v0.8.6-beta-linux-x64.tar.gz -C /opt/ersatztv
```

## Configuration

1. Create the `systemd` service unit in the `/usr/lib/systemd/user` directory.

```
sudo vi /usr/lib/systemd/user/ersatztv.service
```

Add the following lines:

```
[Unit]
Description=ErsatzTV channel service
After=network.target

[Service]
Type=simple
ExecStart=/opt/ersatztv/ErsatzTV

[Install]
WantedBy=default.target
```

2. Reload the `systemctl` daemon.

```
sudo systemctl daemon-reload
```

5. Enable the service.

```
systemctl --user enable ersatztv.service
```

6. Start the service.

```
systemctl --user start ersatztv.service
```

7. Run the `loginctl` command with the `linger` option to ensure the service runs in the background even when you are logged out.

```
sudo loginctl enable-linger <username>
```

Replace `<username>` with your actual username.

## Summary

The `Ersatztv` service will now run in the background as a `systemd` service and be managed with `systemctl` commands.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorials.garnerpcsquad.com/readme/how-to-configure-ersatztv-as-a-systemd-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
