Seafile is a file hosting application. It allows you to store your files on a central server which can be synchronised with personal computers and mobile devices through apps. You can directly access your files from seafile server via server's web interface. It is similar to other file hosting services such as Dropbox and Google Drive. But the difference between seafile and other file hosting services is that seafile is self-hosted file sharing solution for private cloud applications. Some of the features of Seafile are listed below:
Multi-platform file synchronisation
Public link sharing (upload and download)
Per-folder access control
Full text search
MS Office document preview and office web app integration
To install Seafile on your centos 7 server all you'll need is a CentOS 7 server and root privileges over it. You can always switch between non root user to root user using sudo -i command.
Update the System
Before going through the installation process it is recommended to update your system and upgrade available packages, you can do so using this command.
yum -y update
Log in to your server using your root password then edit Selinux configuration file using any text editor here we will use nano text editor, you can also install it using yum -y install nano
Find the line SELINUX=enforcing and replace it with SELINUX=disabled, save the file and exit from the text editor.
You'll need reboot the server to apply this change so reboot your server using reboot command and wait for server rebooting then log in again to your server as root user.
Installing the Seafile Dependencies
We will need to install some dependencies first to install seafile so here we will install several python packages, MariaDB and Nginx. We begin with the installation of the EPEL repository on our CentOS server.
yum -y install epel-release
Next, install the python packages, MariaDB and Nginx like shown below:
It may take some time so you should wait until all packages are installed.
We have successfully installed MariaDB now we will need to configure MariaDB for Seafile. Start MariaDB and configure the root password with the commands below:
systemctl start mariadbmysql_secure_installation
You'll be asked to provide root password so simply type in your root password and answer yes to all questions by typing Y.
Set root password? [Y/n] Y
Re-enter new password:
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
We will create 3 databases for seafile:
And we will create a new user 'seacloud' with the password 'yourpassword'. Replace yourpassword with a secure password.
mysql -u root -p
Type your password and run following queries to create databases and the user for the seafile installation.
Execute all queries one by one.
create database ccnet_db character set = 'utf8';
create database seafile_db character set = 'utf8';
create database seahub_db character set = 'utf8';
create user seacloud@localhost identified by 'yourpassword';
grant all privileges on ccnet_db.* to seacloud@localhost identified by 'yourpassword';
grant all privileges on seafile_db.* to seacloud@localhost identified by 'yourpassword';
grant all privileges on seahub_db.* to seacloud@localhost identified by 'yourpassword';
We have installed all the dependencies required now we are ready to install seafile. Seafile will be executed under the nginx user so we can use nginx as the reverse proxy for the seafile and seahub services.
We will install seafile under the nginx user in the directory '/var/www/seafile', create that dirctory and enter it with cd command.
mkdir -p /var/www/seafilecd /var/www/seafile
Next, download the Seafile with the wget command, and extract the downloaded archive as shown below:
Now you'll have to execute the 'setup-seafile-mysql.sh' file to configure the database.
You'll be asked for following information.
server name - Use your server name
server's ip or domain - ip address of your server
default data dirctory - just press Enter
default port - press Enter
Now for the database configuration, choose number 2
For the MySQL configuration:
use deafult host - localhost
default port - 3306
the mysql user - 'seacloud'
and the password is 'yourpassword'
ccnet database is 'ccnet_db'
seafile database is 'seafile_db'
seahub database is 'seahub_db'
Finally press enter and the script will create the database tables for the seafile. Now let's start the seafile and seahub services using following commands.
./seafile.sh start./seahub.sh start
You'll be asked for the admin configuration like your admin email and password, then the seahub service will running.
We will use a reverse proxy for the seafile server and we will run seafile with a systemd service file. So we need to stop seafile and seahub service for now. So please run following commands to stop these services.
./seafile.sh stop./seahub.sh stop
Configure Seafile and Seahub Service
We need to change the owner of seafile installation directory and seahub_cache directory to nginx user so we can run seafile as nginx user and to do so run following commands.
cd /var/www/chown -R nginx:nginxchown -R nginx:nginx /tmp/seahub_cache
Next we will need to create a system.service file using any text editor run following command it will do the job for you.
cd /etc/systemd/system/nano seafile.service
Add following content to the service file.
We will run seafile and seahub as nginx user over a Nginx proxy. We can use a free SSL certificate file or the paid SSL certificate, this does not matter for the configuration, here we will generate self-signed SSL certificate file with the OpenSSL.
First of all create a ssl directory using following commands.
mkdir -p /etc/nginx/sslcd /etc/nginx/ssl
Now we can generate self signed certificate files and a dhparam file with command below:
Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will...
Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you...