From ArchWiki
Jump to navigation Jump to search

Seafile is an open source cloud storage system, with advanced support for file syncing, privacy protection and teamwork.

Collections of files are called libraries, and each library can be synced separately. A library can be encrypted with a user chosen password. This password is not stored on the server, so even the server admin can't view your file contents.

Seafile lets you create groups with file syncing, wiki, and discussion -- enabling easy collaboration around documents within a team.



Install seafile-serverAUR from the Arch User Repository

As root, add a new user to run seafile server instances under:

# useradd -m -r -d /srv/seafile -s /bin/nologin seafile

Setup a server instance

Change to the user previously setup in #Installation (following commands are to be executed as that user unless otherwise stated):

$ sudo -u seafile -s /bin/sh

As that user, create the directory layout for the new seafile server instance and change directory to it:

$ mkdir -p $HOME/
$ cd $HOME/

Note: Replace every occurence of '' on this page with the actual domain of your new server instance

Determine the appropriate seahub version (it will be shown in the format 'x.y.z-r', e.g. 3.0.2):

$ pacman -Qi seafile-server | grep Version

Set the SEAFILE_SERVER_VERSION variable to the 'x.y.z' retrieved in the previous step:


Download seahub and extract it:

$ wget -P seafile-server$SEAFILE_SERVER_VERSION-server.tar.gz
$ tar -xz -C seafile-server -f seafile-server/v$SEAFILE_SERVER_VERSION-server.tar.gz

Rename the extracted directory:

$ mv seafile-server/seahub-$SEAFILE_SERVER_VERSION-server seafile-server/seahub

To create the configuration for the seafile server instance, run

$ seafile-admin setup

and follow the instructions now showing on your screen. See the seafile wiki for a detailed explanation of the seafile-admin script.

Now, copy the systemd service for seafile 'seafile-server@.service' from /usr/lib/systemd/system/ to /etc/systemd/system and replace the two occurences of '%h' in it with the actual $HOME for the user setup in #Installation.

To manually start your new seafile server, run as root:

# systemctl start

To automatically start your new seafile server at system startup, run as root:

# systemctl enable

Deploy an instance with Nginx

In order to deploy Seafile's webinterface "seahub" with Nginx, you can use an Nginx configuration similar to this:

server {
    listen 80;
    rewrite ^/(.*) https://$server_name/$1 permanent;   # force redirect http to https

server {
    listen 443;
    ssl on;
    ssl_certificate /etc/ssl/certs/;
    ssl_certificate_key /etc/ssl/private/server.key;

    location / {
        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   HTTPS on;
        fastcgi_param   HTTP_SCHEME https;

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        client_max_body_size 0;

    location /media {


First, stop each of your seafile server instances (repeat for,, etc.) as root:

# systemctl stop

Upgrade seafile-serverAUR from the Arch User Repository.

Become the user the seafile server instances run as (following commands are to be executed as that user unless otherwise stated):

$ sudo -u seafile -s

Repeat the following for each seafile server instance:

Change directory to the server instance's 'seafile-server' subdirectory:
$ cd /srv/seafile/
Run the preupgrade script (Or do the steps by hand, see the Seafile wiki):
$ seahub-preupgrade
Run the appropriate seafile/seahub upgrade script from the upgrade subdirectory:
For a minor upgrade (x.y.a to x.y.b with a < b):
$ ./upgrade/
For a major upgrade (x.y.a to z.w.b with x < z || y < w):
$ ./upgrade/

Lastly, start each of your seafile server instances again (repeat for,, etc.) as root:

# systemctl start