- ホーム
- Docs
- インストールと設定
- コミュニティ
- Linuxバージョン
- ローカルサーバー用にONLYOFFICE Docsをコンパイルする
ローカルサーバー用にONLYOFFICE Docsをコンパイルする
はじめに
ONLYOFFICE Docsは、テキスト、スプレッドシート、プレゼンテーション用のビューアーとエディターを含むオンラインオフィススイートであり、Office Open XML形式(.docx、.xlsx、.pptx)と完全に互換性があり、リアルタイムでの共同編集を可能にします。
特別に設計されたbuild_toolsを使用して、ONLYOFFICE Docsをソースコードから簡単にコンパイルし、ローカルサーバーにソリューションをデプロイできます。build_toolsは、コンパイルプロセスに必要なすべてのコンポーネントを自動的に取得およびインストールし、ONLYOFFICE Docsの正しい動作に必要なすべての依存関係を取得し、最新バージョンのONLYOFFICE Docsソースコードを取得してすべてのコンポーネントをビルドすることができます。
masterブランチからビルドされた製品の正しい動作のみ保証できます。システム要件
ハードウェア
- CPU: デュアルコア2 GHz以上
- RAM: 少なくとも2 GB(ホストOSによる。多いほど良い)
- HDD: 少なくとも40 GBの空き容量
- SWAP: 少なくとも4 GB(ホストOSによる。多いほど良い)
ソフトウェア
- OS: 64ビットUbuntu 16.04
依存関係のインストール
コンピュータにPythonとGitがまだインストールされていない場合は、次のコマンドを使用してインストールする必要があります。
sudo apt-get install -y python git
ONLYOFFICE Docsソースコードのビルド
- build_toolsリポジトリをクローンします:
git clone https://github.com/ONLYOFFICE/build_tools.git build_tools/tools/linuxディレクトリに移動します:cd build_tools/tools/linuxautomate.pyスクリプトをserverパラメータを指定して実行し、ONLYOFFICE Docsをコンパイルします:./automate.py server
スクリプトの実行が完了するまで待ちます。コンピュータの性能によって、このプロセスにはかなりの時間がかかる場合があります。たとえば、Intel Core i7-7700では少なくとも3時間かかります。
スクリプトは、ONLYOFFICE Docsの一部であるすべての依存関係とコンポーネントをコンパイルします。
ビルドされたONLYOFFICE Docsは、../../out/linux_64/onlyoffice/documentserver/ディレクトリにあります。
NGINX、PostgreSQL、およびRabbitMQのインストールと設定
ONLYOFFICE Docsは、ウェブサーバーとしてNGINXを使用し、データベースとしてPostgreSQLを使用します。ONLYOFFICE Docsが正しく動作するためにはRabbitMQも必要です。
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; } } - 新しく作成したウェブサイトへのシンボリックリンクを
/etc/nginx/sites-availableディレクトリに追加します:sudo ln -s /etc/nginx/sites-available/onlyoffice-documentserver /etc/nginx/sites-enabled/onlyoffice-documentserver - 変更を適用するためにNGINXを再起動します:
sudo nginx -s reload
PostgreSQLのインストールと設定
次のコマンドを使用してPostgreSQLをインストールします:
sudo apt-get install postgresql
PostgreSQLがインストールされたら、次のコマンドを実行して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;"
データベースを設定するために次のコマンドを実行します:
psql -hlocalhost -Uonlyoffice -d onlyoffice -f ../../out/linux_64/onlyoffice/documentserver/server/schema/postgresql/createdb.sql
onlyoffice PostgreSQLユーザーのパスワードを入力するように求められます。onlyofficeパスワードを入力してください。RabbitMQのインストール
次のコマンドを使用してRabbitMQをインストールします:
sudo 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 Docsの実行
- FileConverterサービスを開始します:
cd out/linux_64/onlyoffice/documentserver/server/FileConverterLD_LIBRARY_PATH=$PWD/bin NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./converter - DocServiceサービスを開始します:
cd out/linux_64/onlyoffice/documentserver/server/DocServiceNODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice