Centos7 部署 Seafile 服务器结合 Onlyoffice 实现多人在线撰写、预览文档

目录

前言

Seafile的安装与部署

1>环境介绍

2>构建环境并安装常用工具

3>下载Seafile包并上传到服务器并安装

4>配置NGINX反向代理

5>启动Seafile、seahub服务

6>网页访问测试

部署Onlyoffice文档服务器

1>配置docker环境并安装

2>使Seafile与Onlyoffice结合

3>重启服务并测试

 总结


前言

          Seafile 是国内团队开发、国际领先的开源企业云存储软件,为企业提供私有云环境下的网盘解决方案。是一个高性能的开源网盘,Seafile 提供了主流网盘、云盘属于具有的全部功能。

特性:

  • 跨平台文件同步
  • 移动端文件访问
  • 挂载盘客户端(不用同步即可像本地磁盘一样访问云端文件)
  • Wiki 与知识管理
  • 文件版本管理和资料库镜像
  • 文件锁定
  • 在线编辑和协同编辑

优势:

  • 安全和加密
  • 用户管理和统一登录
  • 备份和数据恢复
  • 集成

Seafile的安装与部署

1>环境介绍

Centos 7.5   4C 8G     50G硬盘    IP为 192.169.253.130

2>构建环境并安装常用工具

第一步:安装常用工具
[root@seafile-ce ~]# yum -y install vim wget lrzsz

第二步:安装jdk构造java环境
[root@seafile-ce ~]# yum -y install java-1.8.0-openjdk* 
[root@seafile-ce ~]# java -version
openjdk version "1.8.0_282"

第三步:安装mysql5.7
[root@seafile-ce ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm  #下载安装源
[root@seafile-ce ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm  #安装mysql源
[root@seafile-ce ~]# yum -y install mysql-community-server    #安装社区版mysql5.7
[root@seafile-ce ~]# systemctl  enable mysqld
[root@seafile-ce ~]# systemctl  start  mysqld
[root@seafile-ce ~]# new=`grep 'temporary password' /var/log/mysqld.log | awk '{print $NF}'`;mysqladmin -p"$new" password "Hxb@6666"    #设置mysql密码
[root@seafile-ce ~]# mysql -uroot -pHxb@6666
mysql> grant all on *.* to 'root'@'%' identified by 'Hxb@6666';    #授权root可以远程访问
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@seafile-ce ~]# systemctl  restart mysqld 

第四步:关闭防火墙
[root@seafile-ce ~]# setenforce 0
[root@seafile-ce ~]# systemctl  stop firewalld
[root@seafile-ce ~]# systemctl disable firewalld

3>下载Seafile包并上传到服务器并安装

下载地址:https://www.seafile.com/download/  ,我这里选择的版本是7.0.5

第一步:上传
[root@seafile-ce ~]# mkdir /opt/seafile
[root@seafile-ce ~]# mv seafile-server_7.0.5_x86-64.tar.gz /opt/seafile/
[root@seafile-ce ~]# cd /opt/seafile
[root@seafile-ce seafile]# tar -xzf seafile-server_7.0.5_x86-64.tar.gz 
[root@seafile-ce seafile]# mkdir installed
[root@seafile-ce seafile]# mv seafile-server_7.0.5_x86-64.tar.gz installed/  #把已升级过的包放进installed里

第二步:安装依赖
[root@seafile-ce seafile]# yum -y install epel-release   #下面操作需要这个源里的python包
[root@seafile-ce seafile]# yum -y  install python python-setuptools MySQL-python python-urllib3 python-ldap  #seafile所需的依赖

第三步:安装
[root@seafile-ce seafile]# cd seafile-server-7.0.5/
[root@seafile-ce seafile-server-7.0.5]# ./setup-seafile-mysql.sh   #运行安装脚本并回答预设问题
Press ENTER to continue
-----------------------------------------------------------------  #此处回车

3 - 15 letters or digits
[ server name ] Seafile           #这里自起服务名称

For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 192.168.253.130     #这里就填服务器的ip或者域名即可

Please use a volume with enough free space
[ default "/opt/seafile/seafile-data" ]     #选择数据存放位置,默认回车就ok

Which port do you want to use for the seafile fileserver?
[ default "8082" ]                     #默认回车

[1] Create new ccnet/seafile/seahub databases    #你需要提供根密码. 脚本程序会创建数据库和用户
[2] Use existing ccnet/seafile/seahub databases  #ccnet/seafile/seahub 数据库应该已经被你(或者其他人)提前创建
[ 1 or 2 ]  1

What is the host of mysql server?
[ default "localhost" ]        #我用的是本地,就直接回车了

What is the port of mysql server?
[ default "3306" ]             #可以自选数据库端口号

What is the password of the mysql root user?
[ root password ]               #数据库的密码

Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]            #是否创建seafile数据库,默认回车

