Deploying Seafile with SQLite

Download binary package

Visit our download page, download the latest server package.

Choose one of:

  • Generic Linux
  • Windows
  • Server for Raspberry Pi
  1. #check if your system is x86 (32bit) or x86_64 (64 bit)
  2. uname -m

Click the tarball link and save it.

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.

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

  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

Benefits of this layout are

  • 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.7
  • python-setuptools
  • python-imaging
  • python-ldap
  • python-urllib3
  • python-requests
  • sqlite3
  1. #on Debian/Ubuntu 14.04 server
  2. apt-get update
  3. apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 sqlite3 python-requests
  1. # on Ubuntu 16.04 server
  2. # As the default python binary on Ubuntu 16.04 server is python 3, we need to install python (python 2) first.
  3. apt-get update
  4. apt-get install python
  5. apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 ffmpeg python-pip sqlite3 python-requests
  6. pip install pillow moviepy
  1. # on CentOS 7
  2. yum -y install epel-release
  3. rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
  4. yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel python-requests
  5. pip install pillow moviepy

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.

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

Now you should have the following directory layout:

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

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 connections between client and server, you should increase Linux file descriptors by ulimit if you have a large number of clients before start Seafile, like:

ulimit -n 30000

Starting Seafile Server and Seahub Website

  • 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 is going to prompt you to create an admin account for your Seafile server.

After starting the services, you may open a web browser and type in

http://192.168.1.111:8000

you will be redirected to the Login page. Just enter the admin username and password.

Congratulations! Now you have successfully setup your private Seafile server.

Run Seahub on another port

If you want to run Seahub on a port other than the default 8000, say 8001, you must:

Seafile 6.2.x and previous versions

  • 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). You can also modify SERVICE_URL via web UI in “System Admin->Settings”. (Warning: if you set the value both via Web UI and ccnet.conf, the setting via Web UI will take precedence.)

  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 Manual for more details about ccnet.conf.

Seafile 6.3.x and above versions

You can assign the port of Seahub by setting the conf/gunicorn.conf.

  • 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). You can also modify SERVICE_URL via web UI in “System Admin->Settings”. (Warning: if you set the value both via Web UI and ccnet.conf, the setting via Web UI will take precedence.)

  1. SERVICE_URL = http://192.168.1.100:8001
  • modify the conf/gunicorn.conf
  1. # default localhost:8000
  2. bind = "0.0.0.0:8001"
  • restart Seafile server
    1. ./seafile.sh start
    2. ./seahub.sh start

See Seafile Server Configuration Manual for more details about ccnet.conf.

Manage 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 might want to

  • Use pgrep command to check if Seafile/Seahub processes are still running

    1. pgrep -f seafile-controller # check Seafile processes
    2. pgrep -f "seahub" # check Seahub process
  • Use pkill to kill the processes

    1. pkill -f seafile-controller
    2. pkill -f "seahub"

Setup in non-interactive way

Since Seafile version 5.1.4, setup-seafile.sh supports auto mode. You can run the setup script in non-interactive by supply the needed parameters via script parameters or environment variables.

  1. cd seafile-server-*
  2. ./setup-seafile.sh auto [param1] [param2]...

Related parameters as follow:

Option Script parameter Environment variable Default value
server name -n SERVER_NAME hostname -s(short host name)
server ip or domain -i SERVER_IP hostname -i(address for the host name)
fileserver port -p FILESERVER_PORT 8082
seafile data dir -d SEAFILE_DIR current directory

Note: If both script parameter and environment variable assigned, script parameter has higher priority. If neither script parameter nor environment variable assigned, default value will be used.

That’s it!

For a production server we highly recommend to setup with Nginx/Apache and enable SSL/TLS.

That’s it! Now you might want read more about Seafile.