Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Backrest on a Linux Server – Schedule Encrypted restic Backups in Your Browser

Set up Backrest as a One-Click App or with Docker on your VPS, then use restic to encrypt and schedule backups of your server data and restore files in your browser.

2 December 202613 min read6 Views0 helpful

Introduction

Backrest is a web interface for the backup program restic (open source, GPL-3.0). Instead of managing restic commands and cron jobs by hand, you can use your browser to choose which folders to back up, where to store them (your own hard drive, S3 storage, an SFTP server, Backblaze B2, and many more), and when. Backrest runs backups on a schedule, deletes old versions according to your rules, checks the repository, and displays each backup in the Snapshot Browser, where you can download or restore individual files. restic encrypts all data on your server before it reaches its destination.

In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App, which runs Backrest with login and HTTPS at your address, and manual installation with Docker Compose. After that, you’ll set up your first repository and backup plan, then restore files.

When Backrest Is Useful on a VPS

Backrest is a good choice if:

  • You want to store copies of your VPS data somewhere else. For example, you can back up your app volumes, configurations in /etc, or project folders to an S3 storage service from another provider or to a second server, with encryption.
  • You want to restore specific files. In the Snapshot Browser, you can choose a snapshot and download individual files or folders without resetting the entire server.
  • You want to keep multiple snapshots. With a retention policy, for example, you can keep the last 7 daily, 4 weekly, and 6 monthly backups. Thanks to restic’s deduplication, each additional snapshot only uses as much space as the changes.
  • You want to be notified if something goes wrong. Backrest can report errors through Discord, Slack, Telegram, Gotify, Healthchecks, and many other services.

Backrest is less suitable if you simply want to restore your entire VPS to an earlier state. For that, use the backups in your VPS’s Backups tab; see Daily Backup and Restore. Backrest complements these backups with a copy stored outside the server and the ability to restore individual files.

Easy Method: Backrest as a One-Click App

The quickest way to get Backrest is through your VPS’s One-Click Apps. With a domain, the app is accessible directly over HTTPS. You don’t need to set up a reverse proxy, certificate, or firewall rules, and the One-Click App creates your user account during installation.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
  • Backrest requires at least 1 vCore and 256 MB of RAM; 2 vCores and 512 MB are recommended. More RAM can help when processing large folders for the first time. Backrest itself and its cache need 1 to 10 GB. If you store backups on the server itself, you’ll need additional space for them.
  • A storage destination outside the server, such as an S3 bucket. For example, you can set up your own S3 storage on a second server with RustFS.

Install Backrest

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search for Backrest in the App catalog and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected. Leave this option enabled and enter a name, such as backup. Without a domain, Backrest would only be accessible over HTTP, and your password would be transmitted unencrypted.
  4. You can change two values under App configuration, but you don’t need to fill in anything: TZ is the time zone (default Europe/Berlin), which your schedules use. BACKREST_INSTANCE_ID is the name of this Backrest installation (default backrest). It appears in every backup and is only set during installation; changing it later under App environment won’t take effect. The app generates a username and password for you.
  5. Click Queue installation. Backrest should appear as online on the app card after about one to two minutes.

First Login

The One-Click App creates your user account the first time it starts. The app card mentions this under Login:

  1. Open the app settings (gear icon), then go to App environment > Automatically generated values. The username is listed under SERVICE_USER_BACKREST (usually zapx) and the password under SERVICE_PASSWORD_BACKREST. Click the eye icon to show the values.
  2. Open the app’s Access link.
  3. Enter these details under Username and Password, then click Log in.

Login is enabled by default for the One-Click App. Visitors only see the login page and can’t create their own account or disable login. After logging in, Backrest displays the Getting Started overview with the first steps.

The interface is in English by default. Under Settings > General, change Display Language to German. This guide uses the English labels. You can change your password under Settings > Authentication for your user. The value in App environment won’t be updated afterward; it’s only used for the first login.

What Backrest Can Access on Your Server

