There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Install Seafile on Ubuntu 16.04 (Xenial Xerus)

Seafile is a private cloud such as Dropbox, and others. Seafile is based on python and it is open source, so that you can create your own private cloud and it will be much more secure.

Seafile supports encryption libraries that make your data will be more secure. To encrypt files in a library, you need to set a password when you create the library. The password won't be stored on Seafile cloud. So even the administrator of the servers cannot view your encrypted data without the password.

This tutorial shows the installation of Seafile on Ubuntu 16.04.


  • A Server with 2GB RAM
  • Ubuntu 16.04 64-bit

Installing Seafile

Step 1 - Install the necessary Dependencies

To perform the installation, the seafile need some dependencies:

  • openjdk-8jre
  • LibreOffice
  • Popler-utils
  • mysql-server
  • Python-pip and others.
apt-get install openjdk-8-jre poppler-utils libreoffice libreoffice-script-provider-python libpython2.7 python-pip mysql-server python-setuptools python-imaging python-mysqldb python-memcache ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy python-pip

Install boto with pip:

pip install boto

If you have error about locale setting, run all command below:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

Step 2 - Create a new "seafile" user

In this step, we will create a new user for the seafile installation. We will run the seafile server as this user.

Create new 'seafile' user for the installation.

useradd -m -s /bin/bash seafile
passwd seafile

Step 3 - Download and extract the Seafile archive

Seafile can be downloaded from the official site, please download according to your needs. Here I use Ubuntu 15.04 64-bit.

Download the Seafile archive with wget:

su - seafile
wget wget

Extract the seafile-server_5.1.4_x86-64.tar.gz and rename the directory to 'seafile-server'.

tar -xzf seafile-server_5.1.4_x86-64.tar.gz
mv seafile-server-5.1.4/ seafile-server/

So the directory for the seafile installation is on the seafile user home directory.

Step 4 - Create the Database

Seafile requires 3 databases:

  1. ccnet server
  2. seafile server
  3. seahub

Now back to the root user with "exit", then login to your mysql server.

Create 3 databases with one user and grant the user to all databases.

#Login to mysql
mysql -u root -p
#Create database
create database ccnet_db character set = 'utf8';
create database seafile_db character set = 'utf8';
create database seahub_db character set = 'utf8';

#Create user
create user [email protected] identified by 'yourpassword';

#Grant user to the databases
grant all privileges on ccnet_db.* to [email protected] identified by 'yourpassword';
grant all privileges on seafile_db.* to [email protected] identified by 'yourpassword';
grant all privileges on seahub_db.* to [email protected] identified by 'yourpassword';
flush privileges;

Step 5 - Install Seafile

Login to the 'seafile' user and  go to the installation directory 'seafile-server/', there run the file.

su - seafile
cd seafile-server/

Just press Enter and you will be asked about:

  • Server Name - we will use seafile-server.
  • Domain/IP -
  • Seafile data directory - default data directory
  • Seafile server port configuration.

Seafile install on Ubuntu

Then you will be asked for the database setup. You can choose number 2 because all database have been created in step 4.

Seafile database setup

Seafile is installed. Start seafile and the seahub server:

./ start
./ start

You will be asked about the admin email and password for seafile admin email and password.

If the admin user has been created. Stop seafile now, next we will create a service file for the seafile server:

./ stop
./ stop

Step 6 - Configure Seafile and Seahub Service files

Next, we will configure seafile and seahub services. We will create new service files for the seafile and seahub server.

As root user, go to the '/lib/systemd/system/' directory and create a new seafile service file 'seafile-server.service' with vim editor:

cd /lib/systemd/system/
vim seafile.service

Paste seafile service configuration below:

Description=Seafile Server mariadb.service

ExecStart=/home/seafile/seafile-server/ start
ExecStop=/home/seafile/seafile-server/ stop


Save and exit.

Now create new seahub service file seahub.service:

vim seahub.service

Paste configuration below:

Description=Seafile Hub

ExecStart=/home/seafile/seafile-server/ start-fastcgi
ExecStop=/home/seafile/seafile-server/ stop


Save and exit.

Reload the systemd service and start seafile and seahub:

systemctl daemon-reload
systemctl start seafile
systemctl start seahub

Make sure there is no error and check the seafile and seahub server is running by checking the service ports.

netstat -plntu

Check that Seafile has been started.

You will see the seafile port 8082 and the seahub port 8000.

Step 7 - Install and Configure Nginx as Reverse Proxy

In this step, we will install nginx from the Ubuntu repository and then configure it as a reverse proxy server for seafile-server on port 8000 and 8002.

Install nginx with this apt-get command:

apt-get install nginx -y

When the installation is finished, go to the nginx virtual host directory and create a new virtual host file cloud.mydomain.conf with vim:

cd /etc/nginx/sites-available/
vim cloud.mydomain.conf

Paste virtual host configuration below:

