How to Install Seafile on VPS with Docker: A Private Cloud for File Sync and Sharing
Files scattered across a laptop, a phone, and a few free cloud accounts eventually create the same problem: you stop being sure which copy is the newest. A document gets edited on the laptop, a folder of photos lives only on the phone, and share links from three different services expire at different times. Seafile fixes that mess with one storage location you run yourself: files sync between devices, version history is kept, and share links come from your own server.
This guide installs Seafile Community Edition (CE) on a VPS using the project’s official Compose files. The end result: Seafile runs behind Caddy, which issues and renews Let’s Encrypt certificates automatically, so you open https://files.example.com and sign in with an admin account you created yourself.
Before you start: what you need
- A VPS with Docker and Docker Compose v2 already installed. Seafile’s official docs recommend at least 2 GB of RAM and a 2-core CPU for the Community Edition.
- A domain whose
Arecord already points at the VPS public IP, for examplefiles.example.com. Caddy needs a domain that genuinely resolves to your server before it can issue a certificate. - Ports
80and443free and reachable from the internet. Port80is used for Let’s Encrypt validation, port443for HTTPS. - An email address and password for the first admin account, plus a database root password. Keep all of them in a password manager, not in your head.
Check Docker and Compose:
docker --version docker compose version
Expected result: both commands print version numbers with no error message.
Step 1: download the official files to /opt/seafile
The official docs use /opt/seafile as the Compose folder. Create it and download four official files: the .env template, the server manifest, the SeaDoc manifest for collaborative document editing, and the Caddy manifest for automatic HTTPS:
mkdir -p /opt/seafile cd /opt/seafile wget -O .env https://manual.seafile.com/13.0/repo/docker/ce/env wget https://manual.seafile.com/13.0/repo/docker/ce/seafile-server.yml wget https://manual.seafile.com/13.0/repo/docker/seadoc.yml wget https://manual.seafile.com/13.0/repo/docker/caddy.yml
Check the folder contents:
ls -la /opt/seafile
Expected result: .env, seafile-server.yml, seadoc.yml, and caddy.yml are all present. If any download fails, do not continue — check the connection and retry the failed wget command.
Three core services will run: the seafile container (image seafileltd/seafile-mc:13.0-latest), the db container (MariaDB 10.11) for metadata and accounts, and the redis container as a cache. Seafile data lives in /opt/seafile-data, database data in /opt/seafile-mysql/db, and Caddy data including certificates in /opt/seafile-caddy.
Step 2: fill in .env with your own values
Open .env in a text editor:
nano .env
Change at least these variables. The examples below use files.example.com; replace it with your domain:
SEAFILE_SERVER_HOSTNAME=files.example.com SEAFILE_SERVER_PROTOCOL=https TIME_ZONE=Asia/Jakarta INIT_SEAFILE_ADMIN_EMAIL=admin@example.com INIT_SEAFILE_ADMIN_PASSWORD=replace-with-a-strong-admin-password INIT_SEAFILE_MYSQL_ROOT_PASSWORD=replace-with-a-mysql-root-password SEAFILE_MYSQL_DB_PASSWORD=replace-with-a-seafile-database-password JWT_PRIVATE_KEY=
SEAFILE_SERVER_HOSTNAME and JWT_PRIVATE_KEY are mandatory — the official Compose file refuses to run when either is empty. For the JWT key, generate a random string of at least 32 characters with the command named in the official docs:
pwgen -s 40 1
Copy the output into the JWT_PRIVATE_KEY line in .env. If pwgen is not installed, install it from your distribution’s package repository first, then run the command again. Never use the template’s default passwords (asecret and friends) on any installation reachable from the internet.
Save .env, then double-check that no mandatory variable is still empty:
grep -E "SEAFILE_SERVER_HOSTNAME|JWT_PRIVATE_KEY|INIT_SEAFILE_ADMIN" .env
Step 3: start the stack and watch the first run
From inside /opt/seafile, start the stack in the background:
docker compose up -d docker compose ps docker logs seafile -f
Expected result: the seafile, seafile-mysql, and seafile-redis containers are running. The first start takes about a minute because Seafile creates the database schema and its configuration files. In the log, look for this sequence:
Seafile server started Successfully created seafile admin Seahub is started
Press Ctrl+C to leave the log view. If the log stops at a database error, do not repeat up -d blindly without reading the message — check the error table below.
Step 4: open Seafile and create your first library
Open https://files.example.com in a browser and sign in with the admin email and password from .env. Expected result: the Seafile dashboard opens, with the HTTPS padlock showing and no warning.
Create your first library:
- Click New Library and name it, for example
Work Documents. - Open the library and upload one file with the Upload button.
- Download that file back from the library to confirm upload and download both work.
Next, install a Seafile sync client on your laptop or phone, sign in with the server address https://files.example.com, and pick the libraries to sync. From then on, a file changed on one device shows up on the others after the next sync.
The diagram sums up the flow: your devices talk to Caddy over HTTPS, Caddy forwards to the Seafile container, and Seafile stores metadata in MariaDB, cache in Redis, and files in the /opt/seafile-data volume.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Compose fails with a variable-not-set message | SEAFILE_SERVER_HOSTNAME or JWT_PRIVATE_KEY is still empty in .env | Fill in both variables, then run docker compose up -d again |
| Compose reports no configuration file found | The command ran outside /opt/seafile | Change into /opt/seafile first, or name the files explicitly: docker compose -f seafile-server.yml -f caddy.yml up -d |
Error Named volume ... but no declaration was found | Docker or Compose is too old | Update Docker and the Compose plugin following Docker’s official docs, then retry |
The seafile container keeps restarting | The database password in .env no longer matches the first installation | Do not change database passwords after the first installation completes; if the install genuinely failed outright, delete /opt/seafile, /opt/seafile-data, and /opt/seafile-mysql, then restart from Step 1 |
| No certificate issued, site unreachable over HTTPS | DNS does not point at the VPS yet, or ports 80/443 are blocked by the firewall | Check the domain’s A record and open both ports, then inspect the Caddy log with docker compose logs caddy |
| Admin password forgotten | The admin credentials are only created during the first initialization | Create a new admin from inside the running container: docker exec -it seafile /opt/seafile/seafile-server-latest/reset-admin.sh, then follow its prompts |
| Page opens but client sync fails | Wrong server address in the client, or HTTP where the server uses HTTPS | Match the client server address to SEAFILE_SERVER_HOSTNAME and SEAFILE_SERVER_PROTOCOL in .env |
Updating and backing up Seafile
The whole installation state lives in three host folders: /opt/seafile-data, /opt/seafile-mysql, and /opt/seafile-caddy. Back them up before updating:
cp -r /opt/seafile-data /opt/seafile-data.backup cp -r /opt/seafile-mysql /opt/seafile-mysql.backup cp -r /opt/seafile-caddy /opt/seafile-caddy.backup
Then pull the newest images and recreate the containers:
cd /opt/seafile docker compose pull docker compose up -d docker compose ps
Expected result: all containers are running again, libraries and accounts intact, and the site still opens over HTTPS.
Summary
| Part | Value used |
|---|---|
| Seafile image | seafileltd/seafile-mc:13.0-latest |
| Database image | mariadb:10.11 |
| Cache | Redis (Seafile 13 default) |
| Compose folder | /opt/seafile |
| Data volume | /opt/seafile-data:/shared |
| Database volume | /opt/seafile-mysql/db:/var/lib/mysql |
| Caddy volume | /opt/seafile-caddy |
| Public ports | 80 (Let’s Encrypt validation), 443 (HTTPS) |
| Example domain | files.example.com |
| First admin | from INIT_SEAFILE_ADMIN_EMAIL and INIT_SEAFILE_ADMIN_PASSWORD in .env |
| Restart | unless-stopped |
Final checklist
- ☐ The
seafile,seafile-mysql, andseafile-rediscontainers are running. - ☐ The log shows
Seafile server startedandSuccessfully created seafile admin. - ☐
https://files.example.comopens with an HTTPS padlock and admin sign-in works. - ☐ One library exists, and one file uploaded and downloaded back successfully.
- ☐ A sync client on one device is connected to the correct server address.
- ☐ All three data folders are backed up before the next update.
Which library will you sync first — work documents, a photo archive, or project files? Tell us in the comments, since the answer decides whether one library is enough or you need separate libraries per team and file type.
Read also: the Rnevio article “How to Install Nginx Proxy Manager on a VPS with Docker: Reverse Proxy and Automatic SSL from the Web UI” explains a UI-based reverse proxy alternative if you prefer managing domains from a panel, while the File Browser guide to managing server files from a browser fits better if what you actually need is a lightweight file manager without sync.
Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar