如何在Ubuntu上从源代码编译ONLYOFFICE Document Server

如何在Ubuntu上从源代码编译ONLYOFFICE Document Server

ONLYOFFICE Document Server由基于Web的查看器和文本文件,电子表格和演示文稿的协作编辑器组成,可与OOXML格式(docx,xl​​sx,pptx)高度兼容。 该套件在GNU AGPL v3.0下分发。

ONLYOFFICE Document Server可以与Nextcloud,ownCloud,Seafile,HumHub,Plone等各种云存储平台集成,也可以集成到您自己构建的解决方案中。 Document Server可以用作ONLYOFFICE Community Edition的一部分,后者是具有在线编辑器和协作平台的免费开源解决方案。

ONOFFOFFICE文件编辑器

build_tools允许用户自动安装所有必需的组件并从源代码编译最新版本的在线编辑器。

在本教程中,我们将学习如何为Ubuntu安装(64位Ubuntu)编译ONLYOFFICE Document Server。

系统要求

  • CPU:双核2 GHz或更高
  • 内存:2 GB或更多
  • 硬盘:至少40 GB的可用空间
  • 至少4 GB的交易所空间

步骤1:安装依赖项

如果您的计算机上未安装Python和Git,请使用以下命令进行安装:

sudo apt-get install -y python git

步骤2:构建文档服务器源代码

克隆build_tools存储库:

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

转到适当的目录:

cd build_tools/tools/linux

运行脚本:

./automate.py server

完成后,可以在../../out/linux_64/onlyoffice/documentserver/目录中找到构建的文档服务器。

第3步:安装和配置NGINX,PostgreSQL和RabbitMQ

Document Server使用NGINX作为Web服务器,并使用PostgreSQL作为数据库。 正常工作也需要RabbitMQ。

1.安装和配置NGINX

使用以下命令安装NGINX:

sudo apt-get install nginx

禁用默认网站:

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

设置新网站。 创建/ 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;
  }
}

将符号链接添加到新创建的网站到/ etc / nginx / sites-available目录中:

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

重新启动NGINX:

sudo nginx -s reload

2.安装和配置PostgreSQL

安装PostgreSQL:

sudo apt-get install postgresql

创建PostgreSQL数据库和用户(为用户名和密码输入’onlyoffice’):

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;"

配置数据库:

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

上面的命令是一行 当要求您为onlyoffice PostgreSQL用户提供密码时,输入“ onlyoffice”密码。

3.安装RabbitMQ

使用以下命令安装RabbitMQ:

sudo apt-get install rabbitmq-server

步骤4:生成字体数据

执行命令:

cd out/linux_64/onlyoffice/documentserver/
mkdir fonts
LD_LIBRARY_P新高=${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"

步骤5:产生简报主题

运行以下命令:

cd out/linux_64/onlyoffice/documentserver/
LD_LIBRARY_P新高=${PWD}/server/FileConverter/bin server/tools/allthemesgen 
  --converter-dir="${PWD}/server/FileConverter/bin"
  --src="https://www.howtoforge.com/how-to-compile-onlyoffice-document-server-from-source-code-on-ubuntu/${PWD}/sdkjs/slide/themes"
  --output="${PWD}/sdkjs/common/Images"

步骤6:运行文档服务器

ONLYOFFICE Document Server的所有组件都作为前台进程运行。 您需要单独的终端控制台来运行它们,或启动允许在后台模式下运行前台进程的特定工具。

启动FileConverter服务:

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

启动SpellChecker服务:

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

启动DocService服务:

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

就这样 现在,您可以选择简介中介绍的ONLYOFFICE Document Server使用方法的一种(在线编辑器):与任何云存储服务集成,或与您自己的解决方案集成,或与ONLYOFFICE Community Server集成。

资讯来源:由0x资讯编译自HOWTOFORGE,版权归作者所有,未经许可,不得转载
你可能还喜欢