部署服务环境:Centos7.6
curl -sL https://rpm.nodesource.com/setup_6.x | sudo bash
安装yum-utils工具
yum install yum-utils
添加nginx.repo源(Nginx官网有最新版,直接copy即可)
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
yum-config-manager --enable nginx-mainline
安装nginx
yum install nginx
运行nginx并进行 验证版本
systemctl start nginx && systemctl enable nginxnginx -v
安装postgresql-server
-
安装epel扩展库
yum install epel-release
安装postgresql
yum install postgresql postgresql-server
初始化postgresql数据库
service postgresql initdb
打开 IPv4和IPv6 localhost 的“信任”身份验证
vim /var/lib/pgsql/data/pg_hba.conf
重启postgresql数据库
systemctl restart postgresql
创建postgresql数据库和用户
<!--进入tmp目录-->
cd /tmp
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
<!--创建onlyoffice数据库-->
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';" <!--创建onlyoffice用户和密码-->
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;" <!--给onlyoffice用户进行授权-->
安装redis
yum -y install redis
sudo systemctl start redis && sudo systemctl enable redis
安装rabbitmq
sudo yum install rabbitmq-server
sudo systemctl start rabbitmq-server && sudo systemctl enable rabbitmq-server
安装OnlyOffice文件服务器
-
添加文件服务器存储库
sudo yum install http://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm
安装OnlyOffice文件服务器
sudo yum -y install onlyoffice-documentserver
配置OnlyOffice文件服务器
cd /usr/bin
sudo bash documentserver-configure.sh
<!--指定PostgreSQL和RabbitMQ连接参数。使用以下数据-->
配置HTTPS
sudo service nginx stop sudo cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.confsudo mkdir -p /etc/nginx/certsudo cd /etc/nginx/cert/sudo openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/onlyoffice.pem -keyout /etc/nginx/cert/onlyoffice.key
<!--创建ssl 证书-->vim /etc/onlyoffice/documentserver/nginx/ds.conf <!--编辑配置文件,按以下图片填写-->
ssl_certificate /etc/nginx/cert/onlyoffice.pem
ssl_certificate_key /etc/nginx/cert/onlyoffice.key
重启nginx服务,并验证安装结果
systemctl restart nginx
登录验证地址:
https://IP:8443/welcome https://IP:8443/web-apps/apps/api/documents/api.js
出现Loading document时,执行以下命令
systemctl restart ds-converter.service systemctl restart ds-docservice.service systemctl restart ds-example.service systemctl restart ds-metrics.service