Backrest runs in a container. To back up your server, the One-Click App mounts your VPS’s file system as read-only under /host:

  • /host/var/lib/docker/volumes contains data from your One-Click Apps and other Docker containers.
  • /host/etc, /host/home, /host/root, and /host/srv are the usual folders for settings and your own files.

Backrest can’t make changes under /host. That means you can download restored files or restore them to a folder of your own (see “Restore Files”). Backrest’s own data is stored in four volumes: backrest-config contains settings for all repositories, plans, and passwords; backrest-data contains the history of all operations; backrest-cache contains restic’s cache; and backrest-repos is the /repos folder inside the container, used for backups stored on the server itself.

Warning: A backup on the same server is not a substitute for an external backup

A repository under /repos is stored on the same hard drive as your data. If the server fails or is deleted, this backup will be lost too. Use /repos only for testing, at most, and store your backups long term at a destination outside the server.

Updates and Backups

To check whether a new version is available, open the app settings (gear icon), go to App update, and click Check for updates. Click Apply update to install a new version. If the page says the app is up to date, there isn’t a newer version in the App Catalog. Your repositories, plans, and history are kept when you update.

The most important file is the configuration in the backrest-config volume. It contains your repository passwords. Without a repository password, nobody can decrypt the backups—not even you. Make sure to also save the passwords in your password manager. A backup of your VPS in the Backups tab includes all Backrest volumes.

Manual Installation

The rest of this guide describes manual installation of Backrest with Docker Compose on your VPS. For example, you might choose this option if you don’t use One-Click Apps on your server or want to manage Backrest yourself alongside other services. This guide is based on the official Backrest documentation.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First Access via SSH.
  • Docker and Docker Compose. See Install Docker. Check the installation with docker --version and docker compose version.
  • For HTTPS: a domain or subdomain whose A record points to your VPS’s IP address (for example, backup.example.com).

Backrest runs in a single container, with restic and rclone included in the image:

MinimumRecommended
CPU1 vCore2 vCores
RAM256 MB512 MB
Storage (without local backups)1 GB10 GB

Prepare the Firewall

Backrest listens on port 9898 inside the container. Don’t open this port, because Backrest should only be accessible through a reverse proxy with HTTPS. With ufw, allow only SSH and the ports needed for the reverse proxy:

Code
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status

In the Compose file below, port 9898 is bound only to 127.0.0.1. This means only the reverse proxy on the same server can access it, even if Docker sets its own firewall rules. For more information about firewall rules, see Open Ports and Manage the Firewall.

Warning: Backrest is exposed if you don’t configure it first

A fresh Backrest installation doesn’t have login enabled yet. Anyone who opens the page can create their own account in the “Getting Started” window or disable login entirely. Backrest hooks can also run commands in the container. Set up your account before Backrest is publicly accessible (see “First Visit and User Account”).

Install with Docker Compose

Create a folder for Backrest:

Code
mkdir -p ~/backrest/{data,config,cache,tmp,repos}
cd ~/backrest

Then create a compose.yaml file in the ~/backrest folder, for example with nano compose.yaml:

Code
services:
  backrest:
    image: ghcr.io/garethgeorge/backrest:v1.14.1
    container_name: backrest
    hostname: backrest
    restart: unless-stopped
    ports:
      - "127.0.0.1:9898:9898"
    environment:
      - BACKREST_DATA=/data
      - BACKREST_CONFIG=/config/config.json
      - XDG_CACHE_HOME=/cache
      - TMPDIR=/tmp
      - TZ=Europe/Berlin
    volumes:
      - ./data:/data
      - ./config:/config
      - ./cache:/cache
      - ./tmp:/tmp
      - ./repos:/repos
      - /:/host:ro

