Installing Seafile on the Raspberry Pi

In this project, we will be showing you how to install Seafile on the Raspberry Pi.

Raspberry Pi Seafile

Seafile is an open-source file hosting software that can run on the Raspberry Pi.

This service allows you to have a central place to upload your files. It then allows you to synchronize these files to any other the supported Seafile clients.

One of the advantages of using a file hosting solution such as Seafile is that you retain control of your data. You don’t have to put your trust in a service like Google Drive or Dropbox to respect your privacy.

There are two different versions of Seafile that you can use. One is the free community edition, and the other is the paid enterprise release. In this guide, we will focus purely on the community version.

You can find a comparison between the community and enterprise editions on Seafile’s website.

Seafile is similar to other self-hosted file hosting services you can run on your Raspberry Pi, such as Owncloud and Nextcloud. However, Seafile has more of a focus on being a file hosting service, rather than replicating the experience of Google Drive and Onedrive. If you are just after file hosting, Seafile is definitely the less bloated experience.

Please note you must be running a 64-bit version of Raspberry Pi OS for this guide to work. The Docker image we use for Seafile does not support 32-bit operating systems.

Equipment

Below is a list of the equipment we used while installing Seafile onto the Raspberry Pi.

Recommended

Optional

This tutorial was last tested on a Raspberry Pi 400 running a 64-bit version of Raspberry Pi OS Bookworm.

How to Install Seafile on the Raspberry Pi

Over the following steps, we will be walking you through the process of installing Seafile onto your Raspberry Pi.

To greatly simplify the setup process, we will be utilizing Docker. The advantage of using Docker is that we don’t have to spend ages installing and configuring multiple services.

Additionally, you don’t have to stress about your Seafile setup potentially conflicting with other software you are running on your Pi. Seafile and its dependencies are all kept in their isolated container.

Preparing your Raspberry Pi for Seafile

1. Before we begin, we must update the package list and upgrade any out-of-date packages

You can perform both tasks using the following two commands in the terminal.

sudo apt update
sudo apt upgrade -y

2. Once the system finishes updating, you must install Docker on your Raspberry Pi.

The guide we link above walks you through all the steps to installing and configuring Docker on the Pi.

3. After installing Docker, our next step is to create a directory to store our Seafile Docker compose file.

You can create a directory called “seafile” within your home directory by using the following command.

mkdir ~/seafile

By using the tilde (~), we are referring to the current user’s home directory.

4. After creating a directory for Seafile, change into it by running the command below within the terminal.

cd ~/seafile

Writing a Docker Compose File

5. We can now begin writing the Docker Compose file that will set up Seafile on our Raspberry Pi.

A compose file is like a set of instructions for Docker to execute. You can begin writing this file by using the command below. We use the nano text editor as it is relatively simple to use.

nano docker-compose.yml

6. Within this file, you will want to add the following lines.

However, while typing in these lines, there are various values that you must replace.

  • <DBPASSWORD>: The first thing you must set is the database password. Set this to something secure using letters, numbers, and symbols.

    You don’t have to remember this value yourself, as it’s used purely within the compose file.
  • <VOLUMEPATH>: Here is where you specify the full path to where you want Seafile to store its data, as well as the files you upload.

    You likely want this to be on an external hard drive, as an SD card typically isn’t the best place for storing data.

    If you want to try out Seafile without storing data on an external drive, you can use the directory “/opt/seafile-data“.
  • <TIMEZONE>: Your next step is to set the time zone for Seafile to utilize. By default, Seafile will set the timezone to UTC (ETC/UTC).

    You can find a list of tz database time zones by going to Wikipedia. The values you need are under the TZ Identifier column.

    For example, I live in Hobart, Australia, so I would use “Australia/Hobart” for this value.
  • <ADMINEMAIL>: Next, you must set the email you want to use for your admin account. You will be using this to log in to Seafile on your Raspberry Pi.
  • <ADMINPASSWORD>: The other thing you must do is set a password for your admin account.

    You will want to change this within Seafile’s web interface later but still set this to something secure.
  • <ENABLELETSENCRYPT>: If you plan on using HTTPS and have a domain name, you will want to set this value to “true“.

    Otherwise, if you aren’t using HTTPS or don’t have a domain name to use, set this to “false“.
  • <HOSTNAME>: Here is where you will specify the domain name you want to use to access your Seafile installation.

    If using this locally or without a domain name, you can set this to your local IP address. It is only used if the Letsencrypt option is set to true.
