How to Deploy Seafile on a VPS
Updated Nov 2026
verified on Ubuntu 26.04 · Nov 2026Self-host Seafile Community Edition on a VPS with the official Docker Compose files, pinned images and Caddy HTTPS, with a database and data backup you can restore.
- A VPS with 2 GB+ RAM and 2 CPU cores (Seafile's stated minimum), plus disk for your files
- A fresh Ubuntu 26.04 server with root/sudo SSH access
- A domain or subdomain you can point at the server
What Seafile is
Seafile is file sync and share built around libraries: each library syncs separately, with delta transfers and resumable uploads. The Community Edition server core is AGPL-3.0 with an Apache-2.0 web UI. People use it as a self-hosted option next to Dropbox alternatives.
This guide uses upstream's own Compose files for Seafile 13: Seafile, MariaDB, Redis, SeaDoc and a Caddy proxy that handles HTTPS.
Server sizing
Seafile asks for at least 2 GB of RAM and 2 CPU cores, with 10 GB of disk available and more than 50 GB recommended. On the catalog's test box the idle stack used about 577 MB of RAM and the install 4.6 GB of disk. Your files come on top, so size the disk for them.
Prepare the server
Update the system, install the tools this guide uses, and open only SSH and the two web ports:
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y curl openssl ufw dnsutils jq
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
If you're logged in as root, create a non-root sudo user and continue as that user:
adduser deploy
usermod -aG sudo deploy
A published container port goes around ufw on a Docker host, so only what
should be public gets published below.
Paid link — we earn a commission if you shop through it.
Install Docker
The convenience script installs Docker Engine and the Compose plugin (the Docker and Compose on Ubuntu guide covers the details):
command -v docker >/dev/null || curl -fsSL https://get.docker.com | sudo sh
sudo docker compose version
Download the official files
Fetch the four files from the Seafile manual into /opt/seafile:
sudo mkdir -p /opt/seafile && sudo chown "$USER" /opt/seafile && cd /opt/seafile
[ -f .env ] || curl -fsSL -o .env https://manual.seafile.com/13.0/repo/docker/ce/env
curl -fsSL -o seafile-server.yml https://manual.seafile.com/13.0/repo/docker/ce/seafile-server.yml
curl -fsSL -o seadoc.yml https://manual.seafile.com/13.0/repo/docker/seadoc.yml
curl -fsSL -o caddy.yml https://manual.seafile.com/13.0/repo/docker/caddy.yml
chmod 600 .env
ls -l
Configure it
The stock .env ships floating image tags and placeholder passwords
(me@example.com / asecret for the admin). Pin the images, generate every
secret, and switch to HTTPS. Replace the hostname and email with yours. Run this
once: new database passwords on an existing install would lock Seafile out.
cd /opt/seafile
set_env() { sed -i "s|^$1=.*|$1=$2|" .env; }
set_env SEAFILE_IMAGE seafileltd/seafile-mc:13.0.30
set_env SEADOC_IMAGE seafileltd/sdoc-server:2.0.14
set_env SEAFILE_REDIS_IMAGE redis:8
set_env SEAFILE_SERVER_HOSTNAME seafile.example.com
set_env SEAFILE_SERVER_PROTOCOL https
set_env JWT_PRIVATE_KEY "$(openssl rand -hex 24)"
set_env SEAFILE_MYSQL_DB_PASSWORD "$(openssl rand -hex 16)"
set_env INIT_SEAFILE_MYSQL_ROOT_PASSWORD "$(openssl rand -hex 16)"
set_env REDIS_PASSWORD "$(openssl rand -hex 16)"
set_env INIT_SEAFILE_ADMIN_EMAIL admin@example.com
set_env INIT_SEAFILE_ADMIN_PASSWORD "$(openssl rand -hex 12)"
grep -E '^(SEAFILE_IMAGE|SEADOC_IMAGE|SEAFILE_SERVER_|INIT_SEAFILE_ADMIN_EMAIL)' .env
HTTPS + domain
Create an A record for your hostname pointing at the server's public IP and confirm it resolves, because Caddy needs that to get a certificate (see Automatic HTTPS with Caddy):
dig +short seafile.example.com
The proxy in caddy.yml is caddy-docker-proxy: it reads labels on the other
containers and requests the certificate itself. It needs the Docker socket
mounted for that, which gives the proxy container control of Docker; that is
how upstream ships it. Only the proxy publishes ports.
Start Seafile
cd /opt/seafile
sudo docker compose up -d
. <(grep '^SEAFILE_SERVER_HOSTNAME=' .env)
curl -s -f --retry 60 --retry-delay 5 --retry-all-errors "https://$SEAFILE_SERVER_HOSTNAME/api2/ping/"; echo
sudo docker compose ps
"pong" over HTTPS means the server is up and the certificate is valid. The
first start initialises the databases, so it takes longer.
Secure first login
The admin account was created from .env on first start. Print the password,
then sign in at https://seafile.example.com:
grep '^INIT_SEAFILE_ADMIN' /opt/seafile/.env
Check from the server that the credentials work:
cd /opt/seafile
. <(grep -E '^(SEAFILE_SERVER_HOSTNAME|INIT_SEAFILE_ADMIN_)' .env)
curl -s -f --data-urlencode "username=$INIT_SEAFILE_ADMIN_EMAIL" --data-urlencode "password=$INIT_SEAFILE_ADMIN_PASSWORD" \
"https://$SEAFILE_SERVER_HOSTNAME/api2/auth-token/" | jq -e '.token | length > 0'
Change the password in the web UI, turn on two-factor authentication if you want
it, and create separate accounts for other people. Then add a library, upload a
file, and connect the desktop client to the same https:// address.
Backups
Seafile's manual says to back up the databases first, then the data
directory, which avoids a database that points at files the copy does not
have. Keep .env with them: it holds the keys and passwords.
The block runs in a subshell that stops at the first error. Only a run that ends
with BACKUP OK is a complete backup; a failed dump leaves the previous .sql
file in place.
(
set -eo pipefail
sudo mkdir -p /opt/seafile-backup
sudo chmod 700 /opt/seafile-backup
for db in ccnet_db seafile_db seahub_db; do
sudo docker exec seafile-mysql sh -c "exec mariadb-dump -uroot -p\"\$MYSQL_ROOT_PASSWORD\" --opt $db" |
sudo tee /opt/seafile-backup/$db.sql.part >/dev/null
sudo mv /opt/seafile-backup/$db.sql.part /opt/seafile-backup/$db.sql
done
sudo rsync -aHAX --delete /opt/seafile-data/seafile/ /opt/seafile-backup/data/
sudo cp /opt/seafile/.env /opt/seafile/*.yml /opt/seafile-backup/
sudo ls -lh /opt/seafile-backup
echo "BACKUP OK"
)
rsync is incremental, so repeat runs only copy changes. Copy
/opt/seafile-backup off the server; a copy on the same disk is not a backup.
To restore, stop the application, load the three dumps, copy the data back and
start again. This overwrites current data. On a new server, first copy
.env and the .yml files into /opt/seafile and start the stack once.
(
set -eo pipefail
cd /opt/seafile
for db in ccnet_db seafile_db seahub_db; do sudo test -s /opt/seafile-backup/$db.sql; done
sudo test -d /opt/seafile-backup/data
sudo docker compose stop seafile seadoc
for db in ccnet_db seafile_db seahub_db; do
sudo cat /opt/seafile-backup/$db.sql |
sudo docker exec -i seafile-mysql sh -c "exec mariadb -uroot -p\"\$MYSQL_ROOT_PASSWORD\" $db"
done
sudo rsync -aHAX --delete /opt/seafile-backup/data/ /opt/seafile-data/seafile/
sudo docker compose up -d
. <(grep '^SEAFILE_SERVER_HOSTNAME=' .env)
curl -s -f --retry 60 --retry-delay 5 --retry-all-errors "https://$SEAFILE_SERVER_HOSTNAME/api2/ping/"
echo
echo "RESTORE OK"
)
The block stops at the first error, so a failed database load leaves Seafile
stopped and the data directory untouched. Fix the cause and run it again. After
RESTORE OK, open a library and download a file to confirm its contents.
Upgrades
For a release within 13.0, back up, then change SEAFILE_IMAGE in .env to the
new pinned tag (and SEADOC_IMAGE if there is a newer 2.0 build) and recreate:
cd /opt/seafile
sudo docker compose pull
sudo docker compose up -d
sudo docker compose logs --tail 20 seafile
A major upgrade is different: new Compose files and .env changes. Follow
Seafile's Docker upgrade notes
for that, and do not simply change the tag.
Troubleshooting
No certificate. Check DNS and any provider firewall for ports 80 and 443,
then read sudo docker compose logs caddy.
502 right after start. Initialisation is still running; read
sudo docker compose logs seafile.
Database access denied. .env was changed after the database was created.
Put the original passwords back.
docker compose says no configuration file. Run it from /opt/seafile,
where .env lists the three Compose files.
Verification + next steps
This guide's run checked HTTPS, the admin login through the API, and a restore that brought back a deleted library and its file. The web UI, the desktop client and a version change were not tested.
You're done when the site loads over a valid certificate, a file syncs from the desktop client, and you have restored a backup once. See the Seafile entry for catalog details and Best VPS for self-hosting for server picks.
Next steps
Common questions
How long does it take to follow "How to Deploy Seafile on a VPS"?
We estimate about 45 minutes of hands-on time for "How to Deploy Seafile on a VPS"; this is an editorial estimate, not a measurement.
Was the "How to Deploy Seafile on a VPS" guide tested?
The "How to Deploy Seafile on a VPS" guide was verified end-to-end on Ubuntu 26.04 (Nov 2026).