Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 8 - Install Seafile Server 6.x

This is a "refresh" of my previous tutorial on setting up a seafile server on Debian 7 (somehow I missed 8). Some things have changed, like the ability to use ffmpeg to genereate thumbnails for video files, but it's mostly the same.


Update And Install Packages

Run the following commands:

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

sudo apt-get install -y \
  python2.7 \
  python-setuptools \
  python-imaging \
  python-ldap \
  python-mysqldb \
  python-urllib3 \
  python-simplejson \
  python-memcache \

FFmpeg and MoviePY

The seafile manual states that if you upgrade from 6.0 and you'd like to use the feature video thumbnail, you need to install FFmpeg, as well as the pillow and moviepy packages. Unfortunately, I have not been able to fingure out how to get moviepy installed successfully on Debian 8, but will update this if I ever do figure it out. Luckily this functionality is optional so we will skip it for now.

Install MySQL Database

If you have a MySQL or MariaDB database already deployed that you wish to use, just skip this section.

The Seafile docs don't appear to specify which versions of MySQL should be used, but I'm pretty sure it will work perfectly well with any version higher than 5.5 or even a MariaDB alternative. If you are unsure, use my guide to install MySQL 5.6 on Debian 8. I have other servers deployed that are using it, so I know it works.

Download And Install Seafile

cd $HOME

# extract the download
tar --extract --gzip --file seafile-server*

# remove the compressed file
rm seafile-server*.tar.gz

Create Seafile Database And User

Login to your database with your root user and run the following queries in order to create the seafile database and user.

GRANT ALL on seafile.* to seafile@localhost identified by 'mySeafileUserPasswordHere';

Be sure to change the mySeafileUserPasswordHere text for the password to something else!

Run The Setup Script

cd seafile-server-*

Install Nginx

The seafile manual wants us to install nginx 1.8+ but unfortunately, if you just install the nginx package as-is, you will get version 1.6.2, so follow this tutorial on installing the later version from dotdeb.

Configure Seahub To Use Nginx

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

Copy/paste the following chunk into the file at /etc/nginx/sites-enabled/seafile.conf.

server {
    listen 80;

    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 ^/seafhttp(.*)$ $1 break;
        proxy_request_buffering off;
        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 /full/path/to/seafile-server-latest/seahub;

Make sure to change to whatever your server's hostname is, and replace /full/path/to/seafile-server-latest/seahub (towards the bottom), with the relevant path.

Now reload nginx:

sudo nginx -s reload

Change Seafile Settings To Use Nginx

Navigate to your conf directory.

cd $HOME/conf

Now edit your ccnet.conf file so that the SERVICE_URL no longer has the :8000. For example:


Now edit your file and add the following line (changing it for whatever your server's hostname is):


Start/Stop Scripts

Copy/paste the following script for starting seafile somewhere that you will find it and can execute it. E.g. I stick it at $HOME/

/bin/bash $HOME/seafile-server-latest/ start
/bin/bash $HOME/seafile-server-latest/ start

Copy/paste the following script for stopping seafile somewhere that you will find it and can execute it. E.g. I stick it at $HOME/

/bin/bash $HOME/seafile-server-latest/ stop
/bin/bash $HOME/seafile-server-latest/ stop

Start Seafile

Run the script to start seafile. Since this is the first time you have started seafile, you will be promped for the admin's email address and password. This will be the login credentials for the first administrator in the system.

Once seafile has started, you should be able to connect to it in your browser at the hostname, and also be able to connect to it using the client.

Block Off Port 8000

I was having issues with my Seafile server becoming unresponsive until I made sure to use my firewall to block off port 8000. It appears if anyone connects directly rather than through the reverse proxy, your seafile server can become unresponsive so be sure to block off port 8000 to the outside world.

Optional - Add Memcached

I am pretty sure I have got something wrong with these instructions for setting up memcached for seafile 6.2, but mostly there. I would recommend combining these instructions with the official docs.

Stop seafile if its running

/bin/bash $HOME/seafile-server-latest/ stop
/bin/bash $HOME/seafile-server-latest/ stop

Install the necessary packages

sudo apt-get install libz-dev -y
sudo apt-get install python2.7-dev -y
sudo apt-get install libmemcached-dev memcached -y
sudo apt-get install python-pylibmc -y

sudo pip install --upgrade pylibmc
sudo pip install django-pylibmc

Now edit your configuration file.

vim conf/

Add/Append the following:

    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '',
    'locmem': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',

Start seafile

/bin/bash $HOME/seafile-server-latest/ start
/bin/bash $HOME/seafile-server-latest/ start


You now have a seafile server running that uses a MySQL database and an Nginx webserver. In future we will show you how to set up memcached and SSL certificates.


Last updated: 2nd September 2018
First published: 29th August 2018