Seafile

Server

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

Platform Support

  • Generic Linux
    • including Raspberry Pi
  • Windows

Download

Visit our download page, download the latest server package.

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

Deploying and Directory Layout

NOTE: If you place the Seafile data directory in external storage, such as NFS, CIFS mount, you should not use SQLite as the database, but use MySQL instead. Please follow [https://github.com/haiwen/seafile/wiki/Download-and-Setup-Seafile-Server-with-MySQL this manual] to setup Seafile server.

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

  1. mkdir haiwen
  2. mv seafile-server_* haiwen
  3. cd haiwen
  4. # after moving seafile-server_* to this directory
  5. tar -xzf seafile-server_*
  6. mkdir installed
  7. mv seafile-server_* installed

Now you should have the following directory layout

  1. # tree . -L 2
  2. .
  3. ├── installed
  4. └── seafile-server_1.4.0_x86-64.tar.gz
  5. └── seafile-server-1.4.0
  6. ├── reset-admin.sh
  7. ├── runtime
  8. ├── seafile
  9. ├── seafile.sh
  10. ├── seahub
  11. ├── seahub.sh
  12. ├── setup-seafile.sh
  13. └── 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’’.

Setting Up Seafile Server

Prerequisites

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
  • sqlite3
  1. #on Debian
  2. apt-get update
  3. apt-get install python2.7 python-setuptools python-simplejson python-imaging sqlite3

Setup

  1. cd seafile-server-*
  2. ./setup-seafile.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.

[[images/server-setup.png|You’ll see these outputs when you run the setup script]]

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

{| border=”1” cellspacing=”0” cellpadding=”5” align=”center”
|+ 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.
|-
|}

If the setup is successful, you’ll see the following output

[[images/server-setup-successfully.png]]

Now you should have the following directory layout :

  1. #tree haiwen -L 2
  2. haiwen
  3. ├── ccnet # configuration files
  4. ├── ccnet.conf
  5. ├── mykey.peer
  6. ├── PeerMgr
  7. └── seafile.ini
  8. ├── installed
  9. └── seafile-server_1.4.0_x86-64.tar.gz
  10. ├── seafile-data
  11. └── seafile.conf
  12. ├── seafile-server-1.4.0 # active version
  13. ├── reset-admin.sh
  14. ├── runtime
  15. ├── seafile
  16. ├── seafile.sh
  17. ├── seahub
  18. ├── seahub.sh
  19. ├── setup-seafile.sh
  20. └── upgrade
  21. ├── seafile-server-latest # symbolic link to seafile-server-1.4.0
  22. ├── seahub-data
  23. └── avatars
  24. ├── seahub.db
  25. ├── seahub_settings.py # optional config file
  26. └── 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.

Running Seafile Server

Before Running

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:

  1. ulimit -n 30000

Starting Seafile Server and Seahub Website

Under seafile-server-1.4.0 directory, run the following commands

  • Start seafile:
  1. ./seafile.sh start # Start seafile service
  • Start seahub
  1. ./seahub.sh start <port> # 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

  1. 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 Myhome 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

    1. ./seahub.sh stop
    2. ./seafile.sh stop
  • modify the value of SERVICE_URL in the file ccnet.conf, like this: (assume your ip or domain is 192.168.1.100)

    1. SERVICE_URL = http://192.168.1.100:8001
  • restart seafile server

    1. ./seafile.sh start
    2. ./seahub.sh start 8001

see [[Seafile server configuration options]] for more details about ccnet.conf.

Stopping and Restarting Seafile and Seahub

Stopping

  1. ./seahub.sh stop # stop seahub website
  2. ./seafile.sh stop # stop seafile processes

Restarting

  1. ./seafile.sh restart
  2. ./seahub.sh restart

When the Scripts Fail

Most of the time, seafile.sh and seahub.sh work fine. But if they fail, you may

  • Use ‘’’pgrep’’’ command to check if seafile/seahub processes are still running
  1. pgrep -f seafile-controller # check seafile processes
  2. pgrep -f "manage.py run_gunicorn" # check seahub process
  • Use ‘’’pkill’’’ to kill the processes
  1. pkill -f seafile-controller
  2. pkill -f "manage.py run_gunicorn"

That’s it!

That’s it! Now you may want read more about seafile.

  • [[Seafile-server-management|How to manage the server]].