私有云盘部署与问题

centos 开源云盘部署

1、安装包下载:
1.1、百度云盘(企业版)

链接:https://pan.baidu.com/s/1rMjfoqQDydxC-12p3YBndQ
提取码:8y6k

1.2、私人云盘(企业版)
1.3、官网下载(社区版)
2、部署
2.1、社区版部署

官网部署

2.1.1、安装MySQL 或者 MariaDB

mariaDB

$ yum -y install mariadb mariadb-devel mariadb-server MariaDB-shared # centos7下叫mariadb, 用法与mysql一致
$ systemctl enable mariadb
$ systemctl start mariadb

or mysql

$ yum install mysql
$ yum install mysql-server
$ yum install mysql-devel

# mysql-server确实安装不成功的
$ wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
$ yum install mysql-community-server

# 安装完成后重启
$ service mysqld restart

设置root密码

[gyy@localhost ~]# mysql -u root 
mysql> set password for 'root'@'localhost' =password('设置的密码'); #字符串
Query OK, 0 rows affected (0.00 sec)
mysql> 

2.1.2、部署云盘步骤

压缩包操作

[root@localhost ~]# mkdir /opt/seafile
# 创建云盘安装目录
[root@localhost ~]# mv seafile-server-* /opt/seafile
[root@localhost ~]# cd /opt/seafile
# 将云盘压缩包移动到安装目录下
[root@localhost seafile]# tar -zxvf seafile-server-*
# 解压 压缩包
[root@localhost seafile]# mkdir installed
[root@localhost seafile]# mv seafile-server-* installed
# 将压缩包 移动到 installed 目录下

服务器操作

# on CentOS 7 and seafile 7.0.x 版本
[root@localhost ~]# yum install python python-setuptools MySQL-python python-urllib3 python-ldap -y

# on CentOS 8 and seafile 7.1.x 版本
[root@localhost ~]# yum install python3 python3-setuptools python3-pip python3-ldap -y
[root@localhost ~]# pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha

shell操作

[root@localhost seafile]# cd seafile-server-7.x
[root@localhost seafile]# ./setup-seafile-mysql.sh  #运行安装脚本并回答预设问题

如果你的系统中没有安装上面的某个软件,那么 Seafile初始化脚本会提醒你安装相应的软件包.

该脚本会依次询问你一些问题,从而一步步引导你配置 Seafile 的各项参数:

在这里, 你会被要求选择一种创建 Seafile 数据库的方式:

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

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

如果选择1, 你需要提供根密码. 脚本程序会创建数据库和用户。
如果选择2, ccnet/seafile/seahub 数据库应该已经被你(或者其他人)提前创建。

如果安装正确完成,你会看到下面这样的输出 (新版本可能会有所不同)
在这里插入图片描述
seafile-server-latest文件夹为指向当前 Seafile 服务器文件夹的符号链接

软件启动
在 seafile-server-latest 目录下,运行如下命令

[root@localhost seafile-server-latest]# ./seafile.sh start # 启动 Seafile 服务
[root@localhost seafile-server-latest]# ./seahub.sh start  # 启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上)

你第一次启动 seahub 时,seahub.sh 脚本会提示你创建一个 seafile 管理员帐号。

自定义seahub 端口号运行
关闭seafile服务

[root@localhost seafile-server-latest]# ./seafile.sh stop
[root@localhost seafile-server-latest]# ./seahub.sh stop

修改/opt/seafile/conf/gunicorn.conf 文件

[root@localhost seafile-server-latest]# vi ../conf/gunicorn.conf
# default localhost:8000
bind = "0.0.0.0:8001"

重启服务即可

2.1.3、配置nginx

server {
    listen 80;
    server_name 192.168.x.x;
    proxy_set_header X-Forwarded-For $remote_addr;
    location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;
         client_max_body_size 0;
         access_log      /var/log/nginx/seahub.access.log;
         error_log       /var/log/nginx/seahub.error.log;
    }
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }
    location /media {
        root /home/user/haiwen/seafile-server-latest/seahub;
    }
}

Nginx 默认设置 “client_max_body_size” 为 1M。如果上传文件大于这个值的话,会报错,相关 HTTP 状态码为 423 (“Request Entity Too Large”). 你可以将值设为 0 以禁用此功能.
如果要上传大于 4GB 的文件,默认情况下 Nginx 会把整个文件存在一个临时文件中,然后发给上游服务器 (seaf-server),这样容易出错。使用 1.8.0 以上版本同时在 Nginx 配置文件中设置以下内容能解决这个问题:

    location /seafhttp {
        ... ...
        proxy_request_buffering off;
    }

2.1.4、页面访问即可
http://192.168.x.x:80

2.2、企业版破解安装

2.2.1、下载安装脚本
链接:https://pan.baidu.com/s/18ytI9AQjBgQ1P4zGuejYvg
提取码:2qdw

2.2.2、修改安装目录
将下载的install_seafile.sh的脚本打开,修改【安装基础目录】后保存。
在这里插入图片描述2.2.3、运行脚本并回答某些问题

[root@localhost ~]# /opt/
#执行,如果不是默认/opt目录,需要修改后再执行
[root@localhost ~]# chmod +x install_seafile.sh && ./install_seafile.sh  7.0.14
#回答安装问题,注意刚开始要选专业版2  不是CE(社区版)

回答安装问题,注意刚开始要选专业版2 不是CE(社区版)在这里插入图片描述2.2.4、启动关闭服务
自动安装脚本会在系统中安装开机自动启动脚本。您也可以使用该脚本来关闭/启动 Seafile 服务,命令如下:

