Seafile is an open-source file sync and share application. You can upload files and sync them across different devices. Seafile provides a web interface but also native clients for macOS, Linux, Windows, and for the mobile platforms Android and iOS. These clients share the files across different devices. Seafile also provides drive clients that enable you to access files on the server without syncing to a local disk, like a network drive.
You can use Seafile by subscribing to a hosting provider. But in this tutorial, I will show you how to self-host Seafile and install it on a VPS. For this example, I use a VPS from Hetzner (referral link). For a new installation, a currently orderable plan such as CX23 provides the 4 GB of RAM and 40 GB of disk space used by this setup. If you need substantially more storage, compare current offers from VPS providers.
In this tutorial, I will install the free Community Edition of Seafile. There is also a Pro Edition with additional administration and collaboration features. Basic LDAP integration is also available in the Community Edition; consult the current edition comparison for the features and licensing you need. Check out this page to see the differences between the Community and Pro Editions.
DNS ¶
Before setting up the server, I created a subdomain in the DNS configuration. This is needed if you want to use TLS, which is highly recommended. For this demo, I use the domain sea.rasc.ch.
In the web console of my DNS provider, I inserted an A record that points to the IP address of my VPS. Also, add an AAAA record if the server has a public IPv6 address.
sea.rasc.ch. 86400 IN A 51.38.124.133
If your DNS provider supports this feature, I also recommend adding a CAA record, either for the whole domain if you get all your certificates from one CA or just for the subdomain if you use multiple certificate authorities.
rasc.ch. 86400 IN CAA 0 issue "letsencrypt.org"
// OR
sea.rasc.ch. 86400 IN CAA 0 issue "letsencrypt.org"
Docker ¶
I run all the following commands as a root user on Debian 13. If you are not logged in as root, prepend sudo to the commands or switch to root with sudo -i.
First, make sure that the system is up to date.
apt update
apt dist-upgrade
The easiest way to install Seafile is with Docker. Install Docker following the installation instructions on this web page: https://docs.docker.com/engine/install/debian/
Seafile ¶
For the installation of Seafile I follow the description from this page:
https://manual.seafile.com/13.0/setup/setup_ce_by_docker/
mkdir /opt/seafile
cd /opt/seafile
# Seafile CE 13.0
wget -O .env https://manual.seafile.com/13.0/repo/docker/ce/env
wget https://manual.seafile.com/13.0/repo/docker/seadoc.yml
wget https://manual.seafile.com/13.0/repo/docker/ce/seafile-server.yml
wget https://manual.seafile.com/13.0/repo/docker/caddy.yml
chmod 600 .env
nano .env
Update the SEAFILE_SERVER_HOSTNAME config option.
SEAFILE_SERVER_HOSTNAME=sea.rasc.ch
SEAFILE_SERVER_PROTOCOL=https
Generate three random passwords using the following command:
openssl rand -base64 32
Then update the following passwords
JWT_PRIVATE_KEY=9ILkA...
SEAFILE_MYSQL_DB_PASSWORD=92c5...
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=mN8f...
Update the admin user email and password.
INIT_SEAFILE_ADMIN_EMAIL=me@example.com
INIT_SEAFILE_ADMIN_PASSWORD=myverylongsupersecretpassword
Start the Seafile containers.
docker compose up -d
Open a browser and enter the configured URL. Seafile should greet you with the login screen. Log in with the configured admin email and password.
If you are interested in installing the Pro Edition, visit the Seafile 13 Pro Docker guide:
https://manual.seafile.com/13.0/setup/setup_pro_by_docker/
Client ¶
You can upload and download files over the web interface, but installing a client is more convenient. Here, I installed the Windows syncing client. You can find all provided clients on the download page: https://www.seafile.com/en/download/
The first time you start a native client, it presents a dialog where you must enter the server address and your login credentials.


