We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install and Configure Seafile Storage on CentOS 8

Learn how to – Install and Configure Seafile Storage on CentOS 8.

How can I install and configure Seafile on CentOS 8?. Seafile server is an open source, enterprise, self-hosted file hosting platform build for performance and high reliability. Seafile enables you to put files on your own server and allow your different devices to sync and access it. You can as well access all the files as a virtual disk. In this blog, we are going to look at how to install and configure Seafile file sharing server on CentOS 8.

The following are some of the important features of Seafile that makes a reliable file sharing platform:

  • File encryption
  • File locking
  • Online editing and co-authoring
  • File Versioning and Snapshot
  • Mobile File Access
  • Easy to install and use client
  • File Sharing and Permission Control

Install Seafile Storage Server on CentOS 8

These are the steps you’ll follow to install and configure Seafile Storage Server on CentOS 8 system.

Step 1: Update System and Set hostname

We will first put SELinux in Permissive mode to ensure that it does not prevent any installation we are going to perform.

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
cat /etc/selinux/config | grep SELINUX=

After disabling Selinux, run updates on your CentOS 8.

sudo dnf -y update

Now configure hosts file and set server hostname

sudo hostnamectl set-hostname seafile.example.com

Update IP and hostname set in /etc/hosts file

$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 6a:42:06:78:a3:6a brd ff:ff:ff:ff:ff:ff
    inet 10.116.0.2/20 brd 10.116.15.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6842:6ff:fe78:a36a/64 scope link
       valid_lft forever preferred_lft forever

$ sudo vi /etc/hosts
10.116.0.2 seafile.example.com #example

Reboot your system

sudo reboot

Step 2: Add EPEL repo and install dependencies

First let us install Seafile dependencies and required packages

sudo dnf -y install vim epel-release
sudo dnf -y install python3 python3-devel python3-imaging MySQL-python3 python3-simplejson python3-setuptools mariadb mariadb-server nginx gcc mysql-devel

Pip3 modules installation:

sudo pip3 install --upgrade pip
sudo python3 -m pip install --upgrade Pillow
sudo pip3 install pylibmc captcha jinja2 django-pylibmc django-simple-captcha python3-ldap mysqlclient
sudo pip3 install future sqlalchemy==1.4.3

Step 3: Configure MariaDB Database Server

We have already installed MariaDB when installing dependencies. Let us go ahead to configure it. Start MariaDB and enable it to start on system boot.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure mariadb installation and set root password.

$ sudo mysql_secure_installation
Enter current password for root (enter for none):  Press Enter
Set root password? [Y/n] y
New password:  Enter New Password
Re-enter new password:  Repeat 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 
... Success! 
Cleaning up... 
All done!  If you've completed all of the above steps, your MariaDB

Step 4: Create Seafile Databases

Having configured MariaDB, we will go ahead to create Seafile user and databases. Connect to MySQL using the command below and type the password you set above.

mysql -u root -p 

We will create a user for Seafile and the following three databases:

  • ccnet_db
  • seafile_db
  • seahub_db

Once you connect to MySQL, run the following commands to create the required databases:

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 'StrongDBPassw0rd';
grant all privileges on ccnet_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
grant all privileges on seafile_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
grant all privileges on seahub_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
flush privileges;
exit

Step 5: Install Seafile on CentOS 8

We are going to install Seafile in /var/www path.

sudo mkdir -p /var/www/seafile
cd /var/www/seafile

Download Seafile with wget command, and extract the downloaded archive.

sudo dnf install -y wget
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_8.0.7_x86-64.tar.gz

Extract the downloaded file

sudo tar xvf seafile-server_8.0.7_x86-64.tar.gz

Rename the directory to ‘seafile-server’ and switch to that directory.

sudo mv seafile-server-8.0.7/ seafile-server
sudo rm -f seafile-server_8.0.7_x86-64.tar.gz

Step 6: Configure Seafile on CentOS 8

Execute the ‘setup-seafile-mysql.sh‘ file to configure the database.

$ cd  seafile-server
$ sudo ./setup-seafile-mysql.sh

Checking python on this machine ... 
----------------------------------------------------------------- 
This script will guide you to setup your seafile server using MySQL. 
Make sure you have read seafile server manual at 

       https://download.seafile.com/published/seafile-manual/home.md 

Press ENTER to continue 
----------------------------------------------------------------- 
What is the name of the server? It will be displayed on the client. 
3 - 15 letters or digits 
[ server name ] seafile 
What is the ip or domain of the server? 
For example: www.mycompany.com, 192.168.1.101 
[ This server's ip or domain ] seafile.example.com

Which port do you want to use for the seafile fileserver? 
[ default "8082" ]  

------------------------------------------------------- 
Please choose a way to initialize seafile databases: 
------------------------------------------------------- 

[1] Create new ccnet/seafile/seahub databases 
[2] Use existing ccnet/seafile/seahub databases 

[ 1 or 2 ] 2 

What is the host of mysql server? 
[ default "localhost" ]  press Enter

What is the port of mysql server? 
[ default "3306" ]  Press Enter

Which mysql user to use for seafile? 
[ mysql user for seafile ] seacloud

What is the password for mysql user "seahub"? 
[ password for seahub ]  StrongDBPassw0rd
                                                                                                                 
verifying password of user seacloud ...  done 

Enter the existing database name for ccnet: 
[ ccnet database ] ccnet_db 

verifying user "seacloud" access to database ccnet_db ...  done 

Enter the existing database name for seafile: 
[ seafile database ] seafile_db 

verifying user "seacloud" access to database seafile_db ...  done 

Enter the existing database name for seahub: 
[ seahub database ] seahub_db 

verifying user "seacloud" access to database seahub_db ...  done 

--------------------------------- 
This is your configuration 
--------------------------------- 

   server name:            seafile 
   server ip/domain:       seafile.example.com 

   seafile data dir:       /var/www/seafile/seafile-data 
   fileserver port:        8082 

   database:               use existing 
   ccnet database:         ccnet_db 
   seafile database:       seafile_db 
   seahub database:        seahub_db 
   database user:          seacloud 
--------------------------------- 
Press ENTER to continue, or Ctrl-C to abort

--------------------------------- 

Generating ccnet configuration ... 

done 
Successly create configuration dir /var/www/seafile/ccnet. 
Generating seafile configuration ... 

Done. 
done 
Generating seahub configuration ... 
---------------------------------------- 
Now creating ccnet database tables ... 

---------------------------------------- 
---------------------------------------- 
Now creating seafile database tables ... 

---------------------------------------- 
---------------------------------------- 
Now creating seahub database tables ... 

---------------------------------------- 

creating seafile-server-latest symbolic link ...  done 

----------------------------------------------------------------- 
Your seafile server configuration has been finished successfully. 
----------------------------------------------------------------- 

run seafile server:     ./seafile.sh { start | stop | restart } 
run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> } 

----------------------------------------------------------------- 
If you are behind a firewall, remember to allow input/output of these tcp ports: 
----------------------------------------------------------------- 

port of seafile fileserver:   8082 
port of seahub:               8000 

When problems occur, Refer to 

       https://download.seafile.com/published/seafile-manual/home.md 

for information. 

Now we can start the seafile and seahub services. Start seafile with the below command:

$ sudo ./seafile.sh start
[08/17/20 11:16:33] ../common/session.c(148): using config file /var/www/seafile/conf/ccnet.conf 
Starting seafile server, please wait ... 
** Message: seafile-controller.c(563): No seafevents. 

Seafile server started 

Done.

Start seahub service

$ sudo ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8 
Starting seahub at port 8000 ... 

---------------------------------------- 
It's the first time you start the seafile server. Now let's create the admin account 
---------------------------------------- 

What is the email for the admin account? 
[ admin email ] admin@example.com 

What is the password for the admin account? 
[ admin password ]  Enter Admin password

Enter the password again: 
[ admin password again ]  Repeat Admin password
----------------------------------------
Successfully created seafile admin
----------------------------------------

Seahub is started

Done.

Step 7: Configure Firewall

If your filewall is active, ensure to open seafile ports through the firewall:

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

Step 8: Accessing Seafile on Browser

Access seafile from your browser using your hostname/Ip address on port 8000: http://<your-hostname>:8000. If you find that your seafile is not loading on browser, check seafile gunicorn configuration. Ensure that it does not bind to local IP address as shown below:

$ sudo vim /var/www/seafile/conf/gunicorn.conf.py
# default localhost:8000 
#bind = 127.0.0.1:8000
bind = "0.0.0.0:8000"

Then restart seahub service

$ sudo ./seahub.sh restart
Stopping seahub ...
Starting seahub at port 8000 ...

Seahub is started

Done.

Save the file and you should be able to lanuch seafile on the browser. You should see a page as below:

Login with the admin credentials you configured earlier and you should get a page as shown:

To start adding new folders/files, click on ‘New Library’ and provide a name to your new folder then click ‘submit’.

You should be able to select your new library and either create or upload a folder/file.

Step 9: Configure Seafile Client

We will use Ubuntu 20.04 Client machine to test connectivity to the Seafile Server.

To connect to Seafile on Ubuntu 20.04, first run the below command to install seafile client on Ubuntu 20.04

sudo wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc
sudo bash -c "echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/focal/ stable main' > /etc/apt/sources.list.d/seafile.list"
sudo apt update
sudo apt install -y seafile-gui

For cli use only, run the command:

sudo apt-get install seafile-cli

Once installed, search for seafile client on your applications and you should see it.

Double click to open and choose a folder for your libraries and click next

Now provide particulars for your seafile server to connect to:

When you click ‘Login’ you should be connected to your seafile server as shown:

That’s it. Enjoy using your Seafile installation. I hope the blog has been informative. Check more interesting guides below:

Cart

Your Cart is Empty

Back To Shop