在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/seafile/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://
$ 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。显示类似于以下内容的页面。
使用先前配置的管理员凭据登录时,将看到类似于以下内容的页面:
开始添加新文件夹/文件[新しいライブラリ]单击以命名新文件夹,然后[送信]单击。
您应该能够选择一个新的库并创建或上传文件夹/文件。
步骤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客户端来找到它。
双击打开,选择库文件夹,[次へ]请点击
然后提供seafile服务器连接的详细信息。
点击登录‘您需要按如下所示连接到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