Setup Seafile Server Development Environment

The following operations have been tested on ubuntu-16.04.1-desktop-amd64 system.

Install Necessary Packages

install necessary packages by apt

  1. sudo apt install ssh libevent-dev libcurl4-openssl-dev libglib2.0-dev uuid-dev intltool libsqlite3-dev libmysqlclient-dev libarchive-dev libtool libjansson-dev valac libfuse-dev python-dateutil cmake re2c flex sqlite3 python-pip python-simplejson git libssl-dev libldap2-dev libonig-dev

install libevhtp from source

  1. cd ~/Downloads/
  2. git clone https://github.com/haiwen/libevhtp.git
  3. cd libevhtp/
  4. cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .
  5. make
  6. sudo make install
  7. sudo ldconfig

Download and Build Seafile

create project root directory dev

  1. cd
  2. mkdir dev

download and install libsearpc

  1. cd ~/dev/
  2. git clone https://github.com/haiwen/libsearpc.git
  3. cd libsearpc/
  4. ./autogen.sh
  5. ./configure
  6. make
  7. sudo make install
  8. sudo ldconfig

download and install ccnet-server

  1. cd ~/dev/
  2. git clone https://github.com/haiwen/ccnet-server.git
  3. cd ccnet-server/
  4. ./autogen.sh
  5. ./configure --enable-ldap
  6. make
  7. sudo make install
  8. sudo ldconfig

download and install seafile-server

  1. cd ~/dev/
  2. git clone https://github.com/haiwen/seafile-server.git
  3. cd seafile-server/
  4. ./autogen.sh
  5. ./configure
  6. make
  7. sudo make install

download seahub

  1. cd ~/dev/
  2. git clone https://github.com/haiwen/seahub.git
  3. cd seahub/

Start ccnet-server and seaf-server

Start ccnet-server and seaf-server in two separate terminals.

  1. cd ~/dev/seafile-server/tests
  2. ccnet-server -c conf -f -
  1. cd ~/dev/seafile-server/tests
  2. mkdir -p conf/seafile-data
  3. touch seafile-data/seafile.conf
  4. seaf-server -c conf -d conf/seafile-data -f -l -

The config files and databases (if you use sqlite, which is by default) of ccnet-server are located in ~/dev/seafile-server/tests/conf. This directory is called “ccnet conf directory”. The config files, databases and data of seaf-server are located in ~/dev/seafile-server/tests/conf/seafile-data. This directory is called “seafile conf directory”.

Start seahub

Seahub is the web front end of Seafile. It is written in the Django framework, requires Python 2.7 installed on your server.

set environment

  1. cd ~/dev/seahub/
  2. cat > setenv.sh << EOF
  3. export CCNET_CONF_DIR=~/dev/seafile-server/tests/conf
  4. export SEAFILE_CONF_DIR=~/dev/seafile-server/tests/conf/seafile-data
  5. export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:thirdpart:\$PYTHONPATH
  6. EOF
  7. sudo chmod u+x setenv.sh

install requirements

  1. # Expand setenv.sh in the current shell
  2. . setenv.sh
  3. cd ~/dev/seahub/
  4. sudo pip install -r requirements.txt

NOTE: if locale.Error: unsupported locale setting, you should export LC_ALL=en_US.UTF-8

create database and admin account

  1. . setenv.sh
  2. python manage.py migrate
  3. python tools/seahub-admin.py # create admin account

NOTE: currently, your ccnet directory is ~/dev/seafile-server/tests/conf

run seahub

  1. python manage.py runserver 0.0.0.0:8000

then open browser and navigate to http://127.0.0.1:8000

If you have set up Nginx/Apache to run Seafile, you should run seahub in fastcgi mode.

  1. python manage.py runfcgi host=127.0.0.1 port=8000