Install Seafile Server on Raspberry Pi – Instructions

Try Amazone Prime for free before Christmas:


A RaspberryPi (for example, the “Starter Kit“)* is available, the operating system “Raspian” is installed and of course connected to the network. You know the IP address of the RaspberryPI. You can find them in your router or enter them in the console ifonfi
g. SSH access is enabled. I always put an empty file named “ssh” in the boot partition. Then we install Seafile.


Log in to the Raspi by SSH – ssh pi@raspberrypi (password: raspberry)

At the first start, I recommend running the sudo raspi-config command and changing both the host name and password.

Create a new user “Seafile”, switch to this user and enter the main directory:

sudo useradd -m -p seafile -s /bin/bash seafile
sudo su seafile

Back in the browser go to and click on the link “Latest version” in the “Server” section of Server for Raspberry Pi, then copy the link to the file seafile-server_7.0.3_stable_pi.tar.gz (as of 25.07.2019)

Download, unzip and move the file to the “installed” folder and leave Seafile users:

tar xfz seafile-server_7.0.5_stable_pi.tar.gz
mkdir installed
mv seafile-server_7.0.5_stable_pi.tar.gz installed/

Install required programs:

sudo apt update
sudo apt install python2.7 libpython2.7 python-setuptools python-ldap python-mysqldb python-memcache python-urllib3 python-pil python-certifi python-idna python-requests mariadb-server-10.0 sqlite3

MySQL Root Password Set:

sudo mysql -u root
update mysql.user set password=password('secret') where user='root';
update mysql.user set plugin='' where user='root';
flush privileges;

Go back to the Seafile user, switch to folders, and run Setup:

sudo su seafile
cd seafile-server-7.0.5

You will now be asked for some information, which are self-explan
atory: Server name: Name of the Seafile server (fre
e to assign) Server IP: IP address of the Raspberry (which you should know or look in
your router) Seafile data dir: Path to location (can we also La
ter change) Fileserver port: Port of the server (co
firm with Enter) If you are asked how to create the databases, you select “1” to generate new databases. During the setup, you will also be asked for the root password, which you have previously set. In addition, the new user “seafile” is created. You also need to set a password for this one. The rest can be confidently confirmed with Enter.

You can start and stop seafile now (if you are as a user seafile in the folder /seafile-server-latest/):

./ start/ stop / restart
./ start/ stop / restart

A first start should be done as you are asked for admin credentials and Seafile is fully set up.

If you are expecting the data to be stored on an external hard drive*, as it probably has significantly more storage capacity than the SD card, please click the following link: Prepare external hard drive for Seafile.

Fast webspace

Set up autostart

We leave user Seafile with “exit” and now create the autostarts, so that Seafile starts automatically every time the Raspberry starts. To do this, we will create two files below and activate them according to the official instructions of Seafile (

sudo nano /etc/systemd/system/seafile.service

Insert and save the following with Ctrl + O and close with Ctrl + X:

add mysql.service or postgresql.service depending on your database to the line below

ExecStart=/home/seafile/seafile-server-latest/ start
ExecStop=/home/seafile/seafile-server-latest/ stop


This was Seafile, now comes Seahub (web interface):

sudo nano /etc/systemd/system/seahub.service

Insert and save the following with Ctrl + O and close with Ctrl + X:

Description=Seafile hub seafile.service

change start to start-fastcgi if you want to run fastcgi
ExecStart=/home/seafile/seafile-server-latest/ start
ExecStop=/home/seafile/seafile-server-latest/ stop


Now activate the two create files:

sudo systemctl enable seafile seahub

You can now control seafile as pi-user with:

sudo systemctl start/stop/restart seafile seahub

To control as pi-user you would first have to stop seafile and seahub as user seafile:

sudo su seafile
cd seafile-server-latest
./ stop
./ stop

Now you have installed a functional cloud server. This is currently only accessible locally. Below we install nginx as a web server and set up an SSL certificate.

Business Webspace

Installing and setting up NginX

First, we install web server nginx and adapt it to seafile:

sudo apt install nginx
sudo nano /etc/nginx/sites-available/seafile.conf

Enter the following configuration and save it with Ctrl + O and close it with Ctrl + X:

    list 80;
    server_name _;

    proxy_set_header X-Forwarded-For $remote_addr;

    location /
         proxy_set_header host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded host $server_name;
         proxy_read_timeout 1200s;

         Used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log /var/log/nginx/seahub.access.log;
         error_log /var/log/nginx/seahub.error.log;

If you are using ([FastCGI],
Which is not recommended, you should use the following config for location '/'.
• location /
• fastcgi_pass;
• fastcgi_param SCRIPT_FILENAME $document_root-fastcgi_script_name;
• fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
• fastcgi_param QUERY_STRING $query_string;
• fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
• fastcgi_param CONTENT_LENGTH $content_length;
• fastcgi_param SERVER_ADDR $server_addr;
• fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
• fastcgi_param REMOTE_ADDR $remote_addr;
• fastcgi_read_timeout 36000;
• client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log;
• error_log /var/log/nginx/seahub.error.log;
#    }

    location /seafhttp
        rewrite s/seafhttp(.*)- 1 break;
        client_max_body_size 0;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout 36000s;
        proxy_read_timeout 36000s;
        proxy_send_timeout 36000s;

        send_timeout 36000s;
    location /media
        root /home/seafile/seafile-server-latest/seahub;

Then we delete the two “default” files and create a link to our created configuration:

sudo rm /etc/nginx/sites-enabled/default
sudo rm /etc/nginx/sites-available/default
sudo ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf

We test the configuration (should play successful), reload nginx and adjust the Seafile configuration:

sudo nginx -t
sudo nginx -s reload
sudo su seafile
cd conf
nano ccnet.conf

After “SERVICE_URL” remove the colon 8000. The only example is (or your IP address of the RaspberryPi):


Ctrl O + Ctrl + X for save and close. Then insert a line in seahub_settings (also here please adjust your IP):


Seafile users leave and restart Seafile:

sudo systemctl restart seafile seahub
Hosted on a Bitpalast server

4 thoughts on “Install Seafile Server on Raspberry Pi – Instructions”

  1. Hi Stephan, thanks for the good post.. though it would have been more complete if you included how to install it on Apache (instead or in addition to nginx).

  2. Hi, thanks it works ok. I’m trying to use Webdav access (Seafdav) but I can’t get it to work.
    Could you give a hand here?.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.