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.
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 | Manual Installation | |
|---|---|---|
| Setup | A few clicks; authentication and HTTPS are ready | Set up Docker Compose, firewall, and certificate yourself |
| Repository | Created for you at /repository | Create it yourself the first time you open Kopia |
| Back up VPS files | Yes, read-only under /host | Yes, choose any folders |
| Other computers back up to the server (repository server) | No | Yes, over port 51515 with its own certificate |
| Updates | App update in the dashboard | docker compose pull |
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.
- 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.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search the App catalog for Kopia and click Install app.
- 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. - Under App configuration, you can change the
TZtime 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. - Click Queue installation. Kopia should show as online on the app card after about one or two minutes.
- 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 (usuallyzapx)SERVICE_PASSWORD_KOPIA: web interface passwordSERVICE_PASSWORD_KOPIAREPO: your repository password
- 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.
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.
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.
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/volumescontains the data for your One-Click Apps and other Docker containers./host/etc,/host/home,/host/root, and/host/srvare 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.
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.
If you want to run Kopia yourself, for example as a repository server for your other computers, set it up with Docker Compose.
- A Linux VPS running Debian or Ubuntu with root access over SSH.
- Docker with the Compose plugin. See Set Up Docker on a Linux Server for instructions.
| Minimum | Recommended | |
|---|---|---|
| CPU | 1 vCore | 2 vCores |
| RAM | 512 MB | 1 GB |
| Storage for Kopia | 2 GB | 10 GB |
If you store the snapshots on the server, you’ll need additional space for them.
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:
apt update && apt install -y ufw
ufw allow OpenSSH
ufw allow from DEINE_IP to any port 51515 proto tcp
ufw enable
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.
Create a folder and generate two passwords: one for the web interface and one for the repository.
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:
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-certgenerates a certificate on first startup and stores it in./configusing--tls-cert-fileand--tls-key-file. Kopia continues to use these files on subsequent starts. Remove--tls-generate-certafter the first startup, or Kopia will stop if the files already exist.--server-usernameand--server-passwordprotect the web interface.KOPIA_PASSWORDautomatically opens the repository after each restart./:/host:romounts your server read-only under/hostso Kopia can back it up.
Start Kopia and get the certificate fingerprint:
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.
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:
- 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
/repositoryfor a folder on the server. - Click Next. If the destination is empty, Kopia displays Create New Repository.
- Enter the value of
KOPIA_REPO_PASSWORDfrom/opt/kopia/.envunder 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.
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.
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.
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.
Before updating, check the release notes. Enter the new version in compose.yaml and restart:
cd /opt/kopia
docker compose pull
docker compose up -d
- Under Snapshots, click New Snapshot.
- Enter the path, for example,
/host/var/lib/docker/volumesfor your app data or/host/etcfor your server settings. - Click Estimate to preview the number of files and the amount of storage they’ll use.
- Under Scheduling, choose an interval under Snapshot Frequency, such as every 6 or 12 hours, or enter specific times under Times Of Day.
- Under Snapshot Retention, set how many hourly, daily, weekly, monthly, and yearly versions Kopia should keep.
- Click Snapshot Now. The folder will then appear in the list with its size and timestamp.
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.
- Under Snapshots, click the path and then the timestamp you want. You can browse the folders and download individual files.
- To restore an entire folder, click Restore Files & Directories.
- Enter the destination under Destination. For the One-Click App,
/hostis read-only, so choose a folder under/restore, for example,/restore/etc. If the destination ends in.zipor.tar, Kopia will put everything in an archive file. - 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.
This section applies to the manual installation. Give each computer its own user in the format name@computer. Create one like this:
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:
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.
- 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.
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! 🙂
