Home | Send Feedback

Self-host Seafile

Published: February 04, 2019  •  Updated: February 01, 2022  •  selfhost

Seafile is an open-source file sync and share software. 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). I'm testing this on the smallest Hetzner server offering (CX11) with 2GB of RAM and 20GB of disk space. If you are looking for a VPS with much more disk space, I recommend looking at Contabo. The smallest Contabo VPS presently (February 2022) for EUR 4.99 / month includes a 200 GB SSD.

In this tutorial, I will install the free Community Edition of Seafile. There is also a Pro Edition, which is also free for up to 3 users, but for this tutorial, I don't need the additional features of the Pro Edition. Check out this page to see the differences between Community and Pro Edition.


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 a AAAA record if the server has a public IPv6 address.

sea.rasc.ch.        86400   IN      A

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"


I run all the following commands as a root user on a Debian 11. 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 full-upgrade

The easiest way to install Seafile is with Docker. Install Docker following the installation instructions on this web page:

Test the Docker installation with docker run hello-world. You should see the Hello from Docker! message if everything is set up correctly.

We also need to install docker compose.

mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose

Check if it works

$ docker compose version
Docker Compose version v2.2.3

You don't have to use Docker. Instead, you can install Seafile directly on Linux. Doing it the manual way gives you complete control over the Seafile installation.

Visit the official documentation page for more information about this topic:


Download the Seafile docker-compose.yml to your server. Open it in an editor.

mkdir /opt/seafile
cd /opt/seafile
curl -o docker-compose.yml https://download.seafile.com/seafhttp/files/e9f11f66-ef7c-4b9d-b107-a9f2ce57a6d0/docker-compose.yml
nano docker-compose.yml

You should change

Here is the complete docker-compose.yml I used for this demo installation.

version: '2.0'
    image: mariadb:10.5
    container_name: seafile-mysql
      - MYSQL_ROOT_PASSWORD=do_not_use_this_password_change_me
      - MYSQL_LOG_CONSOLE=true
      - /opt/seafile/db:/var/lib/mysql
      - seafile-net

    image: memcached:1.5.6
    container_name: seafile-memcached
    entrypoint: memcached -m 256
      - seafile-net

    image: seafileltd/seafile-mc:latest
    container_name: seafile
      - "8000:80"
      - /opt/seafile/data:/shared
      - DB_HOST=db
      - DB_ROOT_PASSWD=do_not_use_this_password_change_me
      - TIME_ZONE=Etc/UTC
      - SEAFILE_ADMIN_EMAIL=me@rasc.ch
      - SEAFILE_ADMIN_PASSWORD=a_very_secret_password_change_me
      - SEAFILE_SERVER_HOSTNAME=sea.rasc.ch
      - db
      - memcached
      - seafile-net


By default, Seafile listens on ports 80 and 443 and automatically configures a Let's Encrypt certificate. But in this installation, I wanted to install it on a server where a Caddy server was already installed that listens on ports 80 and 443. Therefore I changed the port mapping in the docker-compose.yml ("8000:80"), so Seafile listens on port 8000.

If you want to follow my installation and also use Caddy, install Caddy following the instructions on this page:

Open the Caddy configuration.

nano /etc/caddy/Caddyfile

and paste the following configuration

    email <valid_email_address_for_lets_encrypt>

sea.rasc.ch {

Change the domain name. Restart Caddy with the command systemctl restart caddy.

Again, this is optional. Seafile can directly listen on ports 80 and 443 and configure the TLS certificate. But the setup with Caddy allows you to host multiple services on one server.

Start the Seafile containers.

docker compose up -d

Open a browser and enter the domain name. Seafile should greet you with the login screen.

seafile web login

Log in with the configured admin email and password.

If you are interested in installing the Pro Edition, visit this page:


You can up and download files over the web interface, but installing a client is more convenient. Here I installed the Windows syncing client. You find all provided clients on the download page:

The first time you start a native client, he presents a dialog where you must enter the server address and your login credentials.

client login

seafile client

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.


It is recommended to update Seafile from time to time. Run the following commands manually or create a scheduled job that does it automatically.

docker pull seafileltd/seafile-mc:latest
cd /opt/seafile
docker-compose down
docker-compose up -d


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.

For a mission-critical Seafile installation, you should look at installing a Seafile cluster. Check out the following page for more information:

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": [
            "Resource": [

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 

In the /opt/seafile folder create a new file called backup-seafile.sh and paste the following code.

rm -fr /opt/seafile/backup
mkdir /opt/seafile/backup
cd /opt/seafile/backup
docker exec -it seafile-mysql mysqldump  -uroot --opt ccnet_db > ccnet_db.sql
docker exec -it seafile-mysql mysqldump  -uroot --opt seafile_db > seafile_db.sql
docker exec -it seafile-mysql mysqldump  -uroot --opt seahub_db > seahub_db.sql

cp -R /opt/seafile/data/seafile /opt/seafile/backup/data/
cd /opt/seafile/backup/data && rm -rf ccnet

cd /opt/seafile
rm -fr backup.tar.gz
tar czf backup.tar.gz backup

s3cmd --access_key=AK... --secret_key=cd... sync /opt/seafile/backup.tar.gz s3://rasc.seafile

rm -fr /opt/seafile/backup.tar.gz
rm -fr /opt/seafile/backup

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.

Description=Run seafile-backup once a day

OnCalendar=*-*-* 05:00:00


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:

Create the systemd service file seafile-backup.service and paste this code into the file



Then link these files into the systemd folder, reload systemd, start and enable the timer

ln -s /opt/seafile/seafile-backup.timer /lib/systemd/system/seafile-backup.timer
ln -s /opt/seafile/seafile-backup.service /lib/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 following page from the official documentation:

This concludes the tutorial about self-hosting Seafile. A powerful file sync software and a good alternative to Dropbox, Google Drive, and others.