How To Install Seafile on Ubuntu 14.04

By | September 28, 2015

Hello,

Seafile is a one of wellknown private cloud software. We can use the Community version free or Profesional version free or 3 users only. Please make sure you re-install the bsdutils on Ubuntu due some error on Minimal version of Ubuntu.

apt-get --reinstall install bsdutils

Then we can install the pre-requirement package needed for Seafile

sudo apt-get install mysql-server poppler-utils libpython2.7 python-pip python-setuptools python-imaging python-mysqldb python-memcache

For Proffesional version, we also need Java SDK

sudo apt-get install openjdk-7-jre

Install boto package

sudo pip install boto

We can do a bit of MySQL housekeeping before we begin installing our service. First, initialize the MySQL data directory:

sudo mysql_install_db

Next, we can run a security script that asks us some questions in order to lock down some settings:

sudo mysql_secure_installation

Download the SeaFile at http://seafile.com/en/download/ and extract. To install using MySQL please run this command

./setup-seafile-mysql.sh

After the installation finish, we can also combine Seafile with Apache. Please follow this command to use Apache on Seafile
Please aneble the multiverse repository to install fast-cgi. Once the multiverse repos are enabled, run an update and install the two packages:

sudo apt-get update
sudo apt-get install apache2 libapache2-mod-fastcgi

Then enable these modules:

a2enmod rewrite
a2enmod fastcgi
a2enmod proxy_http

Before we move ahead let’s create the web directory where we will download Seafile packages. On Ubuntu it should be under /var/www/

sudo mkdir -p /var/www/directory_name

Now we have to create a vhost file for the seafile server:

nano /etc/apache2/sites-available/your_vhost_name.conf

The vhost file should look something like the one below:


   ServerName www.your-domain-name.com
 # Use "DocumentRoot /var/www/html" for Centos/Fedora
 # Use "DocumentRoot /var/www" for Ubuntu/Debian
   DocumentRoot /var/www/your-directory/
   Alias /media /var/www/your-directory/seafile-server-latest/seahub/media
   RewriteEngine On 
    
       Require all granted
    

    
        Require all granted
    
 # seafile fileserver
   ProxyPass /seafhttp http://127.0.0.1:8082
   ProxyPassReverse /seafhttp http://127.0.0.1:8082
   RewriteRule ^/seafhttp - [QSA,L]
 # seahub
   RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /seahub.fcgi$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

In your vhost you have to change three things:
ServerName to reflect the URL or your server
DocumentRoot provide the path to the directory we created above
Alias /media /var/www/your_directory_path/seafile-server-latest/seahub/media

Open the apache.conf file

nano /etc/apache2/apache2.conf

and add the this line at the end (don’t forget to change the path of directory):

FastCGIExternalServer /var/www/your_directory_path/seahub.fcgi -host 127.0.0.1:8000

Open ccnet.conf with desired editor, I use nano:

sudo nano /var/www/your-directory/ccnet/ccnet.conf

In this file check that the ‘SERVICE_URL’ points to the correct domain.

SERVICE_URL = http://www.your_domain.com:8000

Now edit the second config file:

sudo nano /var/www/your-directory/seahub_settings.py

and add the following line before DATABASES

FILE_SERVER_ROOT = ‘http://www.your-domain.com/seafhttp’

First we have to run a script which will enable the site which we configured within the apache2 configuration

a2ensite your_vhost_name.conf
service apache2 restart

Finally, we need to run the seafile server

/var/www/your-directory/seafile-server-latest/./seafile.sh start
/var/www/your-directory/seafile-server-latest/./seahub.sh start-fastcgi

Have fun with Seafile…