onlyoffice教程0x02-编译

编译环境 官方推荐的编译环境是Ubuntu 14.04,建议使用官方推荐的版本,避免编译过程中出现未知错误

64-bit Ubuntu 14.04

编译
apt-get install -y python git git clone https://github.com/ONLYOFFICE/build_tools.git apt-get install libgnutls-dev nohup ./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 installed E: Unable to correct problems, you have held broken packages. root@office:~/workspace/build_tools/tools/linux# apt-get install libgnutls-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or 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

【onlyoffice教程0x02-编译】解决办法
dpkg --purge --force-all libgnutls26 apt-get -f install apt-get install libgnutls-dev apt-get install libgnutls26 apt-get install libgnutlsxx27

安装其他组件 nginx
apt-get install nginx rm -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 postgresql postgres 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="https://www.it610.com/article/${PWD}/sdkjs/slide/themes"\ --output="${PWD}/sdkjs/common/Images"

启动OnlyOffice 配置环境变量
FILE_CONVERT_HOME=/root/workspace/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter NODE_ENV=development-linux NODE_CONFIG_DIR=/root/workspace/build_tools/out/linux_64/onlyoffice/documentserver/server/Common/config PATH=$FILE_CONVERT_HOME/bin:$PATH export FILE_CONVERT_HOME export PATH export NODE_ENV export NODE_CONFIG_DIR

cd out/linux_64/onlyoffice/documentserver/server/FileConverter ./FileConverter cd out/linux_64/onlyoffice/documentserver/server/DocService ./docservice

参考文档
  • https://helpcenter.onlyoffice.com/installation/docs-community-compile.aspx

    推荐阅读