onlyoffice源码编译参考
服务器配置
安装ubuntu18镜像虚拟机
1. 内存:8G
2. CPU:2核
3. 硬盘:50G
4. ⽹络:桥接模式
安装依赖项
编译依赖
sudo apt-get install -y python git
其他依赖
sudo apt install net-tools
配置代理
配置全局
1. 使⽤http代理
2. 不能⽤socks5代理(curl下载会失败)
3. 需要分别配置HTTP代理和HTTPS代理
4. 注意选择⼀个快的代理节点
5. 直接全局配置⽣效
sudo vim /etc/profile
# 添加如下内容
export HTTP_PROXY=127.0.0.1:9910
export HTTPS_PROXY=127.0.0.1:9910
source /etc/profile
配置npm
# 添加
sudo npm config set proxy 127.0.0.1:9910
sudo npm config set https-proxy 127.0.0.1:9910
sudo npm config set registry /
# 移除
sudo npm config delete proxy
sudo npm config delete https-proxy
下载编译⼯具
# 克隆仓库
git clone github/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 localhost:8000;
proxy_http_version 1.1;
}
location /spellchecker/ {
proxy_pass localhost:8080/;
proxy_http_version 1.1;
}
}
配置⽣效
# 创建软连接
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
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
cd build_tools/out/linux_64/onlyoffice/documentserver/server/SpellChecker
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./spellchecker
DocService
cd
cd build_tools/out/linux_64/onlyoffice/documentserver/server/DocService
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice
测试应⽤

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。