• 欢迎访问显哥博客,本网站纯属学习技术,绝无商业用途,欢迎小伙伴们共同学习!研究技术!QQ:52249909 加我QQ
  • 世界75亿人,这么小的概率,能认识你,是我一生的幸运,不妨加个QQ接触一下:52249909 加我QQ

个人/企业内部私有云盘 Seafile部署搭建【显哥出品,必为精品】

技术栈 lixian 4年前 (2020-09-21) 2191次浏览 3个评论 扫描二维码
文章目录[隐藏]

一、前言

之前了解很多种类的企业私有云盘,也基本部署搭建使用过,在公司里,使用seafile进行内部文档管理,第一次接触seafile,操作简单,部署方便,支持web端,pc端,手机端。为此 整理了一篇在服务器的部署教程,仅供参考。

Seafile 是一个开源的文件云存储平台,更注重于隐私保护和对团队文件协作的支持。
Seafile 通过“资料库”来分类管理文件,每个资料库可单独同步,用户可加密资料库,且密码不会保存在服务器端,所以即使是服务器管理员也无权访问你的文件。
Seafile 允许用户创建“群组”,在群组内同步文件、创建维基、发起讨论等,方便团队内协同工作。

二、准备环境

一台服务器即可
IP:192.168.1.131

# 安装wget vim软件
[root@test ~]# yum install -y wget vim

# 关闭防火墙
[root@test ~]# systemctl stop firewalld
[root@test ~]# systemctl disable firewalld

三、部署seafile

1.安装mariadb数据库

# 安装mariadb
[root@test ~]# yum -y install mariadb mariadb-server

# 启动并开机自启
[root@test ~]# systemctl start mariadb
[root@test ~]# systemctl enable mariadb

# 设置密码
[root@test ~]# mysqladmin -uroot password
New password:           #新密码
Confirm new password:            #重复新密码

# 使用root账户登录数据库
[root@test ~]# mysql -uroot -p
Enter password:   #输入数据库密码

MariaDB [(none)]>
# 允许任意ip使用root远程连接
#(在企业中密码千万不要用123456这么简单的密码,这里仅测试使用)
MariaDB [(none)]> create user 'root'@'%' identified by '123456';

# 添加权限给该root
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '123456';

# 配置立即生效
MariaDB [(none)]> flush privileges;

# 退出
MariaDB [(none)]> exit

2.安装依赖项

yum install -y python-memcached \
  python-ldap \
  python-urllib3 \
  python-imaging \
  MySQL-python \
  python-distribute \
  ffmpeg \
  ffmpeg-devel

四、安装seafile

1.下载安装包、解压

# 下载安装包
[root@test ~]# cd && wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.5_x86-64.tar.gz

# 创建seafile文件夹并解压
[root@test ~]# mkdir /usr/local/seafile
[root@test ~]# tar xf seafile-server_6.2.5_x86-64.tar.gz -C /usr/local/seafile

2.运行shell脚本安装seafile

# 进入到工作目录
[root@test ~]# cd /usr/local/seafile/seafile-server-6.2.5/

# 执行安装脚本
[root@test /usr/local/seafile/seafile-server-6.2.5]# ./setup-seafile-mysql.sh

# 按回车继续
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

# 输入ip或域名,由于内部使用直接ip,输入ip后回车。
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server ·s ip or domain ] 192.168.1.131

# 使用默认,将数据文件放在/usr/local/seafile/seafile-data下,回车即可。
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/usr/local/seafile/seafile-data" ] 

# 使用默认的文件服务端口8082,回车即可。
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

# 使用新的seahub数据库,输入1后回车。
[ 1 or 2 ] 1

# 由于刚才装了mariadb,使用默认本地,回车即可。
What is the host of mysql server?
[ default "localhost" ] 

# mariadb的默认端口就是3306,回车即可。
What is the port of mysql server?
[ default "3306" ] 

# 输入root用户数据库的密码,输入密码后回车。
What is the password of the mysql root user?
[ root password ] 

# 使用默认的seafile作为seafile使用mariadb的用户,回车即可。
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ] 

# 输入mariadb的用户seafile的密码,输入密码后回车。
Enter the password for mysql user "seafile":
[ password for seafile ] 

# 使用默认ccnet-db作为ccnet-server使用的数据库名,回车即可。
Enter the database name for ccnet-server:
[ default "ccnet-db" ] 

