How to Install Seafile Server on Debian

Jul 01, 2020

I was using owncloud to store my files, but your performance and the lack of a free official Android app made me look for change.

After some search I found Seafile. I tested it and the speed (the core is in C language) satisfied me. The web interface is nice as well as the Android app. And it has one feature that I really liked, the client-side end-to-end encryption, where you can encrypt data using a key in client side that isn’t stored on the server side.

So in this post I will show how to install a Seafile Server on Debian and use it in a Debian Desktop. I used Debian Buster, but this how-to can work in other versions or Ubuntu, as there’s nothing strictly specific that depends on the installed system.

I used Seafile server on a remote server. To provide a secure connection between the clients and the server you must use HTTPS, for that I used Apache.

Step 1 – Download and Configure Seafile Server

I used SQLite as database. And the place to store files will be in /sea. Let’s start.

First, install the dependencies.

# apt install python2.7 libpython2.7 python-setuptools python-ldap python-urllib3 sqlite3 python-requests python3-pip
# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha python3-ldap

Find the tarball of the server here. I used the version 7.1.4.

# mkdir -p /sea/seafile/installed
# cd /sea/seafile/installed
# wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.4_x86-64.tar.gz
# cd ..
# tar xf installed/seafile-server_7.1.4_x86-64.tar.gz
# cd seafile-server-7.1.4
# ./setup-seafile.sh
       enter a name of this server
       and their address

Now configure ccnet (a RPC used by Seafile server). Edit the file ../conf/ccnet.conf and change SERVICE_URL to:

SERVICE_URL = https://address:HTTSPORT

The last fundamental config is the seahub (the web client). Just add the line below to the file ../conf/seahub_settings.py.

FILE_SERVER_ROOT = 'https://address:HTTPSPORT/seafhttp'

Now you can start the seafile and the seahub.

# ./seafile.sh start
# ./seahub.sh start
      Seahub will ask the mail of admin and a password. You will
      need to use these to add users after.

It’s a good idea to use systemd to start/stop Seafile server. To do that please check this tutorial.

Step 2 – Configure Apache

Create the file /etc/apache2/sites-available/seafile.conf with the content:

<IfModule mod_ssl.c>
	<VirtualHost _default_:YOURHTTPSPORT>
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		SSLEngine on

		SSLCertificateFile	YOUR .crt
		SSLCertificateKeyFile YOUR .key

		######### seafile
		Alias /media  /sea/seafile/seafile-server-latest/seahub/media

		<Location /media>
		    Require all granted
		</Location>

		RewriteEngine On
                
		#
		# seafile fileserver
		#
		ProxyPass /seafhttp http://127.0.0.1:8082
		ProxyPassReverse /seafhttp http://127.0.0.1:8082
		RewriteRule ^/seafhttp - [QSA,L]

		#
		# seahub
		#
		SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
		ProxyPreserveHost On
		ProxyPass / http://127.0.0.1:8000/
		ProxyPassReverse / http://127.0.0.1:8000/
                
	</VirtualHost>
</IfModule>

Enable it and reload Apache.

# a2ensite seafile
# systemctl reload apache2

Final

Now you can access https://address:HTTPSPORT from your browser to add users.

For Desktop client I use seafile-gui. You can use Debian repository or get (probably) a more recent version here.

apachedebianseafile

Back to talau's home