Seafile with Raspberry PI: self-hosted and open source file&sync solution


Last Updated on 2nd September 2023 by peppe8o

In this tutorial, I’m going to show you how to install and configure Seafile with Raspberry PI by using Docker, which makes far simpler the installation procedure.

As files in your devices increase, a common limitation is having a cloud storage to get your files securely stored and available for your access and collaboration. Common storage services (like Google Drive or One Drive) give you few space compared with modern needs and require a fee for bigger GigaBytes. Seafile with Raspberry PI can give a cheap solution with cross device clients

What is Seafile

Seafile is an open-source file sync&share solution composed of server and client software. The server part makes your Seafile page available for access. In this tutorial, our Raspberry PI will run the server software. The client one lets you use Seafile from any external device. From clients, you can also use a simple web browser to explore your files and collaborate on them.

Seafile also adds a security layer to files stored on the server: they can be encrypted by a password chosen by you so that, also in case of external server hosting, even the system admin can’t view the files.

For this tutorial, I’m going to use a Raspberry PI 3 Model A+ computer board, but you can use these steps also with newer Raspberry PI computer boards.

If you need to access Seafile from the internet and you have a public IP to do this, you can use a No-IP free domain with my How to configure No-IP DUC service in your Raspberry PI, taking care to arrange the port forward in your home router for ports 80/443.

What We Need

raspberry pi 3 model A+

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if to continue with the project or remove them from the shopping cart. So, hardware will be only:

Check hardware prices with the following links:

Amazon raspberry pi boards box
Amazon Raspberry PI 3 Model A+ box
Amazon Micro SD box
Amazon Raspberry PI Power Supply box

Step-by-Step Procedure

Prepare Operating System

Start preparing your OS. Please note that we have to use a 64-bit OS in order to get MariaDB container directly available from Docker. Otherwise, we’ll need to modify our docker-compose file according to my Create a Custom MariaDB Container with Raspberry PI and Docker tutorial.

You can install Raspberry PI OS Lite (to get a faster, headless OS) or you can install Raspberry PI OS Desktop, in this case working from its internal terminal. For low ram Raspberry PI computer models, the Lite OS is strongly suggested.

A few more optimizations can be performed, expecially for Lite installations in RPI boards with RAM lower tha 1GB:

Make sure that your OS is updated. From terminal:

sudo apt update -y && sudo apt upgrade -y

Finally, install docker and docker-compose with the following tutorial: Setup a Docker environment with Raspberry PI OS Lite. The Portainer installation is not strictly required, but it is a good tool to try in order to manage your Docker environment.

Install Seafile

With docker and docker-compose available in your Raspberry PI, the Seafile installation becomes really simple. Please create a new folder in your Raspberry PI. This will include the docker-compose file. Consider that the containers created will take name prefix from this folder name, so I will use “Seafile” but you can use whatever name you prefer:

mkdir Seafile
cd Seafile

You can both get my docker-compose.yml template for Seafile with the following terminal command:


or you can create it manually:

nano docker-compose.yml

by pasting the following content inside it:

version: '2.0'
    image: mariadb:10.5
    container_name: seafile-mysql
      - MYSQL_ROOT_PASSWORD=db_pwd
      - MYSQL_LOG_CONSOLE=true
      - /opt/seafile-mysql/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
      - "80:80"
#      - "443:443"  # If https is enabled, cancel the comment.
      - /opt/seafile-data:/shared
      - DB_HOST=db
      - DB_ROOT_PASSWD=db_pwd
      - TIME_ZONE=Europe/Rome
      - SEAFILE_ADMIN_EMAIL=[email protected]
      - db
      - memcached
      - seafile-net


Before saving and closing, please edit at least the parts highlighted in red according to your preferences:

  • db_pwd: this sets the MariaDB database password for root access (first occurrence) and the password that Seafile container will use to access the DB (second occurrence). Both occurrences must have same value
  • TIME_ZONE=Europe/Rome: this sets the timezone for Seafile. You can get a list of timezones with correct strings with the following Wikipedia link:
  • [email protected] / my_pwd: these strings set the administrator account username and password to access the Seafile console. With these credentials, you can create new users and modify the Seafile server settings
  • SEAFILE_SERVER_LETSENCRYPT=false: this disables or enables https secure protocol. With “false” value, you can access seafile by using “http”. WIth “true”, you can use “https” access but you need to have a public IP address and domain to do it.
  • SEAFILE_SERVER_HOSTNAME= this sets the Seafile access IP or domain. If you have a domain, use it instead of IP address. If you don’t have a domain, you can use your Raspberry PI’s IP address. The is my RPI IP in my local network, so change this with your one.

