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 Kopia on a Linux Server – Manage Encrypted, Deduplicated Backups in Your Browser

Set up Kopia as a One-Click App or with Docker on your VPS, back up server data securely and efficiently, and restore individual files in your browser.

2 December 202611 min read6 Views0 helpful

Introduction

Kopia is an open-source backup program (Apache-2.0) that stores files and folders as snapshots in a repository. Kopia encrypts all data before it reaches its destination, stores identical file segments only once (deduplication), and transfers only the changes with each subsequent backup. Kopia can use a folder on the server, S3 storage, Backblaze B2, Google Cloud Storage, Azure, an SFTP or WebDAV server, or an Rclone destination. In server mode, Kopia includes a web interface where you manage repositories, snapshots, schedules, and retention rules.

In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App, which runs Kopia with authentication and HTTPS at your address, and manual installation with Docker Compose, which can also let Kopia act as a repository server for your other computers. Then you’ll back up folders on a schedule and restore files.

When Kopia Makes Sense on a VPS

Kopia is a good choice if:

  • You want to back up your VPS data to another location as well. For example, you can securely back up your app volumes, configurations under /etc, or project folders to S3 storage with another provider.
  • You want to keep many versions without using a lot of space. Thanks to deduplication, each additional snapshot uses only as much space as the changes since the previous version.
  • You want to restore specific files. In the web interface, open a snapshot to download files or restore entire folders.
  • You want to centrally back up your laptops and PCs to your server. With manual installation, Kopia runs as a repository server. Your computers connect using the Kopia desktop app or command line and store their snapshots there, each with its own user.

Kopia is less suitable if you simply want to roll back your entire VPS to an earlier state. For that, use the backups in the Backups tab of your VPS. See Daily Backup and Restore. Kopia complements them with an off-server copy and files that you can restore individually.

One-Click App or Manual Installation?

One-Click AppManual Installation
SetupA few clicks; authentication and HTTPS are readySet up Docker Compose, firewall, and certificate yourself
RepositoryCreated for you at /repositoryCreate it yourself the first time you open Kopia
Back up VPS filesYes, read-only under /hostYes, choose any folders
Other computers back up to the server (repository server)NoYes, over port 51515 with its own certificate
UpdatesApp update in the dashboarddocker compose pull

The Easy Way: Kopia as a One-Click App

The quickest way to get Kopia is through your VPS’s One-Click Apps. With a domain, the web interface is available directly over HTTPS. The One-Click App creates the username, password, and repository during installation.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
  • Kopia requires at least 1 vCore and 512 MB of RAM; 2 vCores and 1 GB are recommended. 2 to 10 GB is enough for Kopia itself, its cache, and logs. If you store the snapshots on the server itself, you’ll need additional space for them.
  • Optionally, 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 using RustFS.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search the App catalog for Kopia and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected. Leave it enabled and enter a name, for example, backup. Without a domain, Kopia would only be available over HTTP, and your password would be transmitted unencrypted.
  4. Under App configuration, you can change the TZ time zone (default: Europe/Berlin), which determines your schedules. You don’t need to fill in anything: the app generates the username, password, and repository password automatically.
  5. Click Queue installation. Kopia should show as online on the app card after about one or two minutes.

First Login

  1. Open the app settings (gear icon), then go to App environment > Automatically generated values. You’ll find three values there. Click the eye icon to display them:
    • SERVICE_USER_KOPIA: web interface username (usually zapx)
    • SERVICE_PASSWORD_KOPIA: web interface password
    • SERVICE_PASSWORD_KOPIAREPO: your repository password
  2. Open the app’s Access link. Your browser will ask for a username and password. Enter the first two values.

Without signing in, Kopia won’t display anything. Even the web interface’s endpoint responds to outsiders only with an error message.

After logging in, you’ll go straight to Snapshots. You don’t need to create a repository: the app created one on first startup in the /repository folder using the password from SERVICE_PASSWORD_KOPIAREPO and reconnects to it every time it starts. That’s why Repository in Filesystem: /repository appears at the top. The app card also notes this under Login and repository.

Repository and Repository Password

The repository is stored in the kopia-repository volume on your VPS. Kopia encrypts everything in it using SERVICE_PASSWORD_KOPIAREPO. Also save this password in your password manager: without it, your snapshots can no longer be read—not even by us.

Warning: Don’t create a second repository with a different password

The app connects to the repository with SERVICE_PASSWORD_KOPIAREPO after every restart and update. If you create another repository with a different password under Repository, Kopia will no longer be connected afterward. When creating a new repository, for example on S3 storage, always use SERVICE_PASSWORD_KOPIAREPO as its password.

