编译环境

官网举荐的编译环境是Ubuntu 14.04,倡议应用官网举荐的版本,防止编译过程中呈现未知谬误

64-bit Ubuntu 14.04

编译

apt-get install -y python gitgit clone https://github.com/ONLYOFFICE/build_tools.gitapt-get install libgnutls-devnohup ./automate.py server >log.out 2>&1 &
如果顺利的话,大略须要8个小时以上能实现编译
  • 编译呈现的问题
The following packages have unmet dependencies: libgnutls-dev : Depends: libgnutls26 (= 2.12.23-12ubuntu2.8) but 2.12.23-12ubuntu2.9 is to be installed                 Depends: libgnutlsxx27 (= 2.12.23-12ubuntu2.8) but it is not going to be installed                 Depends: libgnutls-openssl27 (= 2.12.23-12ubuntu2.8) but 2.12.23-12ubuntu2.9 is to be installedE: Unable to correct problems, you have held broken packages.root@office:~/workspace/build_tools/tools/linux# apt-get install libgnutls-devReading package lists... DoneBuilding dependency tree       Reading state information... DoneSome packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstabledistribution that some required packages have not yet been createdor been moved out of Incoming.The following information may help to resolve the situation:The following packages have unmet dependencies: libgnutls-dev : Depends: libgnutls26 (= 2.12.23-12ubuntu2.8) but 2.12.23-12ubuntu2.9 is to be installed                 Depends: libgnutlsxx27 (= 2.12.23-12ubuntu2.8) but it is not going to be installed                 Depends: libgnutls-openssl27 (= 2.12.23-12ubuntu2.8) but 2.12.23-12ubuntu2.9 is to be installed

解决办法

dpkg --purge --force-all libgnutls26 apt-get -f installapt-get install libgnutls-devapt-get install libgnutls26apt-get install libgnutlsxx27

装置其余组件

nginx

apt-get install nginxrm -f /etc/nginx/sites-enabled/defaultvi /etc/nginx/sites-available/onlyoffice-documentservermap $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;  }}ln -s /etc/nginx/sites-available/onlyoffice-documentserver /etc/nginx/sites-enabled/onlyoffice-documentservernginx -s reload

装置PostgreSQL

apt-get install postgresqlpostgres psql -c "CREATE DATABASE onlyoffice;"postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"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

装置RabbitMQ

 apt-get install rabbitmq-server cd 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 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"

启动OnlyOffice

配置环境变量

FILE_CONVERT_HOME=/root/workspace/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverterNODE_ENV=development-linuxNODE_CONFIG_DIR=/root/workspace/build_tools/out/linux_64/onlyoffice/documentserver/server/Common/configPATH=$FILE_CONVERT_HOME/bin:$PATHexport FILE_CONVERT_HOMEexport PATHexport NODE_ENVexport NODE_CONFIG_DIR
cd out/linux_64/onlyoffice/documentserver/server/FileConverter./FileConvertercd out/linux_64/onlyoffice/documentserver/server/DocService./docservice

参考文档

  • https://helpcenter.onlyoffice.com/installation/docs-community-compile.aspx