How To Install Seafile on Ubuntu 14.04

Seafile is a open source cloud storage software. It offers file sharing and syncing for individual users and groups, it provides client side encryption and easy access from mobile devices. Also easily integrated with local services such as LDAP and WebDAV or can be deployed using advanced network services and databases like MySQL, SQLite, PostgreSQL, Memcached, Nginx or Apache Web Server.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. We will show you through the step by step How To Install Seafile on Ubuntu 14.04.

Install Seafile on Ubuntu 14.04

Step 1. First, you need to update the system to ensure that we have all of the latest software installed.

 apt-get update

Step 2. Install required packages.

Install LAMP:

 sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5

Install Python modules:

 sudo apt-get install python2.7 sqlite python-simplejson python-setuptools python-imaging python-mysqldb

Step 3. Download the Seafile components.

You need to download the last relase of Seafile:

 wget https://bitbucket.org/haiwen/seafile/downloads/seafile-server_4.0.6_x86-64.tar.gz

Extract the tarball into the current directory:

 
tar xzvf seafile-server*
cd seafile-server*

Step 4. Install Seafile server.

Run this script which will create the required databases and directories for the Seafile server and and answer all questions using the following configuration options, after the script verifies the existence of all Python required modules:

 ./setup-seafile-mysql.sh

After Seafile server successfully installs, it will generate some useful information such as what ports needs to be open on your Firewall to allow external connection and what scripts to handle in order to start the server.

Step 5. Starting the Seafile services.

Create startup script for the Seafile server like this:

 #nano /etc/init.d/seafile
#!/bin/bash
# Change the value of "user" to your linux user name
user=haiwen
# Change the value of "seafile_dir" to your path of seafile installation
seafile_dir=/data/haiwen
script_path=${seafile_dir}/seafile-server-latest
seafile_init_log=${seafile_dir}/logs/seafile.init.log
seahub_init_log=${seafile_dir}/logs/seahub.init.log
# Change the value of fastcgi to true if fastcgi is to be used
fastcgi=false
# Set the port of fastcgi, default is 8000. Change it if you need different.
fastcgi_port=8000
case "$1" in
        start)
                sudo -u ${user} ${script_path}/seafile.sh start >> ${seafile_init_log}
                if [  $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh start-fastcgi ${fastcgi_port} >> ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh start >> ${seahub_init_log}
                fi
        ;;
        restart)
                sudo -u ${user} ${script_path}/seafile.sh restart >> ${seafile_init_log}
                if [  $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh restart-fastcgi ${fastcgi_port} >> ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh restart >> ${seahub_init_log}
                fi
        ;;
        stop)
                sudo -u ${user} ${script_path}/seafile.sh $1 >> ${seafile_init_log}
                sudo -u ${user} ${script_path}/seahub.sh $1 >> ${seahub_init_log}
        ;;
        *)
                echo "Usage: /etc/init.d/seafile {start|stop|restart}"
                exit 1
        ;;
esac

Add directory for log files:

 mkdir /path/to/seafile/dir/logs

Create a file /etc/init/seafile.conf:

 #nano /etc/init/seafile.conf
start on (started mysql
and runlevel [2345])
stop on (runlevel [016])

pre-start script
/etc/init.d/seafile-server start
end script

post-stop script
/etc/init.d/seafile-server stop
end script,

Make the seafile-sever script executable:

 sudo chmod +x /etc/init.d/seafile

Now try using the service and command to start a new Seafile server instance:

 service seafile start

Step 6. Accessing Seafile.

Seafile cloud storage will be available on HTTP port 8000 by default. Open your favorite browser and navigate to http://yourdomain.com:8000 or http://server-ip:8000. Enter the admin email id and password to login  which you have created at the time of installation. If you are using a firewall, please open port 8000 to enable access to the control panel.

Install Seafile on Ubuntu 14.04

Congratulation’s! You have successfully installed Seafile. Thanks for using this tutorial for installing Seafile open source cloud storage on Ubuntu 14.04 system.

You Might Also Like: How To Install Seafile on CentOS 6

Leave a Reply