(onlyoffice)在CentOS及其衍生产品上安装Linux的Document Server
介绍
Document Server是一个在线办公套件,包括用于文本,电子表格和演示文稿的查看器和编辑器,与Office Open XML格式完全兼容:.docx,.xlsx,.pptx,并支持实时协作编辑。
功能性
- 文件编辑器
- 电子表格编辑器
- 简报编辑器
- 适用于iOS和Android的文档应用程序
- 协同编辑
- 象形文字支持
- 支持所有流行的格式:DOC,DOCX,TXT,ODT,RTF,ODP,EPUB,ODS,XLS,XLSX,CSV,PPTX,HTML
如果要将Document Server与Community Server一起使用,则必须将它们安装在两台不同的计算机上。
本指南将向您展示如何在计算机上安装Document Server Linux版本。
系统要求
中央处理器 双核2 GHz或更高
内存 2 GB以上
硬碟 至少40 GB的可用空间
其他要求 至少4 GB的交换空间
操作系统 RHEL 7或CentOS 7
其他要求
- PostgreSQL:9.1或更高版本
- NGINX:版本1.3.13或更高版本
- 雷迪斯
- 兔子MQ
安装依赖
安装最新的NGINX软件包版本
要为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
安装NGINX:
sudo yum install nginx
之后,编辑/etc/nginx/nginx.conf NGINX配置文件,使其看起来如下所示:
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储存库
sudo yum install epel-release
安装和配置PostgreSQL
安装 CentOS版本中包含的PostgreSQL版本:
sudo yum install postgresql postgresql-server
如果PostgreSQL要从PostgreSQL存储库安装其他版本,请参阅PostgreSQL官方文档以获取更多详细信息。
初始化PostgreSQL数据库
sudo service postgresql initdb
sudo 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服务:
sudo 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;"
安装Redis
sudo yum install redis
启动redis服务并启用启动启动:
sudo service redis start
sudo systemctl enable redis
安装RabbitMQ
sudo yum install rabbitmq-server
启动rabbitmq服务并启用启动启动:
sudo service rabbitmq-server start
sudo systemctl enable rabbitmq-server
安装文件服务器
添加文档服务器存储库
使用以下命令添加yum Document Server存储库:
sudo yum install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm
安装文件服务器
执行以下命令:
sudo yum install onlyoffice-documentserver
运行相关服务并在启动时启用它们:
sudo service supervisord start
sudo systemctl enable supervisord
sudo service nginx start
sudo systemctl enable nginx
之后,Document Server将作为一个进程运行。该软件包将像其他任何rpm软件包一样进行更新。
现在,您可以使用提供的API将Document Server连接到Community Server或将其集成到您自己的文档管理系统中。
更改默认的文档服务器端口
默认情况下,Document Server使用端口80监听传入的连接。从4.3版开始,如果计划使用它而不是默认端口,则可以更改Document Server的端口。
如果要更改默认端口,请确保已打开该端口以用于传入/传出连接。请参阅Document Server使用的端口的完整列表。
为此,您将需要运行以下命令来编辑DS_PORT环境变量:
export DS_PORT=<PORT_NUMBER>
请输入端口号,而不是<PORT_NUMBER>上面的命令。
警告如果要将文档服务器协议更改为HTTPS,请不要将端口更改为443,而应使用此指令。
之后,您可以继续配置Document Server。
配置文件服务器
运行配置脚本
运行documentserver-configure.sh脚本:
bash documentserver-configure.sh
系统将要求您指定PostgreSQL,Redis和RabbitMQ连接参数。使用以下数据:
对于PostgreSQL:
- 主机:本地主机
- 数据库:onlyoffice
- 用户:onlyoffice
- 密码:onlyoffice
对于Redis:
- 主机:本地主机
对于RabbitMQ:
- 主机:本地主机
- 用户:访客
- 密码:访客
添加防火墙例外
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
自v.5.0起禁用SELinux
/etc/selinux/config使用任何文本编辑器打开文件,将SELINUX=enforcing或替换SELINUX=permissive为SELINUX=disabled一个并保存更改。
重新启动服务器,以使更改生效。
本文作者:韩憨
本文链接:https://www.cnblogs.com/hanby/p/14151037.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步