ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 说明 如果你只需要创建本地的在线编辑服务器,并且使用自己的文件管理器,那么可以不使用 onlyoffice-community-server 服务 ## 安装 ### docker #### 安装 onlyoffice-document-server 1. 创建挂在的目录 ``` // 创建文档服务器容器需要挂载的目录 mkdir -p /usr/local/onlyoffice/DocumentServer/{data,logs} ``` 1. 部署容器 ``` // 启动 onlyoffice 文档服务器 docker run -i -t -d \ --restart=always \ --name onlyoffice-document-server \ -p 8999:80 \ -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/communityserver 1. 创建挂在目录 ``` // 创建 MySQL 容器需要挂载的目录 mkdir -p /usr/local/onlyoffice/mysql/conf.d mkdir -p /usr/local/onlyoffice/mysql/{data,initdb,logs} chown 999:999 /usr/local/onlyoffice/mysql/logs // 创建邮件服务器容器需要挂载的目录 mkdir -p /usr/local/onlyoffice/MailServer/{data,logs} mkdir -p /usr/local/onlyoffice/MailServer/data/certs // 创建 onlyoffice 社区服务容器需要挂载的目录 mkdir -p /usr/local/onlyoffice/CommunityServer/{data,logs} // 创建 MySQL 容器配置文件 cat > /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 初始化脚本 cat > /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 ``` 2. 创建容器 ``` // 非必须 docker network create --driver bridge onlyoffice docker 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 社区版容器 docker 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 ```