Important lines:

  • image uses the official image with a fixed version number. You can find the current version in the Backrest releases. Don’t use latest, so that updates only happen when you choose.
  • ports binds Backrest to 127.0.0.1 only. The port can’t be accessed from outside the server.
  • TZ sets the time zone. Your schedules use this time zone; without this line, Backrest uses UTC.
  • ./config contains the config.json file with all settings and repository passwords; ./data contains the history; and ./cache contains restic’s cache.
  • /:/host:ro mounts your server’s file system as read-only under /host. If you only want to back up specific folders, mount only those instead, for example /srv:/userdata/srv:ro.
  • ./repos is mounted as /repos inside the container, a location for repositories stored on the server itself.

Start Backrest:

Code
docker compose up -d
docker compose logs -f

After a few seconds, the log will show that Backrest is listening on port 9898. Press Ctrl+C to exit the log view; the container will keep running.

First Visit and User Account

Set up login before configuring the reverse proxy. To do this, open an SSH tunnel. Run this command on your own computer:

Code
ssh -L 9898:127.0.0.1:9898 root@SERVER_IP
  1. Open http://localhost:9898 in your browser. Backrest displays the Getting Started page with the Settings window.
  2. Enter a name for this installation under Instance ID, such as your server’s name. It appears in every backup and can’t be changed later.
  3. Under Authentication, turn off Disable Authentication.
  4. Under Users, click Add user and enter a username (letters, numbers, and hyphens) and a strong password.
  5. Click Save changes. Backrest will now display the login page. Sign in with your new account.
Tip: Run Backrest without Docker

Backrest is also available as a program that runs directly on the server. In this setup, it can write files back to their original location. You can find a Linux installation script in the Backrest releases. The setup in the browser is the same.

Access Backrest over HTTPS Through a Reverse Proxy

Set up nginx as a reverse proxy as described in Set Up a Reverse Proxy with nginx, and get a certificate as explained in SSL Certificate with Let's Encrypt. The server block for Backrest looks like this:

