How To Install Seafile on CentOS 7

Seafile on CentOS 7

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.

Prerequisites

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 and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Seafile Secure Cloud Storage on a CentOS 7 server.
Install Seafile on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing required packages.

Seafile storage setup requires some Python modules that must be installed on your server:

yum install python-imaging MySQL-python python-memcached python-ldap python-urllib3

Step 3. Installing MariaDB.

Install MariaDB using Yum:

yum install epel-release
yum install mariadb mariadb-server

Start MariaDB and enable it to start on boot of the server:

systemctl start mariadb.service
systemctl enable mariadb.service

Configuring MariaDB for Seafile.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Step 4. Installing Seafile.

First thing to do is to go to Seafile’s download page and download the latest stable version of Seafile, At the moment of writing this article it is version 6.0.8:

wget https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.8_x86-64.tar.gz

Unpack the Seafile archive to the document root directory on your server:

sudo mkdir -p /opt/seafile/installed
sudo mv seafile-server_6.0.8_x86-64.tar.gz /opt/seafile/installed
sudo mv seafile-server-6.0.8/ /opt/seafile

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:

cd /opt/seafile/seafile-server-6.0.8
sudo ./setup-seafile-mysql.sh

After the installation finishes, run the following commands to start Seafile server and setup an admin user account:

sudo ./seafile.sh start
sudo ./seahub.sh start

Step 5. Configure firewall rules for Seafile.

You need to modify firewall rules using these commands:

sudo firewall-cmd --zone=public --permanent --add-port=8082/tcp
sudo firewall-cmd --zone=public --permanent --add-port=8000/tcp
sudo firewall-cmd --reload

Step 6. Accessing Seafile.

Seafile 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.
seafile-web-interface-login
Congratulation’s! You have successfully installed Seafile. Thanks for using this tutorial for installing Seafile Secure Cloud Storage on CentOS 7 system. For additional help or useful information, we recommend you to check the official Seafile web site.

How To Install Seafile on Ubuntu 16.04 LTS

Install Seafile on Ubuntu 16

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 and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Seafile open source secure cloud storage on a Ubuntu 16.04 (Xenial Xerus) server.
Install Seafile on Ubuntu 16.04 LTS Xenial Xerus

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Install LEMP (Linux, Nginx, MariaDB, PHP) server.

A Ubuntu 16.04 LAMP server is required. If you do not have LEMP installed, you can follow our guide here. Also install all required PHP modules:

apt-get install php7.0-curl php7.0-gd php7.0-mbstring php7.0-mysql libapache2-mod-php7.0 php7.0-mcrypt php7.0-zip

Installing Python modules:

apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-mysqldb python-memcache python-urllib3

Step 3. Configure the MariaDB database for Seafile.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. You should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB.

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next we will need to log in to the MariaDB console and create a database for the Seafile. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Seafile installation:

MariaDB [(none)]> create database ccnet_db character set = 'utf8'; MariaDB [(none)]> create database seafile_db character set = 'utf8'; MariaDB [(none)]> create database seahub_db character set = 'utf8';
MariaDB [(none)]> create user seacloud@localhost identified by 'password';
MariaDB [(none)]> grant all privileges on ccnet_db.* to seacloud@localhost identified by 'password'; MariaDB [(none)]> grant all privileges on seafile_db.* to seacloud@localhost identified by 'password'; MariaDB [(none)]> grant all privileges on seahub_db.* to seacloud@localhost identified by 'password';
MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit

Step 4. Installing Seafile on Server.

You need to download the last stable release of Seafile:

wget https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.6_x86-64.tar.gz

Extract the tarball into the current directory:

tar -xvzf seafile-server_6.0.6_x86-64.tar.gz
mv seafile-server_6.0.6 seafile-server

Install Seafile:

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 /lib/systemd/system/seafile.service

Add the following lines:

[Unit]
Description=Seafile Server
After=network.target mariadb.service[Service]
Type=oneshot
ExecStart=/home/seafile/seafile-server/seafile.sh start
ExecStop=/home/seafile/seafile-server/seafile.sh stop
RemainAfterExit=yes
User=seafile
Group=seafile[Install]
WantedBy=multi-user.target

Save the file and create a new service file for seahub:

[Unit]
Description=Seafile Hub
After=network.target seafile.target[Service]
Type=oneshot
ExecStart=/home/seafile/seafile-server/seahub.sh start-fastcgi
ExecStop=/home/seafile/seafile-server/seahub.sh stop
RemainAfterExit=yes
User=seafile
Group=seafile[Install]
WantedBy=multi-user.target

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

systemctl daemon-reload 
systemctl start seafile
systemctl start seahub

Step 6. Configuring Nginx web server for Seafile.

*Note: A static IP address 192.168.77.21 configure on your server.

First, create a new virtual host file with name seafile.conf:

nano /etc/nginx/sites-available/seafile.conf

Add the following lines:

server {
    listen 80;
    server_name 192.168.77.21;proxy_set_header X-Forwarded-For $remote_addr;# Reverse proxy for seafile
    location / {
        fastcgi_pass    127.0.0.1:8000;
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;fastcgi_param    SERVER_PROTOCOL        $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param   SERVER_ADDR         $server_addr;
        fastcgi_param   SERVER_PORT         $server_port;
        fastcgi_param   SERVER_NAME         $server_name;
        fastcgi_param   REMOTE_ADDR         $remote_addr;access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
        fastcgi_read_timeout 36000;
    }# Reverse Proxy for seahub
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }#CHANGE THIS PATH WITH YOUR OWN DIRECTORY
    location /media {
        root /home/seafile/seafile-server/seahub;
    }
}

Save the file and restart nginx:

systemctl restart nginx

Step 7. Accessing Seafile.

Seafile cloud storage will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com or http://192.168.77.21. 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.

seafile-web-interface-login

Congratulation’s! You have successfully installed Seafile. Thanks for using this tutorial for installing Seafile open source secure cloud storage on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Seafile web site.

How To Install Seafile on CentOS 6

Install Seafile on CentOS 6

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 CentOS 6.

Install Seafile on CentOS 6

Step 1. First, Install required packages.

yum -y update
yum -y install python-imaging MySQL-python python-simplejson python-setuptools

Step 2. Download and install the latest version of Seafile.

Create a new user that will be used to run the seafile services:

adduser seafile
passwd seafile
su -seafile

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
tar xfz seafile-server_4.0.6_x86-64.tar.gz
cd seafile-server_4.0.6/

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 3. Configure Iptables or firewall

# nano /etc/sysconfig/iptables
-A INPUT -p udp -m state --state NEW --dport 8000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 8000 -j ACCEPT

Restart iptables to apply rules using the following command:

 service iptables restart

Step 4. Starting the Seafile services.

Now run the ‘seafile.sh’ and ‘seahub.sh’ scripts to start the Seafile server.

su - seafile
cd seafile-server_4.0.6
./seafile.sh start
./seahub.sh start

Step 5. Accessing Seafile.

Seafile 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.

seafile-web-interface-login

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

You Might Also Like: How To Install Seafile on Ubuntu 14.04

How To Install Seafile on Ubuntu 14.04

Install Seafile on Ubuntu 14

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