Centos 7 安装OnlyOffice Docs

环境

CentOS Linux release 7.5.1804 (Core)

OnlyOffice 依赖

System requirements

CPU dual core 2 GHz or better
RAM at least 2 GB, but depends of the host OS. More is better
HDD at least 40 GB of free space
SWAP at least 4 GB, but depends of the host OS. More is better
OS RHEL 7, 8, 9 or CentOS 7, 8 Stream, 9 Stream
Additional requirements

PostgreSQL: version 12.9 or later
NGINX: version 1.3.13 or later
RabbitMQ

OnlyOffice安装

安装nginx

说明

安装目录:/etc/nginx/includes
file

重要的配置文件:http-common.conf
file

DocService 运行在 8000 端口上

安装postgresql,并初始化

  1. sudo yum install postgresql postgresql-server
  2. sudo service postgresql initdb
  3. 修改配置文件【/var/lib/pgsql/data/pg_hba.conf】信任:localhost地址
    file
    启动服务:sudo service postgresql restart
  4. 创建用户
    进入 cd /tmp 目录,防止警告

    sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH PASSWORD 'onlyoffice';"
    sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;"

安装RabbitMQ

sudo curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | os=centos dist=7 bash
sudo curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | os=centos dist=7 bash

启动MQ:sudo yum install rabbitmq-server

OnlyOffice存储库包

sudo yum install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm

字体库 mscorefonts

sudo yum install cabextract xorg-x11-font-utils
sudo yum install fontconfig
sudo rpm -i https://sourceforge.net/projects/mscorefonts2/files/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

OnlyOffice文档服务

sudo yum install onlyoffice-documentserver

OnlyOffice 启动

sudo service postgresql start
sudo systemctl enable --now rabbitmq-server
sudo service nginx start
systemctl start ds-example

相关shell脚本

restart_services() {
    [ -a /etc/nginx/conf.d/default.conf ] && \
    mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.old

    [ -a /etc/nginx/conf.d/onlyoffice-documentserver.conf ] && \
    mv /etc/nginx/conf.d/onlyoffice-documentserver.conf /etc/nginx/conf.d/onlyoffice-documentserver.conf.old

    echo -n "Restarting services... "
    for SVC in ds-docservice ds-converter ds-metrics nginx; do
        if [ -e /usr/lib/systemd/system/$SVC.service ]; then
            systemctl restart $SVC
        fi
    done
    echo "OK"
}

后台服务配置文件

安装后onlyoffice后,下面是安装到服务里面的,安装的目录为ll /lib/systemd/system/ | grep ds

ds-converter.service
ds-docservice.service
ds-example.service
ds-metrics.service

systemctl restart ds-docservice
systemctl restart ds-converter
systemctl reload nginx

参考文档

官方文档-Centos安装OnlyOffice

systemctl list-unit-files --type=service # 查看所有服务