在CentOS 8上安裝和配置Seafile存儲

如何在CentOS 8上安裝和配置Seafile? Seafile Server是提供性能和可靠性的開源企業自託管文件託管平台。 Seafile允許您將文件放在自己的服務器上,並在不同設備上同步訪問它們。您還可以將所有文件作為虛擬磁盤訪問。在此博客中,我們將研究如何在CentOS 8上安裝和配置Seafile文件共享服務器。

以下是Seafile的一些關鍵功能,它們提供了可靠的文件共享平台。

  • 文件加密
  • 文件鎖
  • 與在線編輯共同創作
  • 文件版本控制和快照
  • 移動文件訪問
  • 易於安裝和使用客戶端
  • 文件共享和權限控制

在CentOS 8上安裝Seafile Storage Server

這些是在CentOS 8系統上安裝和配置Seafile Storage Server的步驟。

步驟1:更新系統並設置主機名

首先禁用CentOS selinux,以使正在運行的安裝不會中斷。

$ 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

禁用Selinux後,在CentOS 8上運行更新。

sudo dnf -y update
sudo dnf -y upgrade

然後配置主機文件並設置服務器的主機名

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

重新啟動系統

sudo reboot

步驟2:添加EPEL存儲庫並安裝依賴項

首先,讓我們安裝Seafile依賴項和所需的軟件包

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

步驟3:配置MariaDB數據庫服務器

安裝依賴項時,已經安裝了MariaDB。讓我們繼續進行設置。 啟動MariaDB,以便可以在系統啟動時啟動它。

sudo systemctl start mariadb
sudo systemctl enable mariadb

保護您的mariadb安裝並設置root密碼。

$ 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

步驟4:創建一個Seafile數據庫

配置MariaDB之後,繼續創建Seafile用戶和數據庫。使用以下命令連接到MySQL,然後輸入您在上面設置的密碼。

mysql -u root -p 

創建一個Seafile和三個數據庫用戶:

  • ccnet_db
  • seafile_db
  • seahub_db

連接到MySQL後,運行以下命令來創建所需的數據庫。

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

步驟5:在CentOS 8上安裝Seafile

在/ var / www路徑中安裝Seafile。

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

使用wget命令下載Seafile並解壓縮下載的檔案。

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

解壓下載的文件

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

將目錄重命名為“ seafile-server”,然後切換到該目錄。

 sudo mv seafile-server-7.1.5/ seafile-server

步驟6:在CentOS 8上配置Seafile

‘跑安裝程序seafile-mysql.sh‘組成數據庫的文件。

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

現在,您可以啟動seafile和seahub服務。使用以下命令啟動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.

推出海上樞紐服務

$ ./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.

從上面的輸出中可以看到,seahub沒有啟動。要獲取相關的錯誤,請使用以下命令啟動seafile:

$ sudo ./seahub.sh start-fastcgi

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

輸出顯示錯誤是針對不支持的sha1的。我叫這個從_sha1導入sha1“什麼時候”導入hashlib在文件中 /var/www/sea​​file/seafile-server/seahub/seahub/repo_api_tokens/models.py..該文件應如下所示:

$ 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

保存文件並重新啟動seahub

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

步驟7:配置防火牆

如果文件牆處於活動狀態,請通過防火牆打開seafile端口。

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

步驟8:在瀏覽器中訪問Seafile

使用端口8000上的主機名/ IP地址從瀏覽器訪問seafile。 http:// :8000.. 如果瀏覽器中未加載seafile,請檢查seafilegunicorn設置。確保它未綁定到您的本地IP地址,如下所示。

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

保存文件後,您將能夠在瀏覽器中啟動seafile。顯示類似於以下內容的頁面。

使用先前配置的管理員憑據登錄時,將看到類似於以下內容的頁面:在CentOS 8上安裝和配置Seafile存儲

開始添加新文件夾/文件[新しいライブラリ]單擊以命名新文件夾,然後[送信]單擊。在CentOS 8上安裝和配置Seafile存儲

您應該能夠選擇一個新的庫並創建或上傳文件夾/文件。在CentOS 8上安裝和配置Seafile存儲

步驟9:配置Seafile客戶端

使用Ubuntu 20.04客戶端計算機測試與Seafile服務器的連接。

要在Ubuntu 20.04上連接到Seafile,請首先運行以下命令在Ubuntu 20.04上安裝seafile客戶端。

$ 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

僅與cli一起使用,運行以​​下命令:

sudo apt-get install seafile-cli

安裝完成後,您可以通過在應用程序中搜索seafile客戶端來找到它。在CentOS 8上安裝和配置Seafile存儲

雙擊打開,選擇庫文件夾,[次へ]請點擊在CentOS 8上安裝和配置Seafile存儲

然後提供seafile服務器連接的詳細信息。在CentOS 8上安裝和配置Seafile存儲

點擊登錄‘您需要按如下所示連接到seafile服務器:在CentOS 8上安裝和配置Seafile存儲

而已。 享受Seafile安裝。我認為博客是有幫助的。查看下面更有趣的指南。

  • Nextcloud VS owncloud vs Seafile vs Syncthing
  • 在Centos8上安裝PydioCells文件共享
  • 在Ubuntu 20.04上安裝PydioCells文件共享
  • 在CentOS 8 / CentOS 7上安裝和配置Syncthing
  • 在Debian 10(Buster)上安裝和配置Nextcloud 19
  • 使用“讓我們加密”在CentOS 7上安裝Nextcloud
Sidebar