Install and secure Seafile on CentOS 7

Tech
No Comments

Follow this handy guide to install Seafile and setup basic security.

What’s Seafile?Seafile Logo

Seafile is open source file sync and share software – similar to Dropbox, OneDrive or Google Drive – but you host it yourself, keeping your data private.

You first need to setup a server or vps – the requirements are small, a 1GB VPS is sufficient for individual or small team usage – the main consideration beyond this is making sure it has enough disk space for the files you wish to store.

We recommend our friends at Linode if you’re looking for a VPS provider.

Once logged in, you’re ready to install Seafile.  Login and make sure all the software is up to date:

[root@server ~] yum -y update

You’ll also need to add the EPEL repo.

Reboot and then log back in as root.

Install Seafile

The Seafile community have produced a fantastic installation script which does most of the work for you.  You can install it using the two following commands:

[root@server ~] wget https://raw.githubusercontent.com/haiwen/seafile-server-installer/master/seafile_centos
[root@server ~] bash seafile_centos 7.0.2

(If you get ‘wget: command not found’ you can add it with the command ‘yum install wget’)

When prompted to choose an edition, go for ‘1’ – CE edition.

This will install Seafile itself, nginx to act as a proxy, MariaDB for the backend and any other software needed to support the install.

At the end of the install you’ll be provided with the default login details to allow you to configure your new installation.

Install SSL certificate

Firstly, make sure have have your DNS setup to point to the IP address you’ve installed Seafile on.  An A record for the subdomain you’re using pointing to the IP address will be sufficient.  If you’re a NetWeaver customer, there’s a guide here.

Now, inside your vps, edit the NGINX config file:

[root@server ~] nano /etc/nginx/conf.d/seafile.conf

On the third line down, where it says ‘server_name’, between the quotation marks add the same subdomain as you setup the DNS for.  Ensure it’s the full name – e.g. myfiles.nwdemo.co.uk

CTRL+O to save, and CTRL+X to exit.

Now install the Certbot so we can request a free SSL certificate from LetsEncrypt.

[root@server ~] yum install certbot-nginx

Then, run certbot.

[root@server ~] certbot

Answer the questions as prompted and I suggest also setting up the http to https redirect.

Install Firewall

Follow our UFW guide to install your firewall.  You should only need ports 80 (http) and 443 (https) open, as well as 22 for SSH if you don’t have a static IP address.

Alternatively, you could install CSF to allow for a more complex configuration.  You’ll need to ‘yum install perl-libwww-perl unzip bind-utils’ first to install the requirements, then follow the install guide here.

Configure Seafile

You’re now ready login to the Seafile web interface.  This will be accessible at the server name you’ve chosen above, with https:// in front of it – e.g. https://myfiles.nwdemo.co.uk

Login with the email address admin@seafile.local and the random password assigned during install.

First create a new admin user.  Click the head and shoulder silhouette in the top right hand corner and select ‘System Admin’.  Then click ‘Users’ on the menu to the left.

System Admin Menu

Add a new user, then visit the Admins tab and click ‘Add Admin’ to the make the new user into an administrator.

Log out, then log back in with the new account.  You can then delete the default user by returning to the same menu.

You’re now ready to get started with Seafile – please share your experiences in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu