Docker版OnlyOffice镜像制作

Docker版OnlyOffice镜像制作

一、环境准备

1.电脑要求

1宿主机内存16G以上,CPU4核8线程以上,老爷机建议直接放弃

2虚拟机系统用ubuntu18.04,处理器核心保证2✖2以上,运行内存分配6G以上,硬盘容量分配60G以上

3虚拟机上的ubuntu必须开启代理软件

4网速必须保证在1M/s以上

5ubuntu的swap交换内存可以考虑设置大一点,设置方法自行百度

PS:需要下载我提供的替换文件,一会儿做Docker替换要用(提取码:SxoA)

docker部署需要替换的文件官方版下载丨最新版下载丨绿色版下载丨APP下载-123云盘

二.编译onlyoffice

1、开启root远程登录

1.设置root密码

sudo passwd root  #验证当前账户密码后设置root账户密码

2.安装ssh服务

  apt-get update     #更新apt

apt-get install openssh-server       #安装openssh-server

3.修改ssh配置文件

vi /etc/ssh/sshd_config

Port 22 #取消该行注释

LoginGraceTime 2m # 取消该行注释

PermitRootLogin yes #取消该行注释,将prohibit-password修改为yes

StrictModes yes # 取消该行注释

MaxAuthTries 6 #取消该行注释MaxSessions 10 # 取消该行注释

4.启动或重启服务

systemctl restart ssh

systemctl enable ssh

2、gcc编译工具升级

1安装升级gcc7

  1. add-apt-repository ppa:ubuntu-toolchain-r/test
  2. apt-get install gcc-7
  3. apt-get install g++-7

2. 将gcc7,g++7设置作为默认选项

1. update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100

2. update-alternatives --config gcc

3. update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100

4. update-alternatives --config g++

3.配置网络环境

1 .设置全局代理和编译版本定义

(1) vim /etc/profile,添加如下内容:

  1. export HTTP_PROXY=http://127.0.0.1:2340
  2. export HTTPS_PROXY=http://127.0.0.1:2340
 

(2) source /etc/profile              #使配置生效

2 .安装git,python,node

apt-get install -y python git    #安装gitpython

apt-get install node               #安装node


3 .升级npm,设置git代理

npm cache clean -f                #清除npm缓存,执行命令

npm install -g npm@8.12.1        #升级npm版本

npm config set registry https://registry.npm.taobao.org  #npm镜像

git config --global http.proxy http://127.0.0.1:2340    #git代理

git config --global https.proxy http://127.0.0.1:2340  #git代理

git config http.postBuffer 5242880000               #githttp长度

4.开始编译onlyoffice

1.根目录创建一个onlyoffice工作目录:

mkdir ooSource

2.下载onlyoffice编译构建工具:

cd ooSource

git clone GitHub - ONLYOFFICE/build_tools: Used to build ONLYOFFICE DocumentServer-related products

3.Linux版本自动编译:

cd /ooSource/build_tools/tools/linux/      #进入脚本目录

./automate.py server         #开始编译(可不携带版本参数),需要几个小时

4.编译完成后,会在build_tools目录下生成out目录

      5.破解20人连接(修改源码)

1.  通过ubuntu桌面进入相应目录,找到constant.js

/ooSource/server/Common/sources/       #人数限制的js所在目录

2.  通过ubuntu桌面修改constants.js人数限制后保存

exports.LICENSE_CONNECTIONS = 20;         #将此处修改你想要的连接数

3. 重新编译

(1)修改 /ooSource/build_tools/tools/linux/automate.py中:

build_tools_params = ["--branch", branch,

                      "--module", modules,

                      "--update", "0", #此处修改为01会拉取最新代码                      "--qt-dir", os.getcwd() + "/qt_build/Qt-5.9.9"]

2)重新编译,会在/ooSource/build_tools/重新生成out目录:

     cd /ooSource/build_tools/tools/linux   #进入目录

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' NODE_ENV='production'

 ./automate.py server                 #重新编译(请带上版本参数)

6.破解其他(修改out目录 )

1.支持wps编辑:

修改/var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js:

查找var type,加入对应的三种wps格式 wps/et/dps,保存即可

2.字体修改为windows字体:

删除/ooSource/core-fonts/下的所有内容,然后添加我们自己的fonts包即可

三.打包onlyoffice

1.准备打包工具

1. 切换到ooSource目录,安装打包工具:

  cd /ooSource      #进入ooSource目录

  apt install build-essential m4 npm   #安装m4

  npm install -g pkg     #安装pkg
2. 在ooSource目录下下载onlyoffice打包工具

  git clone https://github.com/ONLYOFFICE/document-server-package.git 

2.打包onlyoffice

1. 安装依赖

cd /ooSource/document-server-package   #进入package目录

cat << EOF >> Makefile

deb_dependencies: \$(DEB_DEPS)         #编译文件追加dependencies

EOF

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' make deb_dependencies 

2. 打包onlyoffice

cd /ooSource/document-server-package/deb/build

apt build-dep ./

cd /ooSource/document-server-package

PRODUCT_VERSION='7.3.3' BUILD_NUMBER='54' make deb

最终会在/ooSource/document-server-package/deb/目录下生成deb

3.注意事项:

下次打包,对于/ooSource/document-server-package/deb只留一个template文件夹,其余的文件夹和文件都需要删掉,然后运行2中命令即可

四、生成Docker镜像

1.准备镜像制作工具

1. 下载镜像制作工具:

git clone GitHub - ONLYOFFICE/Docker-DocumentServer: ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.

2. 改造成本地打包

   对于Docker-DocumentServer,做以下处理:

    1. 替换我提供的DockerFile和run-document-server.sh,并增加中生成的deb包;
    2. 将deb‘包的名字改成onlyoffice.deb

3. 安装Docker

apt-get remove docker docker-engine docker.io   #卸载旧版本

apt-get install docker-ce docker-ce-cli containerd.io

运行vim /etc/docker/daemon.json  并加入:

{

      "registry-mirrors": ["https://mirrors.aliyun.com/"]       #配置阿里镜像

}

systemctl daemon-reload        #使阿里镜像生效

systemctl restart docker       #重启docker

  

  1. 构建onlyoffice镜像

   cd /ooSource/Docker-DocumentServer 

   docker build -t  镜像名:tag  .      #开始构建onlyoffice镜像

   docker images    #查看构建的onlyoffice镜像

   docker login

   docker push  镜像名:tag    #推送到远程仓库

PS:常见报错处理方法

1、apt-get update      (apt源报错)

2增加swap内存  (解决Error: open CFI at the end of file; missing .cfi_endproc directive,)

3git config http.postBuffer 5242880000    (解决A TLS packet with unexpected length was received的问题)(过早的EOF结束符)

4同方法2      (解决c++: internal compiler error: 已杀死 (program cc1plus)

5npm cache clear --force (解决Cannot read properties of null (reading 'pickAlgorithm')

6.  重新设置git代理 (解决git连接不上的问题)

  • 4
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值