Edge / IoT / Linux / Storage / Technology

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

22 Jul 2020 9:17am, by

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:

…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:

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.

Feature image via Pixabay.

At this time, The New Stack does not allow comments directly on this website. We invite all readers who wish to discuss a story to visit us on Twitter or Facebook. We also welcome your news tips and feedback via email: feedback@thenewstack.io.

A newsletter digest of the week’s most important stories & analyses.