Because the repository is on the same server as your data, it protects against files being accidentally deleted or changed, but not against a server outage. The backups in the Backups tab of your VPS also include Kopia’s volumes, giving you an off-server copy.

What Kopia Can Access on Your Server

Kopia runs in a container. To let it back up your server, the One-Click App mounts your VPS’s filesystem read-only under /host:

  • /host/var/lib/docker/volumes contains the data for 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.

If you enter a path without /host for a snapshot, such as /etc, you’ll back up only the files in Kopia’s container, not your server’s files. Kopia can’t make changes under /host. That’s why you can download restored files or restore them to the /restore folder. It’s in a separate volume whose name on the server ends with _kopia-restore.

Updates and Backup

Install new versions in the app settings under App update by clicking Check for updates and Apply update. The repository, policies, and cache are preserved because they’re stored in the kopia-repository, kopia-config, kopia-cache, and kopia-logs volumes. Restored files are stored in the kopia-restore volume.

Make sure you also keep the repository password and your storage destination credentials safe. With both, you can reconnect to the repository from a new server or your PC and access all your snapshots.

Manual Installation

If you want to run Kopia yourself, for example as a repository server for your other computers, set it up with Docker Compose.

Requirements

MinimumRecommended
CPU1 vCore2 vCores
RAM512 MB1 GB
Storage for Kopia2 GB10 GB

If you store the snapshots on the server, you’ll need additional space for them.

Prepare the Firewall

Kopia listens on port 51515 and encrypts the connection using its own certificate. Open the port only to the computers that actually need it. Install ufw, allow SSH, and open the port only for your own IP address:

bash
apt update && apt install -y ufw
ufw allow OpenSSH
ufw allow from DEINE_IP to any port 51515 proto tcp
ufw enable
Info: Docker and ufw

Ports published by Docker bypass ufw. Therefore, the ufw rule alone does not protect port 51515. Also restrict the port to your IP addresses in your VPS’s Network firewall in the ZapX dashboard. For more information, see Open Ports and Manage the Firewall on Linux. The web interface and repository server are also protected by passwords.

Install with Docker Compose

Create a folder and generate two passwords: one for the web interface and one for the repository.

bash
mkdir -p /opt/kopia && cd /opt/kopia
umask 077
echo "KOPIA_UI_PASSWORD=$(openssl rand -base64 24)" > .env
echo "KOPIA_REPO_PASSWORD=$(openssl rand -base64 24)" >> .env

Then create /opt/kopia/compose.yaml:

yaml
services:
  kopia:
    image: kopia/kopia:0.23
    restart: unless-stopped
    hostname: kopia
    environment:
      KOPIA_PASSWORD: ${KOPIA_REPO_PASSWORD}
    command:
      - server
      - start
      - --tls-generate-cert
      - --tls-cert-file=/app/config/tls.crt
      - --tls-key-file=/app/config/tls.key
      - --address=0.0.0.0:51515
      - --server-username=admin
      - --server-password=${KOPIA_UI_PASSWORD}
    ports:
      - "51515:51515"
    volumes:
      - ./config:/app/config
      - ./cache:/app/cache
      - ./logs:/app/logs
      - ./repository:/repository
      - /:/host:ro

Here are the important lines:

  • --tls-generate-cert generates a certificate on first startup and stores it in ./config using --tls-cert-file and --tls-key-file. Kopia continues to use these files on subsequent starts. Remove --tls-generate-cert after the first startup, or Kopia will stop if the files already exist.
  • --server-username and --server-password protect the web interface.
  • KOPIA_PASSWORD automatically opens the repository after each restart.
  • /:/host:ro mounts your server read-only under /host so Kopia can back it up.

Start Kopia and get the certificate fingerprint:

bash
docker compose up -d
docker compose logs kopia | grep "SERVER CERT SHA256"

Make a note of the value after SERVER CERT SHA256. Your computers will use it later to verify that they’re connecting to your server.

First Visit

Open https://SERVER_IP:51515 in your browser. Since the certificate is self-generated, the browser will show a warning the first time. Compare the fingerprint in the certificate details with the value you noted down, then accept the exception. Sign in with admin and the value of KOPIA_UI_PASSWORD from /opt/kopia/.env. Unlike with the One-Click App, you’ll create the repository yourself:

  1. Kopia displays Select Storage Type. Choose your destination, for example, Amazon S3 or Compatible Storage for S3 storage, or Local Directory or NAS with the Directory Path /repository for a folder on the server.
  2. Click Next. If the destination is empty, Kopia displays Create New Repository.
  3. Enter the value of KOPIA_REPO_PASSWORD from /opt/kopia/.env under Repository Password and Confirm Repository Password, then click Create Repository.

