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 https://bitbucket.org/haiwen/seafile/downloads/seafile-server_{version}_i386.tar.gz #or for 64bit https://bitbucket.org/haiwen/seafile/downloads/seafile-server_{version}_x86-64.tar.gz
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 haiwen ├── installed │ └── seafile-server_1.8.2_x86-64.tar.gz └── seafile-server-1.8.2 ├── reset-admin.sh ├── runtime ├── seafile ├── seafile.sh ├── seahub ├── seahub.sh ├── setup-seafile.sh └── upgrade
'''The benefit of this layout is that'''
Three components of Seafile Server need their own databases:
See Seafile Server Components Overview if you want to know more about the seafile server components.
There are two ways to intialize the databases:
setup-seafile-mysql.sh
script create the databases for you.We recommend the first way. The script would ask you for the root password of the mysql server, and it will create:
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`@localhost; GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`@localhost; GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`@localhost;
The Seafile server package requires the following packages have been installed in your system
#on Debian/Ubuntu apt-get update apt-get install python2.7 python-setuptools python-imaging python-mysqldb
cd seafile-server-* ./setup-seafile-mysql.sh #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] Create new ccnet/seafile/seahub databases", you would be asked these questions:
You'll see these output:
Question | Description | Note |
---|---|---|
mysql server host | the host address of the mysql server | the default is localhost |
mysql server port | the port of the mysql server | the default is 3306. Almost every mysql server uses this port. |
root password | the password of mysql root account | the root password is required to create new databases and a new user |
mysql user for seafile | the username for seafile programs to use to access MySQL server | if the user does not exist, it would be created |
password for seafile mysql user | the password for the user above | |
ccnet dabase name | the name of the database used by ccnet, default is "ccnet-db" | the database would be created if not existing |
seafile dabase name | the name of the database used by seafile, default is "seafile-db" | the database would be created if not existing |
seahub dabase name | the name of the database used by seahub, default is "seahub-db" | the database would be created if not existing |
If you choose "[2] Use existing ccnet/seafile/seahub databases", you would be asked these questions:
You'll see these output:
related questions for "Use existing ccnet/seafile/seahub databases"
Question | Description | Note |
---|---|---|
mysql server host | the host address of the mysql server | the default is localhost |
mysql server port | the port of the mysql server | the default is 3306. Almost every mysql server uses this port |
mysql user for seafile | the user for seafile programs to use to access MySQL server | the user must already exists |
password for seafile mysql user | the password for the user above | |
ccnet dabase name | the name of the database used by ccnet | this database must already exist |
seafile dabase name | the name of the database used by seafile, default is "seafile-db" | this database must already exist |
seahub dabase name | the name of the database used by seahub, default is "seahub-db" | this database must already exist |
If the setup is successful, you'll see the following output
Now you should have the following directory layout :
#tree haiwen -L 2
haiwen
├── ccnet # configuration files
│ ├── ccnet.conf
│ ├── mykey.peer
│ ├── PeerMgr
│ └── seafile.ini
├── installed
│ └── seafile-server_1.8.2_x86-64.tar.gz
├── seafile-data
│ └── seafile.conf
├── seafile-server-1.8.2 # active version
│ ├── reset-admin.sh
│ ├── runtime
│ ├── seafile
│ ├── seafile.sh
│ ├── seahub
│ ├── seahub.sh
│ ├── setup-seafile.sh
│ └── upgrade
├── seafile-server-latest # symbolic link to seafile-server-1.8.2
├── seahub-data
│ └── avatars
├── seahub_settings.py # optional config file
└── seahub_settings.pyc
The folder seafile-server-latest
is a symbolic link to the current seafile server folder. When later you upgrade to a new version, the upgrade scripts would update this link to keep it always point to the latest seafile server folder.
Since Seafile uses persistent connection between client and server, if you have '''a large number of clients ''', you should increase Linux file descriptors by ulimit before start seafile, like:
ulimit -n 30000
Under seafile-server-1.8.2 directory, run the following commands
./seafile.sh start # Start seafile service
./seahub.sh start# Start seahub website, port defaults to 8000
'''Note:''' The first time you start seahub, the script would prompt you to create an admin account for your seafile server.
After starting the services, you may open a web browser and types
http://192.168.1.111:8000/you will be redirected to the Login page. Enter the username and password you were provided during the Seafile setup. You will then be returned to the
My Home
page where you can create libraries.
'''Congratulations!''' Now you have successfully setup your private Seafile server.
#### Run Seahub on another port
If you want to run seahub in a port other than the default 8000, say 8001, you must:
* stop the seafile server
./seahub.sh stop ./seafile.sh stop
modify the value of SERVICE_URL
in the file haiwen/ccnet/ccnet.conf
, like this: (assume your ip or domain is 192.168.1.100
)
SERVICE_URL = http://192.168.1.100:8001
restart seafile server
./seafile.sh start ./seahub.sh start 8001
see Seafile server configuration options for more details about ccnet.conf
.
./seahub.sh stop # stop seahub website ./seafile.sh stop # stop seafile processes
./seafile.sh restart ./seahub.sh restart
Most of the time, seafile.sh and seahub.sh work fine. But if they fail, you may
pgrep -f seafile-controller # check seafile processes pgrep -f "manage.py run_gunicorn" # check seahub process
pkill -f seafile-controller pkill -f "manage.py run_gunicorn"
That's it! Now you may want read more about seafile.