Seafile is an open source Dropbox alternative that offer encryption on client-side (data is stored encrypted on the server and server don't have password). Sadly there is no Seafile package for Synology. In order to lower maintenance I choosed to install Seafile in a Debian chroot running on the NAS.

Install packages

As a reference, Seafile documentation to install this software from source is available from This procedure follows the official documentation to install Seafile 3.0.x with details specific to Debian distribution and packages; it assume you already set up a Debian chroot on Synology.

Install development libraries

~$ aptitude install libevent-dev libcurl4-openssl-dev libglib2.0-dev uuid-dev intltool libsqlite3-dev libarchive-dev libtool libjansson-dev valac libfuse-dev

At time of writing some packages were not available in Debian stable. Add other packages from testing environment to apt sources file and set preferences to make sure testing isn't picked as default choice. Please check AptPreferences for more details about apt pinning.

~$ cat >> /etc/apt/sources.list << EOF
~$ deb jessie main contrib non-free
~$ deb-src jessie main contrib non-free
~$ EOF
~$ cat > /etc/apt/preferences.d/00preferStable << EOF
~$ Package: *
~$ Pin: release a=stable
~$ Pin-Priority: 900
~$ Package: *
~$ Pin: release a=testing
~$ Pin-Priority: 800
~$ EOF
# Adding the packages from jessie (Debian testing)
~$ aptitude install libonig-dev -t jessie
~$ aptitude install libzdb-dev libsqlite3-dev sqlite3 -t jessie

Only exception is libevhtp: a special version of this library is required.

~$ mkdir libs 
~$ cd libs
~$ wget

Decompress library and use cmake to compile and install it.

~$ aptitude install cmake
~$ cmake .
~$ make
~$ sudo make install

Next install packages for seahub, the Python web front end. Some python libraries aren't available from Debian packages and Seafile 3.0.x require Django 1.5.

~$ aptitude install python-simplejson python-chardet gunicorn python-imaging python-six
~$ # Some python lib aren't available from Debian.
~$ aptitude install python-pip
~$ pip install django==1.5
~$ pip install djblets==0.6

Prepare Seafile projects

Add user and prepare project layout. Fill ORGANIZATION_NAME with anything more suitable to describe your Seafile installation (company or domain name).

~$ adduser seafile
~$ su seafile
~$ cd
~$ mkdir -p $ORGANIZATION_NAME/seafile-server
~$ cd $ORGANIZATION_NAME/seafile-server

Get the source. This time, replace VERSION with Seafile latest version.

~$ VERSION=3.0.3
~$ mkdir src
~$ cd src
~$ wget${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ wget${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ wget${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ cd ..
~$ wget${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ mv seahub-${VERSION}-server seahub

Compile Seafile

Build and install seafile projects. Autogen, configure and make commands can be run as user seafile but "make install" command require root privileges.

~$ cd src/libsearpc-${VERSION}-server
~$ ./
~$ ./configure
~$ make
~$ make install
~$ ~$ cd ../ccnet-${VERSION}-server
~$ ./
~$ ./configure --disable-client --enable-server # `export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig` if libsearpc is not found
~$ make
~$ make install
~$ cd ../seafile-${VERSION}-server

With Seafile 3.0.3, the seafile-controller executable require a small fix. At startup, this program define its configuration, bin and pids folders based on binary location. Being installed in /usr/local/bin instead of being in seafile-server subfolder, the startup fails. To fix it, edit init_seafile_path in controller/seafile-controller.c:

static void
init_seafile_path (char *config_dir)
topdir = g_path_get_dirname (config_dir);
installpath = g_build_filename (topdir, "seafile-server", NULL);

You also have to update the call to init_seafile_path in the first line of the seaf_controller_init function:

static int
seaf_controller_init (SeafileController *ctl,
char *config_dir,
char *seafile_dir,
char *logdir,
gboolean cloud_mode)
init_seafile_path (config_dir);

Now complete compilation of seafile-server with this small fix.

~$ ./
~$ ./configure --disable-client --enable-server
~$ make
~$ make install

Deploy Seafile

As seafile user, go to top directory and start Seafile setup script

~$ export PYTHONPATH=/home/seafile/$ORGANIZATION_NAME/seafile-server/seahub/thirdpart
~$ seafile-admin setup

Answer some questions and finally start seafile

~$ seafile-admin setup

Seafile should now be launched and accessible from your NAS

Seafile auto startup

The seafile-admin command must be launched by user seafile from the top directory. As seafile user, create a script to launch this command.

~$ cat >> << EOF
~$ #!/bin/bash
~$ cd `dirname $0`
~$ seafile-admin start
~$ EOF
~$ chmod +x

Then as root install sudo

~$ aptitude install sudo

Latest part is to add this script to the Synology boot sequence. If you already have a script, just append to it:

~$ cat >> /usr/local/etc/rc.d/ << EOF
~$ # Start seafile
~$ chroot \$CHROOT /usr/bin/sudo -u seafile /bin/bash /home/seafile/<organization_name>/
~$ EOF
~$ chmod 755 /usr/local/etc/rc.d/