Use this exact password. Kopia opens the repository after each restart using KOPIA_PASSWORD from the Compose file.

Access over HTTPS with Your Own Certificate

Instead of the self-generated certificate, you can use a Let’s Encrypt certificate for your own domain. See Create an SSL Certificate for instructions on generating one with certbot. Then mount the certificate folder as read-only, remove --tls-generate-cert, and point --tls-cert-file and --tls-key-file to fullchain.pem and privkey.pem. After each certificate renewal, restart Kopia with docker compose restart.

Info: Reverse Proxy

Your computers communicate with the repository server over gRPC (HTTP/2). A standard reverse proxy, such as the one described in Set Up a Reverse Proxy with nginx, won’t work for this. The easiest option is to connect your computers directly to port 51515.

Back Up Your Data

Everything Kopia needs is under /opt/kopia: config contains the repository connection and certificate, and repository contains the snapshots if you store them locally. Two things are more important than a copy of these folders: the repository password from /opt/kopia/.env and the credentials for your storage destination. With both, you can reconnect to the repository from any computer.

Update Kopia

Before updating, check the release notes. Enter the new version in compose.yaml and restart:

bash
cd /opt/kopia
docker compose pull
docker compose up -d

Back Up and Restore with Kopia

Create and Schedule a Snapshot

  1. Under Snapshots, click New Snapshot.
  2. Enter the path, for example, /host/var/lib/docker/volumes for your app data or /host/etc for your server settings.
  3. Click Estimate to preview the number of files and the amount of storage they’ll use.
  4. Under Scheduling, choose an interval under Snapshot Frequency, such as every 6 or 12 hours, or enter specific times under Times Of Day.
  5. Under Snapshot Retention, set how many hourly, daily, weekly, monthly, and yearly versions Kopia should keep.
  6. Click Snapshot Now. The folder will then appear in the list with its size and timestamp.
Tip: Back Up Databases Properly

Running databases (MySQL, PostgreSQL) may be in the middle of writing data when Kopia snapshots their files. Instead, back them up using an export (for example, run pg_dump to a folder with a cron job) and have Kopia back up that folder.

Restore Files

  1. Under Snapshots, click the path and then the timestamp you want. You can browse the folders and download individual files.
  2. To restore an entire folder, click Restore Files & Directories.
  3. Enter the destination under Destination. For the One-Click App, /host is read-only, so choose a folder under /restore, for example, /restore/etc. If the destination ends in .zip or .tar, Kopia will put everything in an archive file.
  4. Click Begin Restore. You can track progress under Tasks.

The files will then be in the volume whose name ends with _kopia-restore. To find the exact name, run docker volume ls | grep kopia-restore. The files themselves are in its _data subfolder. From there, copy them to their destination over SSH or SFTP.

Connect Other Computers (Repository Server)

This section applies to the manual installation. Give each computer its own user in the format name@computer. Create one like this:

bash
cd /opt/kopia
docker compose exec kopia kopia server user add laptop@meinpc
docker compose restart

Kopia will ask you to set a password for this user. On the computer, connect using the Kopia desktop app by selecting Kopia Repository Server, or use the command line:

bash
kopia repository connect server --url=https://SERVER_IP:51515 --server-cert-fingerprint=FINGERABDRUCK --override-username=laptop --override-hostname=meinpc

The address must always include the port. Then create snapshots with kopia snapshot create <folder> or schedule them in the desktop app. Each user can see only their own snapshots.

Limitations

  • Repository server requires its own port: With the One-Click App, Kopia runs behind your VPS’s HTTPS access. You can access the web interface this way, but your computers can’t connect as clients. For that, you need the manual installation.
  • Users can only be created from the command line: Create repository server users with kopia server user add, not in the web interface.
  • Snapshot actions: Actions that run before or after a snapshot are disabled in server mode.

Conclusion

With Kopia, you now back up your server’s data in encrypted, space-saving form and can restore individual files from your browser at any time. If you also want to keep folders in sync between your devices, the guide Set Up Syncthing on a Linux Server shows you how.

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 if you want to securely back up your VPS data to another destination: authentication, HTTPS, passwords, and the repository are already set up, and you can install updates in the dashboard. If you also want your laptops or PCs to back up to the server, you’ll need the manual installation because Kopia requires its own port and certificate for that.
In the app settings (gear icon), go to App Environment > Automatically Generated Values. SERVICE_USER_KOPIA and SERVICE_PASSWORD_KOPIA are the web interface username and password; SERVICE_PASSWORD_KOPIAREPO is your repository password. The repository at /repository has already been created with this password.
Your snapshots will no longer be readable. Kopia encrypts all data with this password, and it can’t be reset—not even by us. Make sure you also save it in a password manager.

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.