Enter the password for mysql user "seafile":
[ password for seafile ]         #给新建的数据库设置密码

Enter the database name for ccnet-server:
[ default "ccnet-db" ]           #回车

Enter the database name for seafile-server:
[ default "seafile-db" ]          #回车

Enter the database name for seahub:
[ default "seahub-db" ]           #回车

Press ENTER to continue, or Ctrl-C to abort
---------------------------------    #此处ENTER,即回车键

When problems occur, Refer to

        https://github.com/haiwen/seafile/wiki

for information.   #后三行是这样说明安装成功

4>配置NGINX反向代理

说明:7.0.x 版本之后,8000端口默认监听在127.0.0.1地址上,这意味着您无法直接通过8000端口访问Seafile服务,即需配置代理服务!

第一步:安装nginx
[root@seafile-ce seafile-server-7.0.5]# yum -y install nginx 

第二步:改nginx的配置文件
[root@seafile-ce seafile-server-latest]# vim /etc/nginx/nginx.conf
#user  nobody;
worker_processes  4;
error_log  /var/log/nginx/error.log;
pid        /var/log/nginx/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        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;
            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 /opt/seafile/seafile-server-latest/seahub;
      }
  }
}

第三步:启动nginx
[root@seafile-ce seafile-server-latest]# systemctl  enable nginx 
[root@seafile-ce seafile-server-latest]# systemctl  start nginx

5>启动Seafile、seahub服务

[root@seafile-ce seafile-server-latest]# ./seafile.sh start   #启动seafile服务
[root@seafile-ce seafile-server-latest]# ./seahub.sh start    #启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上),这时候上面的nginx代理就起到关键的作用了

What is the email for the admin account?
[ admin email ] 1540243055@11.com        #这里要求创建一个管理员账号

What is the password for the admin account?
[ admin password ]        #设置管理员密码

Enter the password again:
[ admin password again ]      #再次验证

Seahub is started

Done.    #结束

6>网页访问测试

部署Onlyoffice文档服务器

说明:未部署之前打开一个word文档,如下图所示显示不支持云端查看!下面我用就在此台服务器上起一个docker文件预览服务。

 1>配置docker环境并安装

[root@seafile-ce seafile-server-latest]# yum -y install yum-utils device-mapper-persistent-data lvm2   #依赖
[root@seafile-ce seafile-server-latest]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo     #安装yum仓库
[root@seafile-ce seafile-server-latest]# yum install docker-ce docker-ce-cli containerd.io  #安装
[root@seafile-ce seafile-server-latest]# systemctl start docker
[root@seafile-ce seafile-server-latest]# systemctl enable docker
[[root@seafile-ce seafile-server-latest]# docker run -i -t -d -p81:80 --restart=always onlyoffice/documentserver   #起一个容器,启动onlyoffice后在浏览器访问
[root@seafile-ce seafile-server-latest]# docker ps   #up状态表示正在运行
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                         NAMES
8c73c65b7fd5        onlyoffice/documentserver   "/app/ds/run-docum..."   23 seconds ago      Up 21 seconds       443/tcp, 0.0.0.0:81->80/tcp   vigilant_stallman

2>使Seafile与Onlyoffice结合

[root@seafile-ce seafile-server-latest]# vim /opt/seafile/conf/seahub_settings.py   #改配置
#Enable Only Office         #最下面添加
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http://192.168.253.130:81/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')

3>重启服务并测试

[root@seafile-ce seafile-server-latest]# ./seafile.sh restart 
[root@seafile-ce seafile-server-latest]# ./seahub.sh restart 

 总结

            文章没有什么大坑,可能有些许的小瑕疵会出现一些小的问题,建议初次搭建按照以上步骤逐步来做,避免报错。创作不已,请勿白嫖喜欢就一键三连吧!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

胖胖不胖、

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值