Code
server {
    listen 80;
    server_name backup.example.com;

    location / {
        proxy_pass         http://127.0.0.1:9898;
        proxy_http_version 1.1;
        proxy_buffering    off;
        proxy_read_timeout 1h;
        proxy_set_header   Host $host;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}
  • proxy_buffering off and the long proxy_read_timeout keep the live display open so Backrest can report the progress of running backups.

Then run sudo nginx -t and sudo systemctl reload nginx, and get the certificate with sudo certbot --nginx -d backup.example.com. Backrest is now accessible at https://backup.example.com.

Back Up Your Data

The most important folder is ~/backrest/config. It contains your repository passwords. Back it up somewhere else and also save the repository passwords in your password manager:

Code
cd ~/backrest
tar czf ~/backrest-config-$(date +%F).tar.gz config compose.yaml

You don’t need the data folder for the backups themselves. If it’s lost, only the history in the interface will be missing; the backups in the repository will remain intact.

Update Backrest

First, make a backup of config and read the release notes. Then enter the new version number for image in compose.yaml and run:

Code
cd ~/backrest
docker compose pull
docker compose up -d
docker image prune -f

When it starts, Backrest will update the configuration to the new version and first create a copy named config.json.bak.<Datum>.

Set Up Backups with Backrest

Open Backrest’s settings from the left sidebar. A repository is where restic stores your backups. A plan specifies which folders are backed up, when, and to which repository. Multiple plans can back up to the same repository.

Create a Repository

  1. In the left sidebar, click Add Repo under Repositories.
  2. Enter a name under Repo Name, for example s3-backup. You can’t change it later.
  3. Enter the destination under Repository URI, for example s3:https://s3.example.com/mein-bucket/backrest for S3 storage, or /repos/test to test on the server itself.
  4. Click [Generate] under Password or enter a long password. restic uses this password to encrypt all data. Save it in your password manager right away.
  5. Enter your S3 credentials under Env Vars, for example AWS_ACCESS_KEY_ID=… and AWS_SECRET_ACCESS_KEY=….
  6. Click Test Configuration, then Submit. If the destination is empty, Backrest will create a new repository there.

Under Prune Policy and Check Policy, you can set when Backrest removes data that’s no longer needed from the repository and checks it for errors. You can use the default settings to get started. For a list of other destinations supported by restic (SFTP, Backblaze B2, Azure, Google Cloud Storage, and rclone), see the restic documentation.

Create a Backup Plan

  1. Under Plans, click Add Plan.
  2. Enter a name under Plan Name and select your repository under Repository.
  3. Under Paths, enter the folders you want to back up. For the One-Click App, paths start with /host, for example /host/var/lib/docker/volumes and /host/etc. Enter any folders you want to exclude from the backup under Excludes.
  4. Under Backup Schedule, choose a schedule under Schedule Type, for example Interval (Days) with 1 for a daily backup. Use Cron to set a specific time, such as 0 3 * * * for 3 a.m. every day.
  5. Under Retention Policy, set how many snapshots Backrest should keep. For example, choose By Count with Keep Last N Snapshots, or By Time Period and enter a number for Daily, Weekly, and Monthly.
  6. Click Submit. Click Backup Now in the plan to start the first backup immediately.

The first backup transfers all your data and takes correspondingly longer. Each subsequent backup transfers only the changes.

Info: Back Up Databases Safely

Databases that are running are constantly changing their files. Backing up these files while the database is running may result in an inconsistent backup. Have the database export a dump to a folder included in the plan before the backup, for example with a cron job on the server, and include that export in the backup.

Restore Files

  1. Open your plan or repository in the left sidebar. Each backup appears in the list with its date and size.
  2. Expand a backup and open the Snapshot Browser.
  3. Open the menu next to a file or folder and select Download to download it directly.
  4. For larger amounts of data, select Restore to path. Backrest suggests a folder next to the original, which for the One-Click App is under /host. This folder is read-only, so the restore would fail. Replace the suggested path with a folder in your own volume, for example /repos/restore. If you leave the field empty, your browser will download the files.
  5. Click Restore and confirm with Confirm Restore?. After the restore, the operation entry will also offer Download File(s).

Restored files under /repos are stored on the server in the volume whose name ends in _backrest-repos. Run docker volume ls | grep backrest to see the exact name. From there, copy them into place over SSH or SFTP.

Notifications and Hooks

Under Hooks in a plan or repository, you can specify what happens when certain events occur, such as a backup error. Backrest can then send notifications through Discord, Slack, Telegram, Gotify, Healthchecks, or Shoutrrr, which supports many other services. The developers recommend setting up at least one hook for errors so you know if backups stop running. With Command, Backrest can run custom commands in the container.

Backrest Limitations

  • It can’t restore an entire server. Backrest backs up files. To restore your entire VPS, use the backups in the Backups tab.
  • The One-Click App can’t write files back directly. Because /host is read-only, you’ll need to download files or restore them through /repos, then copy them into place yourself.
  • You can’t restore without the repository password. There’s no way around restic’s encryption. If you lose the password, you lose access to the backups.

Conclusion

With Backrest, you back up your server’s data encrypted and on a schedule to a destination of your choice and restore individual files in your browser when needed. Next, the guide Set Up Garage on a Linux Server shows you how to build your own S3-compatible object storage as a target for your backups.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: ZapX sets up the domain, HTTPS, and your user account during installation, mounts your server’s file system as read-only under /host, and lets you install updates from the dashboard using App Update. Manual installation with Docker Compose is a good choice if you don’t use One-Click Apps, want to run Backrest behind your own reverse proxy, or want to control which folders Backrest can access and whether it can write restored files directly.
The backups in the Backups tab cover your entire VPS and can restore it completely if needed. Backrest uses restic to encrypt selected folders and store them at a destination of your choice, such as an S3 storage service from another provider. It keeps multiple snapshots and lets you restore individual files. The two options complement each other.
Choose a destination outside the server, such as an S3 bucket, an SFTP server, or Backblaze B2. A repository under /repos is on the same hard drive as your data and will also be lost if the server fails. Use it only for testing.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.