Also note that this docker-compose configuration maps persistent volumes to your Raspberry PI storage in order to keep them saved even when containers are removed. These volumes will ve available in your /opt/ folder and will include the Seafile files (/opt/seafile-data/) and database files (/opt/seafile-mysql/). You can map these volumes to external storage to get more space, keeping care to make the external volume mounting always with the same path over reboots.

Once set and customized, save and close the docker-compose.yml file and Seafile can be completely installed with the following terminal command (run inside the “Seafile” folder):

docker-compose up -d

Wait for your RPI to download all the required docker images, it can take minutes depending also on your internet speed. When the terminal prompt comes back to you, you can check that all the containers are correctly running with the “docker ps -a” command:

pi@raspberrypi:~/Seafile $ docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS              PORTS                NAMES
764220fde392   seafileltd/seafile-mc:latest   "/sbin/my_init -- /s…"   About a minute ago   Up About a minute>80/tcp   seafile
8babbe34b8fc   memcached:1.5.6                "memcached -m 256"       2 minutes ago        Up About a minute   11211/tcp            seafile-memcached
f7dfbdc6327d   mariadb:10.5                   "docker-entrypoint.s…"   2 minutes ago        Up About a minute   3306/tcp             seafile-mysql

With low-grade Raspberry PI computers, the Seafile initialization can take a few more seconds. You can check if Seafile is ready and running by periodically issuing the docker command to inspect containers logs:

docker logs seafile

The following result will say you that Seafile is ready:

Seafile server started
Starting seahub at port 8000 ...

Successfully created seafile admin

Seahub is started

Access Seafile

From your local computer, use your favourite browser to access Seafile by using your domain or Raspberry PI’s IP:

Seafile login page

Please use the credentials set in your docker-compose.yml to access:

Seafile admin home

As you can see, a default library is already available for the very first tests. From the user menu you can both access the user Settings and the server administration page (System Admin):

Seafile admin home settings

By selecting the System Admin menu you will be able, besides other things, to manually add users

Seafile system admin users

But you can also allow users to self-register in your Seafile installation. To do this, please select “Setting” in the left sidebar menu (still in “System Admin”) and scroll down to activate the “allow new registration” option. A good way to manage user’s activation is by sending them the “activation email”. You can activate also this option, but the email configuration is not still ready (I’ll show you in next step how to configure it):

Seafile system admin settings

Please note that the “allow new registrations” will enable a Signup link in Seafile login page:

Seafile login page new registations allowed

Configure Seafile Email Sending with Gmail

Sending email from Seafile require an existing email account from an internet provider. As one of the most common is Google with its Gmail services, in this step we’ll use an existing Gmail account.

Because of Google security restrictions, you can’t use directly your Gmail address and password. So, before taking the next actions, do the following:

  1. go to your google account (
  2. Select Security
  3. Under “Signing in to Google,” select App Passwords
  4. At the bottom, choose Select app and choose Email and then select “Other” as device. Give a mnemonic name for this password app (for example “Seafile”) and then press Generate
  5. The password we’ll get is the 16-character code in the yellow bar. Please take note of it
  6. Click Done

With the app password generated, edit from your Raspberry PI terminal the Seahub settings file:

sudo nano /opt/seafile-data/seafile/conf/

append the following content at the end by editing only the values highlighted in red:

EMAIL_HOST_PASSWORD = 'my_google_app_password'

Save and close. With the terminal still in your Seafile folder from Raspberry PI, please issue the following command:

docker-compose restart

This will restart your Seafile installation also keeping the new configuration but maintaining the old files as they are stored in the (persistent) volumes created with docker-compose file. The same command can be used for whatever change you need to do in your Seafile settings.

The “docker logs seafile” command will allow you to check that everything went good and you can test it.

For our test, you can

  1. go to your Seafile home page
  2. enter the default library (My Library)
  3. press the share button appearing when moving the mouse on “seafile-tutorial.doc”
  4. In the next view, click directly the “Send” button
  5. Fill the recipient(s) email address and the message fields
  6. Click “Send”

The recipient(s) will receive an email like the following one:

Seafile share test email

Seafile Manual Pages

More customization settings can be found on the official Seafile server manual page.

What’s Next

Interested in more projects for your RPI? Take a look at peppe8o Raspberry PI computers tutorial!


How useful was this post?

Click on a star to rate it anonymously!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?