Seafile

Seafile is an enterprise file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk.


Note

For this guide you should be familiar with the basic concepts of

License

All relevant legal information can be found here

Prerequisites

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

Your URL needs to be setup:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Installation

Download

Check the Seafile website for the latest Server for generic Linux release, copy the download link and replace the URL in the following command with the one you just copied.

[isabell@stardust ~]$ mkdir seafile
[isabell@stardust ~]$ cd seafile/
[isabell@stardust seafile]$ curl https://download.seadrive.org/seafile-server_8.0.7_x86-64.tar.gz | tar xzf -
[isabell@stardust seafile]$

Install dependencies

Install the required python libraries.

[isabell@stardust seafile]$ pip3 install --upgrade pip Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient --user
[isabell@stardust seafile]$

Create databases

Create the needed MySQL databases as the installer file won’t work on uberspace.

[isabell@stardust seafile]$ mysql -e "create database ${USER}_ccnet character set = 'utf8';"
[isabell@stardust seafile]$ mysql -e "create database ${USER}_seafile character set = 'utf8';"
[isabell@stardust seafile]$ mysql -e "create database ${USER}_seahub character set = 'utf8';"
[isabell@stardust seafile]$

Run installer

Run the seafile installer script.

[isabell@stardust seafile]$ cd ~/seafile/seafile-server-*
[isabell@stardust seafile-server-8.0.7]$  ./setup-seafile-mysql.sh

Important answers:

Warning

Replace isabell with your username!

-------------------------------------------------------
Please choose a way to initialize seafile databases:
-------------------------------------------------------

[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases

[ 1 or 2 ] 2

Which mysql user to use for seafile?
[ mysql user for seafile ] isabell

Enter the existing database name for ccnet:
[ ccnet database ] isabell_ccnet

verifying user "isabell" access to database isabell_ccnet ...  done

Enter the existing database name for seafile:
[ seafile database ] isabell_seafile

verifying user "isabell" access to database isabell_seafile ...  done

Enter the existing database name for seahub:
[ seahub database ] isabell_seahub

verifying user "isabell" access to database isabell_seahub ...  done

Configure

Enter your domain name in config; Edit ~/seafile/conf/ccnet.conf

Warning

Replace isabell with your username!

SERVICE_URL = https://isabell.uber.space/

Change gunicorn config; Edit ~/seafile/conf/gunicorn.conf.py and change the bind = line to:

bind = "0.0.0.0:8000"

Change seahub config; Edit ~/seafile/conf/seahub_settings.py and add the following lines:

Warning

Replace isabell with your username!

SITE_BASE = 'https://isabell.uber.space'
SITE_NAME = 'isabell.uber.space'

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

FILE_SERVER_ROOT = SITE_BASE + '/seafhttp'
CSRF_TRUSTED_ORIGINS = [SITE_NAME]

#redirect to $USER tmp, avoid conflict with other users
CACHE_DIR = "/home/isabell/seafile/tmp/logs"

import os

CACHES = {
  'default': {
    'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
    'LOCATION': os.path.join(CACHE_DIR, 'seahub_cache'),
    'OPTIONS': {
      'MAX_ENTRIES': 1000000
    }
  }
}

Expose

Note

Seafile is running on multiple ports. You’ll need a backed at / for gunicorn on port 8000 and another backend on /seafhttp for the fileserver on port 8082. The latter also needs the parameter --remove-prefix.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Finishing installation

Restart seafile and seahub

[isabell@stardust ~]$ cd ~/seafile/seafile-server-latest
[isabell@stardust seafile-server-latest]$ ./seafile.sh restart
[isabell@stardust seafile-server-latest]$ ./seahub.sh restart
[isabell@stardust seafile-server-latest]$

With starting seahub for the first time, you have to create an admin account.

Now you can point your browser to your domain and login with your admin account.

Updates

Updating seafile is pretty easy. First update the pip3 packages, then download the new version and untar the new package into the “seafile” directory you created during the installation, recreate the symlink to the latest version and restart seafile and seahub after that.

[isabell@stardust ~]$ pip3 install --upgrade pip Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient --user
[isabell@stardust ~]$ cd ~/seafile/
[isabell@stardust seafile]$ curl https://download.seadrive.org/seafile-server_8.0.7_x86-64.tar.gz | tar xzf -
[isabell@stardust seafile]$ ln -sfn /home/seafile/seafile/seafile-server-8.0.7 /home/seafile/seafile/seafile-server-latest
[isabell@stardust seafile]$ cd seafile-server-latest
[isabell@stardust seafile-server-latest]$ ./seafile.sh restart
[isabell@stardust seafile-server-latest]$ ./seahub.sh restart

Tested with seafile-server-8.0.7, Uberspace 7.11.3.0

Written by: Finn <mail@f1nn.eu>