ONLYOFFICE 官方地址: 官方教程
部署环境
- 系统: CentOS 7.9 64位 系统
- Docker 版本: 19.03.15
开始部署
创建应用容器需要挂载的目录以及文件
创建 MySQL 容器需要挂载的目录
1
2
3mkdir -p /usr/local/onlyoffice/mysql/conf.d
mkdir -p /usr/local/onlyoffice/mysql/{data,initdb,logs}
chown 999:999 /usr/local/onlyoffice/mysql/logs创建 onlyoffice 社区服务容器需要挂载的目录
1
mkdir -p /usr/local/onlyoffice/CommunityServer/{data,logs}
创建文档服务器容器需要挂载的目录
1
mkdir -p /usr/local/onlyoffice/DocumentServer/{data,logs}
创建邮件服务器容器需要挂载的目录
1
2mkdir -p /usr/local/onlyoffice/MailServer/{data,logs}
mkdir -p /usr/local/onlyoffice/MailServer/data/certs创建 MySQL 容器配置文件
1
2
3
4
5
6
7
8
9
10cat > /usr/local/onlyoffice/mysql/conf.d/onlyoffice.cnf <<EOF
[mysqld]
sql_mode = 'NO_ENGINE_SUBSTITUTION'
max_connections = 1000
max_allowed_packet = 1048576000
group_concat_max_len = 2048
log-error = /var/log/mysql/error.log
EOF
chmod 0644 /usr/local/onlyoffice/mysql/conf.d/onlyoffice.cnf创建 MySQL 初始化脚本
1
2
3
4
5
6
7
8cat > /usr/local/onlyoffice/mysql/initdb/setup.sql <<EOF
CREATE USER 'onlyoffice_user'@'%' IDENTIFIED BY '123456';
CREATE USER 'mail_admin'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'mail_admin'@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
EOF
部署应用容器
创建 onlyoffice 容器专用网络
1
docker network create --driver bridge onlyoffice
启动 MySQL 容器,这里使用 mysql:5.7 镜像
1
2
3
4
5
6
7
8
9
10
11docker run -it -d \
--restart=always \
--name onlyoffice-mysql-server \
--net onlyoffice \
-p 3306:3306 \
-v /usr/local/onlyoffice/mysql/conf.d:/etc/mysql/conf.d \
-v /usr/local/onlyoffice/mysql/data:/var/lib/mysql \
-v /usr/local/onlyoffice/mysql/initdb:/docker-entrypoint-initdb.d \
-v /usr/local/onlyoffice/mysql/logs:/var/log/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=onlyoffice mysql:5.7启动 onlyoffice 文档服务器
1
2
3
4
5
6
7
8
9
10docker run -i -t -d \
--restart=always \
--name onlyoffice-document-server \
-p 8999:80 \
--net onlyoffice \
-v /usr/local/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
-v /usr/local/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
-v /usr/local/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
-v /usr/local/onlyoffice/DocumentServer/db:/var/lib/postgresql \
onlyoffice/documentserver启动 onlyoffice 社区版容器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17docker run -i -t -d \
--restart=always \
--name onlyoffice-community-server \
-p 80:80 \
-p 443:443 \
-p 5222:5222 \
--net onlyoffice \
-e MYSQL_SERVER_ROOT_PASSWORD=123456 \
-e MYSQL_SERVER_DB_NAME=onlyoffice \
-e MYSQL_SERVER_HOST=onlyoffice-mysql-server \
-e MYSQL_SERVER_USER=onlyoffice_user \
-e MYSQL_SERVER_PASS=123456 \
-v /usr/local/onlyoffice/CommunityServer/data:/var/www/onlyoffice/Data \
-v /usr/local/onlyoffice/CommunityServer/logs:/var/log/onlyoffice \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
--privileged=true \
onlyoffice/communityserver打开浏览器访问
http://192.168.64.63:8999/
验证文档服务器是否正常启动,如下图:
使用浏览器访问
http://192.168.64.63:8081/
,创建一个管理员账号;如下图
登录后如下图所示,点击选择,选择左边栏的
第三方集成
–>文件服务器
,填入文档服务器的地址以及社区服务器的地址,将文档服务器与 onlyoffice 进行关联,实现在线编辑功能.