If you install a syncing client, it syncs the remote library to your local computer, and each time you add files locally, it syncs them to the remote server. On the other hand, a drive client enables you to access files without syncing to the local disk. It works like a network drive.
Upgrade ¶
Plan upgrades using the Seafile Docker upgrade guide. Back up and test recovery first, review the release notes, and pin the intended image versions in .env. Major upgrades can require new Compose files and migration steps; do not run an unattended pull job against floating tags. For an update whose documented migration steps are complete:
cd /opt/seafile
docker compose pull
docker compose up -d
docker compose logs --tail=100
Backup ¶
You usually don't have a backup on a VPS out of the box. Some VPS providers have snapshot tools where you can take a snapshot of the whole server.
A cluster can improve availability, but it does not replace independent backups: accidental deletion or corruption can affect every replica. For availability requirements, you can also look at installing a Seafile cluster. Check out the Seafile 13 cluster deployment guide for Docker: https://manual.seafile.com/13.0/setup/cluster_deploy_with_docker/
In this section, I show you a simple backup approach where a script runs once a day and copies everything to an Amazon S3 bucket.
If you want to follow this tutorial, create a user on AWS. Then, take a note of the access and secret key. This is the policy I attached to the user.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::rasc.seafile/*",
"arn:aws:s3:::rasc.seafile"
]
}
]
}
Also, create an S3 bucket. I created a bucket with the name rasc.seafile. Change this name in the policy and script to the bucket you created.
Install the Amazon S3 command-line tools.
apt install s3cmd
Configure S3 credentials interactively with s3cmd --configure, then restrict /root/.s3cfg to mode 600. Use a private bucket and a retention policy suitable for recovery; keep credentials out of the script and process arguments.
The database needs authentication too. Create /opt/seafile/backup-mysql.cnf as root with mode 600, using the actual database root password:
[client]
user=root
password=YOUR_DATABASE_ROOT_PASSWORD
Mount this file into the database container with an additional /opt/seafile/backup.yml Compose file:
services:
db:
volumes:
- /opt/seafile/backup-mysql.cnf:/run/secrets/backup-mysql.cnf:ro
Append ,backup.yml to the existing COMPOSE_FILE value in .env and run docker compose up -d db to apply the mount. Preserve the other Compose filenames and the configured comma separator.
The script below assumes the default Seafile 13 database names and /opt/seafile-data and /opt/seadoc-data volume paths from the supplied Compose files. Adjust these paths if you changed them. It briefly stops Seafile and SeaDoc while dumping the databases and archiving their data, then restarts them before sending the archive to S3. This gives the small installation a consistent backup with downtime; larger installations need a coordinated snapshot strategy.
In /opt/seafile/backup-seafile.sh, save:
#!/bin/sh
set -eu
umask 077
cd /opt/seafile
mkdir -p backups
chmod 700 backups
staging=$(mktemp -d /opt/seafile/backups/staging.XXXXXX)
archive="/opt/seafile/backups/backup-$(date -u +%Y%m%dT%H%M%SZ).tar.gz"
# Restart the application even when a dump or archive operation fails.
trap 'docker compose start seafile seadoc >/dev/null' 0
trap 'exit 1' HUP INT TERM
docker compose stop seafile seadoc
docker compose exec -T db mariadb-dump \
--defaults-extra-file=/run/secrets/backup-mysql.cnf \
--single-transaction --databases ccnet_db seafile_db seahub_db \
> "$staging/databases.sql"
cp .env seafile-server.yml caddy.yml seadoc.yml backup.yml \
backup-mysql.cnf "$staging/"
tar -czf "$archive" -C "$staging" . -C /opt seafile-data seadoc-data
docker compose start seafile seadoc
trap - 0 HUP INT TERM
s3cmd put "$archive" "s3://rasc.seafile/$(basename "$archive")"
# Remove only this run's temporary files, after a successful upload.
rm -f -- "$archive"
rm -rf -- "$staging"
-T disables terminal allocation for the scheduled database dump. set -e stops on failed commands, so a failed dump is not uploaded and a failed upload does not discard the local archive. Monitor the systemd job and available disk space: failed runs intentionally leave their files for investigation. The archive contains database passwords, application secrets, and user data; restrict access to it and test a restore on a separate installation using the matching image versions.
Make the script executable:
cd /opt/seafile
chmod 700 backup-seafile.sh
Next, install a timer service in systemd. This takes care of starting our backup job daily at a specified time.
Create a file seafile-backup.timer and paste this code into the file.
[Unit]
Description=Run seafile-backup once a day
[Timer]
OnCalendar=*-*-* 05:00:00
RandomizedDelaySec=30
Persistent=true
[Install]
WantedBy=timers.target
Change OnCalendar if you want to run this script at a different time or more often than just daily. See the documentation for information about the supported format:
https://man.archlinux.org/man/systemd.time.7.en
Create the systemd service file seafile-backup.service and paste this code into the file:
[Unit]
Description=backup-seafile
[Service]
WorkingDirectory=/opt/seafile
Type=oneshot
ExecStart=/opt/seafile/backup-seafile.sh
Then, link these files into the systemd folder, reload systemd, start, and enable the timer:
ln -s /opt/seafile/seafile-backup.timer /etc/systemd/system/seafile-backup.timer
ln -s /opt/seafile/seafile-backup.service /etc/systemd/system/seafile-backup.service
systemctl daemon-reload
systemctl start seafile-backup.timer
systemctl enable seafile-backup.timer
Check if the timer is installed correctly.
systemctl list-timers
Manually start the job.
systemctl start seafile-backup
journalctl -u seafile-backup
To recover a backup, check out the Seafile 13 backup & recovery documentation:
https://manual.seafile.com/13.0/administration/backup_recovery/?h=backup
This concludes the tutorial about self-hosting Seafile. A powerful file sync software and a good alternative to Dropbox, Google Drive, and others.