ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 前提: 安装docker ## 安装onlyoffice-document-server ### 1.创建挂载目录 ~~~ // 创建文档服务器容器需要挂载的目录 mkdir -p /usr/local/onlyoffice/DocumentServer/{data,logs} ~~~ ### 2.部署容器 ``` // 启动document-server docker 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-community-server ### 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 // 启动mysql 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 9999: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 \ -e DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server \ //可选,后续可在后台配置document-server的URL -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 ~~~