How to Install and Configure Seafile on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Seafile is a free, open source and cross-platform file storage system similar to Dropbox. It is used for sharing and syncing files between users and groups. It can be easily integrated with LDAP and WebDAV. It supports file versioning, snapshots and two-factor authentication. You can deploy it with MySQL, MariaDB, PostgreSQL, Apache and Nginx web server. Files are stored on Seafile server and can be synchronized with personal computers and mobile devices through apps. You can also access and manage Seafile through a web browser.

Features:

  1. Multi-platform file synchronization.
  2. You can create a public link for downloading and uploading files.
  3. Supports LDAP, Active Directory authentication and Version control.
  4. File locking, Text searching and Activity logging.
  5. Provide access control and Client-side encryption.
  6. Desktop clients are available for personal computers running on Windows, MacOS, and Linux. Mobile clients are available for iOS, Windows Phone 8 and Android.

In this tutorial, we will install and configure a Seafile server on Ubuntu 16.04 with an Alibaba Cloud Elastic Compute Service (ECS) instance.

Requirements

  1. A fresh Alibaba cloud Ubuntu 16.04 instance with minimum 2GB RAM.
  2. A valid domain name is setup to your instance.
  3. A Root password is setup on the server.

Launch Alibaba Cloud ECS Instance

First, log in to your https://ecs.console.aliyun.com">Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install Required Dependencies

Before starting, you will need to install some dependencies in order to install Seafile. You can install all the dependencies by running the following command:

Next, you will also need to install boto using pip:

Install and Configure Database

First, you will need to install MariaDB server to your system. You can install it by just running the following command:

Once the MariaDB is installed, start MariaDB service and enable it to start on boot time with the following command:

By default, MariaDB is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script:

Answer all the questions as shown below:

Once the MariaDB is secured, login to MariaDB shell using the following command:

Enter your root password, then create a database for ccnet, seafile and seahub:

Next, create a user for these databases using the following command:

Next, grant all privileges to the seacloud user on all databases using the following command:

Next flush the privileges and exit from the shell:

Install Seafile

First, you will need to download the latest version of Seafile from their official website. You can download it with the following command:

Once the download is completed, extract the downloaded file with the following command:

Next, move the extracted directory to the Apache web root directory:

Next, give proper permissions to the seafile directory:

Next, change the directory to seafile and install seafile by running setup-seafile-mysql.sh script:

During installation, you will need to provide some details like, your domain name, database name, password etc. Provide all the details as follows:

Once the installation is completed successfully, start seafile and the seahub server using the following command:

You will need to provide email and password for admin account:

Configure Apache for Seafile

Next, you will need to configure Apache as a reverse proxy server for seafile-server on port 8000 and 8002. You can do this by creating seafile.conf file:

Add the following lines:

Save and close the file, then enable seafile virtual host, rewrite module and proxy module with the following command:

Finally, restart apache service to apply all the changes:

Seafile server is now installed and listening on port 80. Open your web browser and type the URL http://example.com. You will be redirected to the following page:

Now, provide your admin email and password, then click on the Login button. You should see the Seafile dashboard in the following image:

Secure Seafile with Certbot Certificate

Seafile is now installed and configured. If you want to enable https on Seafile server, then you will need to obtain a certificate from the Certificate Authority (CA).

Here, we will use Let’s Encrypt to obtain a certificate using via Certbot. So you will need to add the Certbot PPA to your server.

You can add the PPA by running the following command:

Next, install Certbot using the following command:

Next, create a directory to store certificates:

Change the directory to the /etc/certs and download Certbot certificate using the following command:

Next, enable ssl module with the following command:

Next, open Apache configuration file for Seafile and make the following changes:

Make the following changes:

Save and close the file, then restart Apache service to apply all the changes:

Now, you can access Seafile server using the URL https://example.com

Create Service file for Seafile and Seahub

Next, you will need to create seafile and seahub services file to start and stop seafile server.

First, stop seafile and seahub service using the following command:

Next, create a seafile service file with the following command:

Add the following lines:

Save and close the file, then create a seahub service file:

Add the following lines:

Save the file once you are done.

Next, reload the systemd service and start seafile and seahub with the following command:

Finally, enable seafile and seahub service on boot time:

Install Seafile Client

Seafile server is now up and running. It’s time to install Seafile client on Ubuntu 16.04 desktop system.

By default, Seafile client is not available in the Ubuntu 16.04 default repository. So you will need to add the repository for Seafile.

You can do this by running the following command:

Next, update the repository and install Seafile client using the following command:

Next, open Seafile client from Unity Dash as shown below:

Now, choose the folder where you want to store Seafile, then click on the Next button. You should see the following page:

Here, provide your Seafile server name, username and password, then click on the Login button. You should see the following page:

Congratulations! You have successfully installed and configured Seafile server and client. You can now access all your files through a web browser and Seafile client. Seafile client maps storage space in Seafile server as a virtual drive of your local storage. You can access all the files in the Seafile without syncing them.

Related Alibaba Cloud Products

ActionTrail documents daily operations to provide an operational history of your Alibaba Cloud account and saves this information to a specified OSS bucket. From the information collected by ActionTrail, you can conveniently perform security analysis, resource tracking, and compliance audits.

Content Moderation leverages Deep Learning technology and benefits from Alibaba’s years of Big Data analysis to provide accurate monitoring of pictures, video, text and other multimedia content. Not only does Content Moderation help users to reduce adult, violence, terrorism, drugs and other illegal or inappropriate content, but can also minimize spam advertising and other user experience pain points.

Reference:

https://www.alibabacloud.com/blog/how-to-install-and-configure-seafile-on-ubuntu-16-04_593979?spm=a2c4.12011554.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store