#关闭服务
systemctl stop seafile
systemctl stop seahub
#启动服务
systemctl start seafile
systemctl start seahub

2.2.5、修改nginx
脚本安装会自动安装nginx,然后监听80端口

[root@localhost ~]# vi /etc/nginx/conf.d/seafile.conf
[root@localhost ~]# nginx -s reload

重启nginx即可。

2.2.6、借鉴2.1.2 继续安装服务即可

2.3、企业版支持在线预览office

支持 http 协议
支持 https 协议

因为是内网部署,只使用 http 协议的即可。

2.3.1、安装docker

[root@localhost ~]# yum -y install wget
# 安装 wget
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 下载docker 的yum源
[root@localhost yum.repos.d]# yum repolist
# 刷新yum集
[root@localhost yum.repos.d]# yum -y install docker-ce
# 安装docker-ce
[root@localhost yum.repos.d]# systemctl start docker
# 启动docker
[root@localhost yum.repos.d]# systemctl enable docker
# 加入开机自启动
[root@localhost yum.repos.d]# dcoker version
# 查看docker版本

2.3.2、安装onlyoffice插件

[root@localhost ~]# docker run -i -t -d --restart=always -p 8889:80 onlyoffice/documentserver
#--restart=always表示每次开机,只要当docker被设置为开机启动,此onlyoffice就会自动运行

查看镜像是否运行

[root@localhost ~]# docker ps

2.3.3、开放 防火墙并测试

[root@localhost ~]# firewall-cmd --zone=public --add-port=8889/tcp --permanent 
[root@localhost ~]# firewall-cmd --reload

打开浏览器访问http://192.168.x.x:8889/welcome

2.3.4、将onlyoffice 配置 云盘重启即可

[root@localhost ~]# vi /opt/seafile/conf/seahub_settings.py

在文件末尾添加以下内容:

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http://192.168.x.x:8889/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx','ppt','xls','doc')

或者您需要其他的配置

2.3.5、测试在线预览
选择word文件
在这里插入图片描述

2.4、搜索问题,ElasticSearch无法启动

借鉴1
借鉴2
借鉴3

2.4.1、安装 jdk 1.8

[root@localhost ~]# yum install java-1.8.0-openjdk

2.4.2、添加新用户

[root@localhost ~]# useradd --system --comment "seafile" seafile --create-home --home-dir /home/seafile

2.4.3、关闭seafile和seahub

[root@localhost ~]# /opt/seafile/seafile-server-latest/seafile.sh stop
[root@localhost ~]# /opt/seafile/seafile-server-latest/seahub.sh stop

2.4.4、修改 Seafile 安装目录和 Seafile data 目录的属主和属组为 seafile

[root@localhost ~]# chown -R seafile.seafile /opt/seafile
[root@localhost ~]# chown -R seafile.seafile /tmp/seafile-office-output
[root@localhost ~]# chown -R seafile.seafile /tmp/seahub_cache

2.4.5、切换seafile 用户,重启云盘服务

[root@localhost ~]# su - seafile
bash-4.2$ /opt/seafile/seafile-server-latest/seafile.sh start
bash-4.2$ /opt/seafile/seafile-server-latest/seahub.sh start

2.4.6、搜索配置说明

bash-4.2$ cat /opt/seafile/conf/seafevents.conf

在这里插入图片描述

2.4.7、seafile和seahub正常启动,但是访问显示page unavailable

# 缓存问题,删除所有临时文件,重启seafile和seahub即可。
 rm -rf /tmp/seahub_cache/*

2.4.8、其他搜索问题
重建索引:

bash-4.2$ cd /opt/seafile-server-latest
bash-4.2$ ./pro/pro.py search --clear
bash-4.2$ ./pro/pro.py search --update
如果这样不能解决问题,可以尝试以下步骤:
    停止 Seafile 服务
    删除旧的搜索索引 rm -rf pro-data/search
    重启 Seafile 服务
    稍等片刻,然后执行 ./pro/pro.py search --update
3、systemctl 守护启动

3.1、 编写seafile.service

[root@localhost ~]# cd /etc/systemd/system
[root@localhost system]# vi seafile.service

seafile.service内容如下:

[Unit]
Description=Seafile Server
After=network.target remote-fs.target mariadb.service

[Service]
ExecStart=/opt/seafile-server-latest/seafile.sh start
# ExecStart为服务的具体运行命令,
ExecStop=/opt/seafile-server-latest/seafile.sh stop
# ExecStop为停止命令
User=seafile  # 是设置服务运行的用户,
Group=seafile  #是设置服务运行的用户组,
LimitNOFILE=infinity
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

3.2、 编写seahub.service

[root@localhost ~]# cd /etc/systemd/system
[root@localhost system]# vi seahub.service

seahub.service内容如下:

[Unit]
Description=Seafile Seahub
After=network.target seafile.service

[Service]
ExecStart=/opt/seafile-server-latest/seahub.sh start
ExecStop=/opt/seafile-server-latest/seahub.sh stop
User=seafile
Group=seafile
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

3.3、 权限与设置开机自启动

# 添加可执行权限:
[root@localhost system]# chmod 754 /etc/systemd/system/seafile.service
[root@localhost system]# chmod 754 /etc/systemd/system/seahub.service
# 设置为开机自启动:
[root@localhost system]# systemctl enable seafile
[root@localhost system]# systemctl enable seahub
# 启动服务
[root@localhost system]# systemctl start seafile
[root@localhost system]# systemctl start seahub
# 停止服务
[root@localhost system]# systemctl stop seafile
[root@localhost system]# systemctl stop seahub
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值