onlyoffice源码编译环境搭建破解

onlyoffice源码编译环境搭建破解

参考:

官方文档

安装依赖项

编译依赖

sudo apt-get install -y python git

其他依赖

sudo apt install net-tools

配置代理

配置全局

使用http代理
不能用socks5代理(curl下载会失败)
需要分别配置HTTP代理和HTTPS代理
注意选择一个快的代理节点
直接全局配置生效

sudo vim /etc/profile

添加如下内容

export HTTP_PROXY=http://127.0.0.1:9910
export HTTPS_PROXY=http://127.0.0.1:9910

使配置生效

source /etc/profile

配置npm

添加

sudo npm config set proxy http://127.0.0.1:9910
sudo npm config set https-proxy http://127.0.0.1:9910
sudo npm config set registry https://registry.npmjs.org/

移除

sudo npm config delete proxy
sudo npm config delete https-proxy

下载编译工具

克隆仓库

git clone https://github.com/ONLYOFFICE/build_tools.git

执行编译脚本

cd build_tools/tools/linux
./automate.py server

安装其他依赖

安装Nginx

sudo apt-get install -y nginx

添加配置

删除默认站点配置

sudo rm -f /etc/nginx/sites-enabled/default

创建新的配置文件,添加如下内容

sudo vim /etc/nginx/sites-available/onlyoffice-documentserver

文件内容

map $http_host $this_host {
  "" $host;
  default $http_host;
}
map $http_x_forwarded_proto $the_scheme {
  default $http_x_forwarded_proto;
  "" $scheme;
}
map $http_x_forwarded_host $the_host {
  default $http_x_forwarded_host;
  "" $this_host;
}
map $http_upgrade $proxy_connection {
  default upgrade;
  "" close;
}
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
server {
  listen 0.0.0.0:80;
  listen [::]:80 default_server;
  server_tokens off;
  rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect;
  location / {
    proxy_pass http://localhost:8000;
    proxy_http_version 1.1;
  }
  location /spellchecker/ {
    proxy_pass http://localhost:8080/;
    proxy_http_version 1.1;
  }
}

配置生效

nginx -s stop
nginx

创建软连接

sudo ln -s \
/etc/nginx/sites-available/onlyoffice-documentserver \
/etc/nginx/sites-enabled/onlyoffice-documentserver

启动nginx

sudo nginx -s reload

查看启动结果

sudo netstat -nlp | grep 80
sudo ps -ef | grep nginx

安装postgreSQL

sudo apt-get install -y postgresql

创建数据库和用户

sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

初始化数据
在根目录执行

cd /

创建数据库

psql -hlocalhost -Uonlyoffice -d onlyoffice -f \
build_tools/out/linux_64/onlyoffice/documentserver/server/schema/postgresql/createdb.sql

输入密码: onlyoffice

安装RabbitMQ

sudo apt-get install -y rabbitmq-server

生成字体

cd 
cd build_tools/out/linux_64/onlyoffice/documentserver/
mkdir fonts
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allfontsgen \
  --input="${PWD}/core-fonts" \
  --allfonts-web="${PWD}/sdkjs/common/AllFonts.js" \
  --allfonts="${PWD}/server/FileConverter/bin/AllFonts.js" \
  --images="${PWD}/sdkjs/common/Images" \
  --selection="${PWD}/server/FileConverter/bin/font_selection.bin" \
  --output-web='fonts' \
  --use-system="true"

生成演示主题

cd 
cd build_tools/out/linux_64/onlyoffice/documentserver/
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allthemesgen \
  --converter-dir="${PWD}/server/FileConverter/bin"\
  --src="${PWD}/sdkjs/slide/themes"\
  --output="${PWD}/sdkjs/common/Images"

启动服务

FileConverter

cd build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter
LD_LIBRARY_PATH=$PWD/bin NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./converter

SpellChecker

cd build_tools/out/linux_64/onlyoffice/documentserver/server/SpellChecker
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./spellchecker

DocService

cd build_tools/out/linux_64/onlyoffice/documentserver/server/DocService
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice

扣:三二八五三七七零

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值