# 使用默认seafile-db作为seafile-server使用的数据库名,回车即可。
Enter the database name for seafile-server:
[ default "seafile-db" ] 

# 使用默认seahub-db作为seahub使用的数据库名,回车即可。
Enter the database name for seahub:
[ default "seahub-db" ] 

3.完成seafile安装

# 这是你的配置信息,回车即可。
---------------------------------
This is your configuration
---------------------------------

    server name:            seafile
    server ip/domain:       192.168.1.131

    seafile data dir:       /usr/local/seafile/seafile-data
    fileserver port:        8082

    database:               create new
    ccnet database:         ccnet-db
    seafile database:       seafile-db
    seahub database:        seahub-db
    database user:          seafile

---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------

# 安装成功
-----------------------------------------------------------------
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://github.com/haiwen/seafile/wiki
for information.

[root@test /usr/local/seafile/seafile-server-6.2.5]#

五、启动访问

1.启动seafile服务

[root@test /usr/local/seafile/seafile-server-6.2.5]# ./seafile.sh start

[09/21/20 11:52:01] ../common/session.c(132): using config file /usr/local/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started

Done.
[root@test /usr/local/seafile/seafile-server-6.2.5]# netstat -lntp |grep seaf-server
tcp        0      0 0.0.0.0:8082            0.0.0.0:*               LISTEN      14231/seaf-server

2.启动seahub网站(首次需要创建管理员用户)

# 启动seahub网站(这里加了80端口,不加端口的情况下默认运行在8000端口上) 
[root@test /usr/local/seafile/seafile-server-6.2.5]# ./seahub.sh start 80

个人/企业内部私有云盘 Seafile部署搭建【显哥出品,必为精品】

3.访问seafile

浏览器直接输入你的IP访问:http://IP地址
输入刚才创建的管理员登录邮箱及登录密码
个人/企业内部私有云盘 Seafile部署搭建【显哥出品,必为精品】
个人/企业内部私有云盘 Seafile部署搭建【显哥出品,必为精品】

六、使用systemd管理seafile

1.停止seafile和seahub服务

[root@test ~]# cd /usr/local/seafile/seafile-server-6.2.5/
[root@test /usr/local/seafile/seafile-server-6.2.5]# ./seafile.sh stop

Stopping seafile server ...
Done.
[root@test /usr/local/seafile/seafile-server-6.2.5]# ./seahub.sh stop

Stopping seahub ...
Done.

2.创建seafile.service

# 注意ExecStart和ExecStop的路径
[root@test /usr/local/seafile/seafile-server-6.2.5]# vim /etc/systemd/system/seafile.service
[Unit]
Description=Seafile
After=mariadb.service

[Service]
Type=oneshot
ExecStart=/usr/local/seafile/seafile-server-6.2.5/seafile.sh start
ExecStop=/usr/local/seafile/seafile-server-6.2.5/seafile.sh stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

3.创建seahub.service

[root@test /usr/local/seafile/seafile-server-6.2.5]# vim /etc/systemd/system/seahub.service
[Unit]
Description=Seafile hub
After=network.target seafile.service

[Service]
ExecStart=/usr/local/seafile/seafile-server-6.2.5/seahub.sh start 80
ExecStop=/usr/local/seafile/seafile-server-6.2.5/seahub.sh stop
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

4.启动、开机启动seafile、seahub

[root@test /usr/local/seafile/seafile-server-6.2.5]# systemctl start seafile.service 
[root@test /usr/local/seafile/seafile-server-6.2.5]# systemctl enable seafile.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/seafile.service to /etc/systemd/system/seafile.service.
[root@test /usr/local/seafile/seafile-server-6.2.5]# systemctl start seahub.service 
[root@test /usr/local/seafile/seafile-server-6.2.5]# systemctl enable seahub.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/seahub.service to /etc/systemd/system/seahub.service.

本站博主 , 版权所有丨如未注明 , 均为原创
转载请注明原文链接:个人/企业内部私有云盘 Seafile部署搭建【显哥出品,必为精品】
喜欢 (2)

您必须 登录 才能发表评论!

(3)个小伙伴在吐槽
  1. I may need your help. I tried many ways but couldn't solve it, but after reading your article, I think you have a way to help me. I'm looking forward for your reply. Thanks.
    gateio2023-06-09 07:11
  2. 这种方式和用docker部署,哪个好用?(上传下载速度,稳定性方面)
    匿名2021-01-22 17:33