Tutorial: Set up Cloud Storage on a Linux Server, Using Seafile

The open source cloud storage system Seafile could easily serve as your in-house cloud platform. Written with the Python Django framework, Seafile is powerful, includes a user-friendly web frontend, and offers features like:
- File syncing
- Strong file encryption
- Easy collaboration
- Team Wiki
- Small footprint server, for high performance
- AD/LDAP integration
- Create groups with file syncing, online file editing, and more
- Create libraries (for separate syncing)
- Automatic file conflict resolution
- Share libraries, subdirectories, links, files, and more
Seafile is used by the likes of Kaspersky, Humboldt University, Gutenberg University, University of Strasbourg, and more, and with over 1 million users and thousands of teams, Seafile is ready to become your go-to, on-premise cloud solution.
I want to walk you through the process of installing the Seafile cloud storage server on Linux. I’ll be demonstrating on Ubuntu Server 18.04.
Download and Unpack the Server
The first thing to do is download the Seafile server with the command:
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.4_x86-64.tar.gz
Make sure to check the official Seafile download page, so that you’re downloading the latest version of the server.
Once the file downloads, unpack it with the command:
tar xvfz seafile-server_7.1.4_x86-64.tar.gz
This will create a new directory, named seafile-server-7.1.4. Change into that directory with the command:
cd seafile-server-7.1.4
Create a new directory to house Seafile with the command:
sudo mkdir /srv/seafile
Move the entire contents of the directory with the command:
sudo mv * /srv/seafile/
Installing the Dependencies
Seafile depends on a database server, so let’s install it with the command:
sudo apt-get install mysql-server -y
Install the remaining dependencies with the commands:
sudo apt install python python-{pip,pil,ldap,urllib3,setuptools,mysqldb,memcache,requests} -y
sudo apt install libpython3.6 ffmpeg python3-django-captcha -y
When that installation completes, secure the MySQL database server with the command:
sudo mysql_secure_installation
Make sure to give the database admin user a strong password and answer Y for the remaining questions.
Creating the Databases
It’s time to create the Seafile databases. Log in to the MySQL console with the command:
sudo mysql -u root -p
Create the necessary databases and grant the necessary permissions with the commands:
1 2 3 4 5 6 7 8 |
CREATE DATABASE seafile_server; CREATE DATABASE ccnet_server; CREATE DATABASE seahub_server; CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL ON seafile_server.* TO 'seafile'@'localhost'; GRANT ALL ON ccnet_server.* TO 'seafile'@'localhost'; GRANT ALL ON seahub_server.* TO 'seafile'@'localhost'; QUIT; |
…where PASSWORD is a strong/unique password.
Configuring Seafile
With everything out of the way, it’s time to configure Seafile. To do this, change into the /srv/seafile directory with the command:
cd /srv/seafile
Issue the command:
sudo ./setup-seafile-mysql.sh
When prompted, hit Enter on your keyboard and the installation will begin. You will be asked a number of questions (such as server name, server address, server port, etc.). When asked about initializing the databases, type 1 to create new. You will then be asked questions regarding the database server. Those questions (and answers) are:
- mysql server host: localhost
- mysql server port: 3306
- root password: the root password for the MySQL server
- mysql user for Seafile: seafile
- password for Seafile user: PASSWORD
- ccnet database name: ccnet-db
- Seafile database name: seafile-db
- Seahub database name: seahub-db
Where PASSWORD is a strong/unique password.
That’s it for the configuration.
Running the Seafile Server
Now that Seafile is configured, it’s time to run the server. To do this, you must start two components: seafile and seahub. To start these components, remain in the /opt/cloud directory and issue the following commands:
sudo ./seafile.sh start
sudo ./seahub.sh start
When you run the seahub.sh script for the first time, you’ll be asked to set up a new admin user (you’ll enter an email address and password for that user).
Install NGINX
We’ll use NGINX as our web server, which will need to be configured as a reverse proxy. Install the server with the command:
sudo apt-get install nginx -y
Once NGINX is installed, start and enable it with the commands:
sudo systemctl start nginx
sudo systemctl enable nginx
Create a new configuration file with the command:
sudo nano /etc/nginx/conf.d/seafile.conf
In that file, paste the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
server { listen 80; listen [::]:80; server_name SERVERADDRESS; autoindex off; client_max_body_size 100M; access_log /var/log/nginx/seafile.com.access.log; error_log /var/log/nginx/seafile.com.error.log; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_read_timeout 1200s; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; send_timeout 36000s; } location /media { root /srv/seafile-server-latest/seahub; } } |
Where SERVERADDRESS is either the domain or IP address of the hosting server.
Save and close the file. Restart NGINX with the command:
sudo systemctl restart nginx
Accessing Seafile
You can now access your newly-installed Seafile platform. Open a web browser and point it to http://SERVER_IP (Where SERVER_IP is either the domain or IP address of the hosting server). You will be prompted to log in (Figure A).

Figure A: Logging into our newly-installed Seafile server.
Use the email/password credentials you created after running the ./seahub.sh start script and you’ll find yourself on the main Seafile page, where you can start working with your on-premise cloud platform.
More Storage Tutorials
Tutorial: Deploy a Highly Availability GlusterFS Storage Cluster
Tutorial: Create a Docker Swarm with Persistent Storage Using GlusterFS
Tutorial: Dynamic Provisioning of Persistent Storage in Kubernetes with MiniKube