Deploying Seafile with MySQL

This manual explains how to setup and run seafile server from a pre-built package with MySQL.


Download the latest server package.

#check if your system is x86 (32bit) or x86_64 (64 bit)
uname -m

For Seafile Server 2.1.4 and later:

#download for 32bit{version}_i386.tar.gz
#or for 64bit{version}_x86-64.tar.gz

Deploying and Directory Layout

Supposed your organization’s name is “haiwen”, and you’ve downloaded seafile-server1.8.2* into your home directory. We suggest you to layout your deployment as follows :

mkdir haiwen
mv seafile-server_* haiwen
cd haiwen
# after moving seafile-server_* to this directory
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed

Now you should have the following directory layout

#tree haiwen -L 2
├── installed
│   └── seafile-server_1.8.2_x86-64.tar.gz
└── seafile-server-1.8.2
    ├── runtime
    ├── seafile
    ├── seahub
    └── upgrade

”’The benefit of this layout is that”’

  • We can place all the config files for Seafile server inside “haiwen” directory, making it easier to manage.
  • When you upgrade to a new version of Seafile, you can simply untar the latest package into “haiwen” directory. ”In this way you can reuse the existing config files in “haiwen” directory and don’t need to configure again”.

Prepare MySQL Databases

Three components of Seafile Server need their own databases:

  • ccnet server
  • seafile server
  • seahub

See Seafile Server Components Overview if you want to know more about the seafile server components.

There are two ways to intialize the databases:

  • let the script create the databases for you.
  • create the databases by yourself, or someone else (the database admin, for example)

We recommend the first way. The script would ask you for the root password of the mysql server, and it will create:

  • database for ccnet/seafile/seahub.
  • a new user to access these databases

However, sometimes you have to use the second way. If you don’t have the root password, you need someone who has the privileges, e.g., the database admin, to create the three databases, as well as a mysql user who can access the three databases for you. For example, to create three databases:ccnet-db / seafile-db / seahub-db for ccnet/seafile/seahub respectively, and a mysql user “seafile” to access these databases:

create database `ccnet-db` character set = 'utf8';
create database `seafile-db` character set = 'utf8';
create database `seahub-db` character set = 'utf8';

create user 'seafile'@'localhost' identified by 'seafile';

GRANT ALL PRIVILEGES ON `ccnet-db`.* to `seafile`;
GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`;
GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`;

Setting Up Seafile Server


The Seafile server package requires the following packages have been installed in your system

  • python 2.6.5+ or 2.7
  • python-setuptools
  • python-simplejson
  • python-imaging
  • python-mysqldb
#on Debian/Ubuntu
apt-get update
apt-get install python2.7 python-setuptools python-simplejson python-imaging python-mysqldb


cd seafile-server-*
./  #run the setup script & answer prompted questions

If some of the prerequisites are not installed, the seafile initialization script will ask you to install them.

You’ll see these outputs when you run the setup script


The script will guide you through the settings of various configuration options.

Seafile configuration options

Option Description Note
server name Name of this seafile server 3-15 characters, only English letters, digits and underscore (‘_’) are allowed
server ip or domain The IP address or domain name used by this server Seafile client program will access the server with this address
ccnet server port The TCP port used by ccnet, the underlying networking service of Seafile Default is 10001. If it’s been used by other service, you can set it to another port.
seafile data dir Seafile stores your data in this directory. By default it’ll be placed in the current directory. The size of this directory will increase as you put more and more data into Seafile. Please select a disk partition with enough free space.
seafile server port The TCP port used by Seafile to transfer data Default is 12001. If it’s been used by other service, you can set it to another port.
fileserver port The TCP port used by Seafile fileserver Default is 8082. If it’s been used by other service, you can set it to another port.

At this moment, you will be asked to choose a way to initialize seafile databases:

Please choose a way to initialize seafile databases:

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

Which one to choose depends on if you have the root password.

  • If you choose “1”, you need to provide the root password. The script would create the databases and a new user to access the databases
  • If you choose “2”, the ccnet/seafile/seahub databases must have already been created, either by you, or someone else.

If you choose “[1] Create new ccnet/seafile/seahub databases”, you would be asked these questions:

You’ll see these output: