Install and configure Seafile storage on CentOS 8

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatturn off

How to install and configure Seafile on CentOS 8? Seafile Server is an open source, enterprise-level, self-hosted file hosting platform designed to improve performance and high reliability. Seafile enables you to place files on your own server and allows different devices to synchronize and access it. You can also access all files as virtual disks. In this blog, we will study how to install and configure Seafile file sharing server on CentOS 8.

The following are some important functions of Seafile, which constitute a reliable file sharing platform:

  • encrypt documents
  • File lock
  • Online editing and co-authoring
  • File version control and snapshots
  • Mobile file access
  • Easy to install and use the client
  • File sharing and permission control

Install Seafile Storage Server on CentOS 8

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

Step 1: Update the system and set the hostname

We will first disable CentOS selinux to ensure that it does not prevent any installations we will perform.

$ sudo vim /etc/selinux/config
# This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
#     enforcing - SELinux security policy is enforced. 
#     permissive - SELinux prints warnings instead of enforcing. 
#     disabled - No SELinux policy is loaded. 
SELINUX=disabled
# SELINUXTYPE= can take one of these three values: 
#     targeted - Targeted processes are protected, 
#     minimum - Modification of targeted policy. Only selected processes are protected.  
#     mls - Multi Level Security protection. 
SELINUXTYPE=targeted

After disabling Selinux, run the update on CentOS 8.

sudo dnf -y update
sudo dnf -y upgrade

Now configure the hosts file and set the server hostname

sudo hostnamectl set-hostname seafile.example.com
echo “<your-server-ip> seafile.example.com” | sudo tee -a /etc/hosts

Restart the system

sudo reboot

Step 2: Add EPEL repository and install dependencies

First let’s install Seafile dependencies and required packages

sudo dnf -y install epel-release
sudo dnf -y install python3 python3-imaging MySQL-python3 python3-simplejson python3-setuptools mariadb mariadb-server nginx

Step 3: Configure MariaDB database server

When installing the dependencies, we have already installed MariaDB. Let us proceed with the configuration. Start MariaDB and enable it to start when the system boots.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Ensure that mariadb is installed securely and set a 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 database

After configuring MariaDB, we will continue to create Seafile users and databases. Use the following command to connect to MySQL, and then enter 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

After connecting to MySQL, run the following command to create the required database:

create database ccnet_db character set="utf8";
create database seafile_db character set="utf8";
create database seahub_db character set="utf8";
create user [email protected] identified by 'yourpassword';
grant all privileges on ccnet_db.* to [email protected] identified by 'yourpassword';
grant all privileges on seafile_db.* to [email protected] identified by 'yourpassword';
grant all privileges on seahub_db.* to [email protected] identified by 'yourpassword';
flush privileges;
exit

Step 5: Install Seafile on CentOS 8

We will install Seafile in the /var/www path.

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

Use the wget command to download Seafile, and then unzip the downloaded archive.

wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.5_x86-64.tar.gz

Unzip the downloaded file

sudo tar xvf seafile-server_7.1.5_x86-64.tar.gz 

Rename the directory to “seafile-server” and then switch to that directory.

 sudo mv seafile-server-7.1.5/ seafile-server

Step 6: Configure Seafile on CentOS 8

carried out”Installer 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 ]  Enter seacloud password
                                                                                                                 
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. Use the following command to start seafile:

$ 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

$ ./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 ] [email protected] 

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 
---------------------------------------- 
!!! 
!!! WARNING: configuration file should have a valid Python extension. 
!!! 

Error:Seahub failed to start. 
Please try to run "./seahub.sh start" again
Seahub Failed to start.

As you can see from the above output, seahub is not started. In order to get related errors, start seafile with the following command:

$ sudo ./seahub.sh start-fastcgi

from _sha1 import sha1 
ModuleNotFoundError: No module named '_sha1' 
Error:Seahub failed to start.

The output shows that the error is about unsupported sha1. I replaced “Import sha1 from _sha1“with”Import hashlib/var/www/sea​​file/seafile-server/seahub/seahub/repo_api_tokens/models.py. The file looks like this:

$ sudo vim /var/www/seafile/seafile-server/seahub/seahub/repo_api_tokens/models.py
import hashlib 
import hmac 
import uuid 
from django.db import models

Save the file and start seahub again

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

Step 7: Configure the firewall

If the file wall is active, make sure to open the seafile port 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: Visit Seafile on the browser

Use the hostname/IP address on port 8000 to access seafile from the browser: http: // <您的主机名>: 8000. If you find that your seafile is not loaded in the browser, please check the seafile gunicorn configuration. Make sure it is not bound to the 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"

Save the file and you should be able to start seafile in your browser. You should see the following page:

Log in with the administrator credentials you configured earlier, and you will see a page as shown below:Install and configure Seafile storage on CentOS 8

To start adding a new folder/file, click “New Library” and provide a name for your new folder, then click “Submit”.Install and configure Seafile storage on CentOS 8

You should be able to select a new library and then create or upload a folder/file.Install and configure Seafile storage on CentOS 8

Step 9: Configure Seafile client

We will use an Ubuntu 20.04 Client computer to test the connection to Seafile Server.

To connect to Seafile on Ubuntu 20.04, first run the following command to install the 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 only, run the following command:

sudo apt-get install seafile-cli

After the installation is complete, search for the seafile client in your application and you should see it.Install and configure Seafile storage on CentOS 8

Double-click to open and select a folder for your library, then click NextInstall and configure Seafile storage on CentOS 8

Now provide the detailed information of your seafile server connection:Install and configure Seafile storage on CentOS 8

When you click “log in‘You should connect to the seafile server as shown:Install and configure Seafile storage on CentOS 8

That’s it. Enjoy the fun of using Seafile installation. I hope the blog is rich in content. Check out more interesting guides below:

  • Nextcloud VS owncloud vs Seafile vs Syncthing
  • Install Pydio Cells file sharing on Centos 8
  • Install Pydio Cells file sharing on Ubuntu 20.04
  • Install and configure synchronization on CentOS 8 / CentOS 7
  • Install and configure Nextcloud 19 on Debian 10 (Buster)
  • Let’s encrypt and install Nextcloud on CentOS 7

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatturn off

Sidebar