Deploy Seafile Windows Server With MySQL

Preparation

Install MySQL-python Library

Create MySQL Databases

You need to create:

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

Open a termial (cmd, Win + R, cmd) and login to mysql with a privileged user:

  1. mysql -u root -p

Execute these SQL setences on your mysql server:

  1. create database `ccnet-db` character set = 'utf8';
  2. create database `seafile-db` character set = 'utf8';
  3. create database `seahub-db` character set = 'utf8';
  4. create user 'seafile'@'localhost' identified by 'your secure password';
  5. GRANT ALL PRIVILEGES ON `ccnet-db`.* to `seafile`;
  6. GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`;
  7. GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`;

Modify Your Seafile Configuations

  • Append the following lines to ccnet/ccnet.conf:
  1. [Database]
  2. ENGINE=mysql
  3. HOST=localhost
  4. USER=seafile
  5. PASSWD=your secure password
  6. DB=ccnet-db
  • Edit the database section of seafile-data/seafile.conf:
  1. [database]
  2. type=mysql
  3. host=localhost
  4. user=seafile
  5. password=your secure password
  6. db_name=seafile-db
  • Append following lines to seahub_settings.py
  1. DATABASES = {
  2. 'default': {
  3. 'ENGINE': 'django.db.backends.mysql',
  4. 'NAME' : 'seahub-db',
  5. 'USER' : 'seafile',
  6. 'PASSWORD' : 'your secure password',
  7. 'HOST' : 'localhost',
  8. }
  9. }

Create Database Tables for Seahub

Now we create the database tables for seahub.

Assume you have uncompressed seafile server to C:/SeafileProgram/seafile-pro-server-3.1.3,

Open a window command line prompt, and execute the following command:

  1. mysql -u seafile -p seahub-db < C:/SeafileProgram/seafile-server-3.1.3/seahub/sql/mysql.sql

Done

Now you can start your seafile server.