services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<DBPASSWORD>
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /opt/seafile-mysql/db:/var/lib/mysql
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net
          
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "80:80"
#     - "443:443"  #Remove hashtag if using HTTPS
    volumes:
      - <VOLUMEPATH>:/shared
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=<DBPASSWORD>
      - TIME_ZONE=<TIMEZONE>
      - SEAFILE_ADMIN_EMAIL=<ADMINEMAIL>
      - SEAFILE_ADMIN_PASSWORD=<ADMINPASSWORD>
      - SEAFILE_SERVER_LETSENCRYPT=<ENABLELETSENCRYPT>
      - SEAFILE_SERVER_HOSTNAME=<HOSTNAME>
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

Please note that if you are running other web services on your Raspberry Pi, you may want to change the port Seafile runs on. To do this find “80:80” within this file and change the number on the left-hand side. The value on the left is the port Docker will expose.

For example, if we wanted Seafile to run on port 8080 we would use “8080:80“.

7. After filling out this file, you can now save and quit by pressing CTRL + X, followed by Y, and then the ENTER key.

Starting Seafile on your Raspberry Pi

8. We are finally at the point where we can start Seafile on our Raspberry Pi.

All we need to do is use the following command. This command tells Docker to start the containers specified within the compose file we wrote.

When you first run this command, this process can take a few minutes. It needs to download and set up a container for Seafile, the SQL database, and memcached.

docker compose up -d

By using the “-d” option, we are also telling Docker to detach from the current terminal session. This allows Seafile to continue to run in the background.

Accessing the Seafile Web Interface

9. Now that we have gotten Seafile up and running on your Raspberry Pi, we can access its web interface.

To access this interface, you must know your Pi’s IP address. The easiest way to get this IP is to use the hostname command.

hostname -I

10. With your IP address now handy, go to the following address in your web browser.

If you had to change the default port away from the default “80“, you must add it to the end of the URL.

http://<YOURIPADDRESS>

11. You will now be greeted with the login screen for Seafile.

Start by typing in the email and password (1.) that you set within the Docker compose file earlier.

After filling out your details, click the “Login” button (2.).

Seafile Login Screen

12. You will now see the welcome screen. At this point you have successfully installed Seafile, on your Raspberry Pi. However, there is one task you should complete before using Seafile.

Welcome to Seafile on your Raspberry Pi

Updating your Password

13. One of the first things you must do is update your password. At the moment, you are using the one that is specified within the Docker compose file, which isn’t the most secure thing to be doing.

To begin this process, click your profile in the top-right corner (1.).

Next, you will want to click the “User Settings” option (2.) in the pop-up menu.

Open user settings screen

14. Now that you are on the user settings screen, scroll to the “Password” heading and click the “Update” button.

Open password setting screen

15. You can now set a new password for your admin account for your Raspberry Pi Seafile installation.

First, you must specify the current password for your account (1.).

Next, type in a new password that you will use to log in from now on (2.)

Finally, after completing your details, click the “Submit” button (3.).

Set new password for your Seafile admin account on the Raspberry Pi

16. At this point, you have successfully updated your password.

Password Successfully updated

Conclusion

Hopefully, you will have successfully installed Seafile on your Raspberry Pi and got it up and running.

Seafile is a decent self-hosted file hosting solution and an excellent alternative to the heavier Nextcloud and Owncloud solutions.

Please feel free to leave a comment below if you have any questions about installing Seafile on your Raspberry Pi.

If you found this tutorial to be helpful, be sure to check out our many other Raspberry Pi projects.

Leave a Reply

Your email address will not be published. Required fields are marked *