You can always find latest version of this guide on GitHub. If you find any bug, error or come up with some enhancements, please submit an issue or (preferably) pull request.


Following steps are going to be described in order to install and configure Seafile:

  1. Installing prerequisites
  2. Creating system user
  3. Deploying Seafile
  4. Database establishing (MySQL)
  5. Setting up init script
  6. Passing to reverse-proxy (nginx)

1. Installing prerequisites

If you haven’t already got it (depending on installation it might be missing in Debian), install sudo and update system:

su -c "apt-get update && apt-get upgrade && apt-get install sudo"

Install required packages:
(Note: you need to install sqlite3, cause setup is using it by default and MySQL is configured later on).

sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging python-flup python-mysqldb sqlite3

2. Creating system user

sudo adduser --disabled-login --gecos "Seafile" seafile

3. Deploying Seafile

Download Seafile for server:

cd /home/seafile
sudo -u seafile -H wget -c

I’m going to follow suggested by Seafile authors directory layout:

sudo -u seafile -H mkdir -p data seafile/installed
sudo -u seafile -H mv seafile-server_1.4.5_x86-64.tar.gz seafile/
cd seafile
sudo -u seafile -H tar -xzf seafile-server_1.4.5_x86-64.tar.gz
sudo -u seafile -H mv seafile-server_1.4.5_x86-64.tar.gz installed/

Setting Seafile up:

cd seafile-server-1.4.5/
sudo -u seafile -H sh

Check connections:

sudo -u seafile -H mysql -u seafile -p -D ccnet-db
sudo -u seafile -H mysql -u seafile -p -D seafile-db
sudo -u seafile -H mysql -u seafile -p -D seahub-db

Configure ccnet to use MySQL:

cd /home/seafile
sudo -u seafile -H vim seafile/ccnet/ccnet.conf

Append following configuration:


Configure Seafile to use MySQL:

sudo -u seafile -H vim data/seafile.conf

Replace existing database section with following:


Configure seahub to use MySQL:

sudo -u seafile -H vim seafile/

Append following lines:

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'seafile',
        'PASSWORD': '$password',
        'NAME': 'seahub-db',
        'HOST': '/var/run/mysqld/mysqld.sock',

Create DB structures:

sudo -u seafile -H seafile/seafile-server-1.4.5/ start

Synchronize DBs, create tables and create superuser:

This is one long step which involves couple of operations that need to be done in this particular order. So, at first there’s a switch to seafile user, next changing directory to get into seahub application main directory. Following step is passing environment settings and issuing syncdb to fill in DBs with needed tables. Lastly, there’s superuser creation (this is going to be the first user for your Seafile app), leaving seafile environment, going to app install directory and launching it (this can be done cause in previous step there was seafile server started).

sudo su - seafile
cd seafile/seafile-server-1.4.5/seahub
export CCNET_CONF_DIR=/home/seafile/seafile/ccnet
export SEAFILE_CONF_DIR=/home/seafile/data
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
python syncdb
python createsuperuser
cd /home/seafile/seafile/seafile-server-1.4.5
sudo -u seafile -H ./ start-fastcgi

Before you continue to next step, switch off seafile and seahub:

sudo -u seafile -H ./ stop
sudo -u seafile -H ./ stop

5. Setting up init script

sudo wget -O /etc/init.d/seafile
sudo chmod +x /etc/init.d/seafile
sudo update-rc.d seafile defaults 21

You may now start, stop, restart and check status of seafile via sudo service seafile {command} or sudo /etc/init.d/seafile {command}:

sudo service seafile start

6. Passing to reverse-proxy (nginx)

Install nginx:

sudo apt-get install -y nginx

Configure nginx to serve as reverse-proxy:

sudo vim /etc/nginx/sites-available/seafile

Put and edit accordingly following content:

server {
    listen 80;
    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;

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

location /media {
    root /home/seafile/seafile/seafile-server-1.4.5/seahub;

Create symbolic link to enable site in nginx and reload its configuration:

sudo ln -s /etc/nginx/sites-available/seafile /etc/nginx/sites-enabled/seafile
sudo service nginx reload