Only Office 搭建
為RHEL / CentOS設置yum存儲庫,創建/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
Centos 7下安裝nginx,使用yum install nginx
,提示沒有可用的軟件包。
可以直接使用yum 安裝
yum install epel-release
安裝成功之后,再安裝nginx
yum install nginx
修改nginx配置
vim /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
安裝EPEL儲存庫
yum install epel-release
安裝和配置PostgreSQL
安裝CentOS版本中包含的PostgreSQL版本:
yum install postgresql postgresql-server
初始化PostgreSQL數據庫
service postgresql initdb
chkconfig postgresql on
打開IPv4和IPv6本地主機的“信任”身份驗證方法
/var/lib/pgsql/data/pg_hba.conf
在文本編輯器中打開文件。
找到該host all all 127.0.0.1/32 ident
字符串並將其替換為以下字符串:
host all all 127.0.0.1/32 trust
然后找到該host all all ::1/128 ident
字符串並將其替換為以下字符串:
host all all ::1/128 trust
保存更改。
重新啟動PostgreSQL服務:
service postgresql restart
創建PostgreSQL數據庫和用戶:
創建的數據庫用戶名和密碼。
首先運行命令
cd /tmp
以防止could not change directory to "/root"
從根目錄運行時發出警告。然后必須創建數據庫和用戶:
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
安裝RabbitMQ
yum install rabbitmq-server
啟動rabbitmq服務,並啟用開機啟動:
service rabbitmq-server start
systemctl enable rabbitmq-server
添加ONLYOFFICE Docs存儲庫
使用以下命令添加yum ONLYOFFICE Docs存儲庫:
yum install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm
安裝ONLYOFFICE文檔
執行以下命令:
yum install onlyoffice-documentserver
運行相關服務並在啟動時啟用它們:
service supervisord start
systemctl enable supervisord
service nginx start
systemctl enable nginx
在那之后,ONLYOFFICE Docs將作為一個流程運行。該軟件包將像其他任何rpm軟件包一樣進行更新。
配置&安裝階段
環境變量和SELINUX配置和重啟
可以先配置,也可能最后做,但是很關鍵
環境變量
/etc/profile文件,添加 export DS_PORT=9001並保存
vim /etc/profile
export DS_PORT=9001
SELinux
/etc/selinux/config
使用文本編輯器打開文件,將SELINUX=enforcing
或替換SELINUX=permissive
為SELINUX=disabled
一個,然后保存更改。
重啟生效
$ reboot
配置ONLYOFFICE文檔
運行配置腳本
運行documentserver-configure.sh
腳本:
bash documentserver-configure.sh
系統將要求您指定PostgreSQL和RabbitMQ連接參數。使用以下數據:
對於PostgreSQL:
- 主機:localhost
- 數據庫:onlyoffice
- 用戶:onlyoffice
- 密碼:onlyoffice
對於RabbitMQ:
- 主機:localhost
- 用戶:guest
- 密碼:guest
配置完成后,您可以在瀏覽器地址欄中輸入http:// localhost:9001 以打開ONLYOFFICE Docs歡迎頁面,您將在此處找到有關如何啟用文檔示例或使用提供的API將在線編輯器集成到Web應用程序中的更多說明。。