server {
    listen 80;

    proxy_set_header X-Forwarded-For $remote_addr;
    # Reverse proxy for seafile
    location / {
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;

        fastcgi_param    SERVER_PROTOCOL        $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param    SERVER_ADDR         $server_addr;
        fastcgi_param    SERVER_PORT         $server_port;
        fastcgi_param    SERVER_NAME         $server_name;
        fastcgi_param   REMOTE_ADDR         $remote_addr;

        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
        fastcgi_read_timeout 36000;
    # Reverse Proxy for seahub
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    location /media {
        root /home/seafile/seafile-server/seahub;

Save and exit.

I will use '' as the domain name.

Next, enable the new virtual host by creating a link to the 'sites-enabled' directory and restart nginx.

Enable new virtual host:

ln -s /etc/nginx/sites-available/

Test and restart the nginx web server.

nginx -t
systemctl restart nginx

Step 8 - Testing with the Web Browser

Open your browser and try to login with your admin account.

Seafile Login

Seafile admin dashboard:

Seafile has been started


With the wide variety of cloud applications today, Seafile is a private cloud solution that is good for use on this day. With the encryption feature at the library/folder, you can make the data more secure. And also ease to configure it, make it easy to implement in your server.

Share this page:

15 Comment(s)

Add comment

Please register in our forum first to comment.


By: Pete

Why the java/jdk dependency? I'm not seeing **any** reason this would be needed.  Also, I'd use mariaDB over mysql every day of the week.

By: till

Seafile requires Java for Elasticsearch only according to their website. If you don't use Elasticsearch, then you might be able to leave out the jdk dependency.

By: Justin Partain

Honestly, at this time, you guys probably should refrain from posting anything about seafile, seeing as two different groups currently claim ownership over this program, thus making it nearly impossible to know which is the right code. From security to basic stability in the program, you never know whats going on until this dust settles.

By: libreman

According Wikipedia the mayor issue has been solved:

By: Henrik

Great work!

But I don't know why "Step 6 - Configure Seafile and Seahub Service Files" doesn't work for me. Ubuntu 16.04. LTS. No errors shown, but seafile/seahub won't start at bootup automatically.

I tried "systemctl enable seafile-service" and "systemctl enable seahub-service" (is this part is missing in the manual?) but that doesn't help. 

Starting manually works fine. 

Thank you! 


By: Merioz


I'm writing because I have the same problem of Henrik at "Step 6". 

By: Merioz

I found the solution of the seafile startup

Modify "seafile.service" in this mode:



Description=Seafile Server mysql.service




ExecStart=/home/seafile/seafile-server/ start

ExecStop=/home/seafile/seafile-server/ stop







And file "seahub.service" in this mode:



Description=Seafile Hub seafile.service




ExecStart=/home/seafile/seafile-server/ start

ExecStop=/home/seafile/seafile-server/ stop







Reboot and enjoy!!

Thats all!!

By: Dunstan

Merioz's and Henrik's problem is caused by an error in the description.

Description=Seafile seafile.targetis bad, because seafile is a service, not a target. Please correct the line to seafile.service

and the automatic start will work.


Not sure where I messed up.. but at the end when I go to my URL, I got the following:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to support is available at

Thank you for using nginx.



I even tried to tailor this towards mine.. the only thing I am unsure about is the following as I tried using both files, one at a time (not same time)




By: j43li

This is missing:

Delete /etc/nginx/sites-enabled/default: rm /etc/nginx/sites-enabled/default

By: j43li

Thanks for the detailed document. I got two issues after following all instructions to install seafile server on Ubuntu 16.04.1 LTS (Xenial Xerus).

Problem one: Default is still showing Nginx.

   I have to manully delete the default: rm /etc/nginx/sites-enabled/default

Problem two: Can see the files in browser, but cannot upload any new file.

  I have to modify ccnet.conf and according to seafile server manual. The following is the two modified files. Hope it helps.



USER_NAME = seafile-server

ID = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

NAME = seafile-server



PORT = 13419



ENGINE = mysql


PORT = 3306

USER = seacloud

PASSWD = yourpassword

DB = ccnet_db


SECRET_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

#Added according to Server Manual



    'default': {

        'ENGINE': 'django.db.backends.mysql',

        'NAME': 'seahub_db',

        'USER': 'seacloud',

        'PASSWORD': 'yourpassword',

        'HOST': '',

        'PORT': '3306'




By: strokers

Dunstan : Your solution didnt work for me :(( i can manual start by command :

systemctl start seafilesystemctl start seahub


but after reboot system seafile and seahub doesnt start automaticly :(



u forgot:

#systemctl enable seahub.service                                                                                  (2017-08-09 16:15:47)Created symlink from /etc/systemd/system/ to /lib/systemd/system/seahub.service.# systemctl enable seafile.service                                                                                 (2017-08-09 16:15:54)Created symlink from /etc/systemd/system/ to /lib/systemd/system/seafile.service.


This activates the autostart of the service.                                                                            

By: Cris

I tried everything to get it to work as a service on Ubuntu 16 and could not get it to work. I had it working on CentOS7 fine previously. So I instead made it work work with a cron job and a script.

First create a bash script called - the start scripts for seafile will not run from a full path so I used the CD command first.


cd /home/seafile/seafile-server./ start./ start


Now create a cron job ....

#crontab -e

*/2 * * * * /home/seafile/ > /dev/null


This runs it every 2 minutes (I know it's quick and dirty, but it works)

You could also use @reboot (should work).

By: Wiaf

After your netstat --plntu statement you write that seafile will listen on 8002, when it actually listens on 8082, your screenshot shows that to. It also happens to be that way on the standard installation im working through right now.

Thanks for the guide btw <o