提前准备 CPU:双核2GHz或更高 内存:4GB或以上 硬盘:至少有40GB的空闲空间 SWAP:至少4GB,但取决于主机作系统。多一点更好 OS:内核版本3.10或更高版本的amd64 Linux发行版 Docker:Docker 团队支持的任何版本 DockerCompose安装 克隆仓库
1 git clone https://github.com/ONLYOFFICE/Docker-DocumentServer
编辑docker-compose.yml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 services: onlyoffice-documentserver: build: context: . image: onlyoffice/documentserver container_name: onlyoffice-documentserver depends_on: - onlyoffice-postgresql - onlyoffice-rabbitmq environment: - DB_TYPE=postgres - DB_HOST=onlyoffice-postgresql - DB_PORT=5432 - DB_NAME=onlyoffice - DB_USER=onlyoffice - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq - ALLOW_PRIVATE_IP=true - JWT_ENABLED=false - SERVER_ROOT=http://192.168.2.165:8088 - DOC_SERVICE_URL=http://onlyoffice-documentserver/ - DOC_EDITOR_URL=http://192.168.2.165:8088/ - STORAGE_URL=http://192.168.2.165:8088/ ports: - "8088:80" extra_hosts: - "192.168.2.165:127.0.0.1" - "host.docker.internal:host-gateway" healthcheck: test: ["CMD" , "curl" , "-f" , "http://localhost:8000/info/info.json" ] interval: 30s retries: 5 start_period: 60s timeout: 10s stdin_open: true restart: always stop_grace_period: 60s volumes: - D:/onlyoffice_docker/data:/var/www/onlyoffice/Data - D:/onlyoffice_docker/logs:/var/log/onlyoffice - D:/onlyoffice_docker/lib:/var/lib/onlyoffice/documentserver/App_Data/cache/files - D:/onlyoffice_docker/www:/var/www/onlyoffice/documentserver-example/public/files - D:/onlyoffice_docker/fonts:/usr/share/fonts onlyoffice-rabbitmq: container_name: onlyoffice-rabbitmq image: rabbitmq:3 restart: always privileged: true expose: - '5672' healthcheck: test: ["CMD" , "rabbitmq-diagnostics" , "status" ] interval: 10s retries: 3 start_period: 10s timeout: 10s onlyoffice-postgresql: container_name: onlyoffice-postgresql image: postgres:15 environment: - POSTGRES_DB=onlyoffice - POSTGRES_USER=onlyoffice - POSTGRES_HOST_AUTH_METHOD=trust restart: always expose: - '5432' volumes: - D:/onlyoffice_docker:/var/lib/postgresql healthcheck: test: ["CMD-SHELL" , "pg_isready -U onlyoffice" ] interval: 10s retries: 3 start_period: 10s timeout: 10s volumes: postgresql_data:
拉取完成后,我们先创建以下文件结构
1 2 3 4 5 6 D:/onlyoffice_docker/ ├── logs/ # 日志目录 ├── data/ # 文档数据目录 ├── lib/ # 库目录 └── db/ # 数据库目录 └── www/ # 文件目录
管理员权限 打开 power shell,输入以下命令启动容器
等待启动完成即可,查看日志确认启动成功
1 2 3 4 5 6 7 8 9 10 11 Installing plugins, please wait...Done Starting supervisor: supervisord. * Starting periodic command scheduler cron ...done. * Starting nginx nginx ...done.
浏览器打开http://localhost:8088
滑动到Testing before integration
1 2 3 4 # Start test example docker exec 60b6c5a2df5b sudo supervisorctl start ds:example # Add it to the autostart: docker exec 60b6c5a2df5b sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-example.conf
点击 GO TO TEST EXAMPLE
创建文件后出现
这里需要修改:
将http://localhost:8088 改为 http://192.168.2.165:8088 允许私有IP 在http://192.168.2.165:8088界面中滑动到管路界面 1 2 3 4 # Start Admin Panel docker exec 07b83f4d40a4 sudo supervisorctl start ds:adminpanel # Add it to the autostart docker exec 07b83f4d40a4 sudo sed 's,autostart=false,autostart=true,' -i /etc/supervisor/conf.d/ds-adminpanel.conf
首次登录需要输入token并重置密码 Token可以通过log查找获得
登录上后台后,设置允许私有IP即可
这时候再到http://192.168.2.165:8088/example中测试
拓展字体 在Windows系统下,字体路径为C:\Windows\Fonts 由于前面的配置中,我们已经配置了字体目录,因此只需要将字体复制到D:/onlyoffice_docker/fonts即可 进入容器,重新加载字体 1 2 cd /usr/bin ./documentserver-generate-allfonts.sh
4. 刷新测试文档即可看到加载字体
默认语言改中文 修改容器文件 /etc/onlyoffice/documentserver-example/default.json 将 "language" 中的 “zh” 移动到最前面
与Seafile集成 找到 seahub_settings.py 由于我们在 Seafile 社区版13.0 部署 中已经配置了映射路径 这里可以在 F:\seafile\seafile-data\seafile\conf中找到
在结尾加上即可
1 2 3 4 5 ENABLE_ONLYOFFICE = True VERIFY_ONLYOFFICE_CERTIFICATE = False ONLYOFFICE_APIJS_URL = 'http://192.168.2.165:8088/web-apps/apps/api/documents/api.js' ONLYOFFICE_FILE_EXTENSION = ('doc' , 'docx' , 'ppt' , 'pptx' , 'xls' , 'xlsx' , 'odt' , 'fodt' , 'odp' , 'fodp' , 'ods' , 'fods' ) ONLYOFFICE_EDIT_FILE_EXTENSION = ('doc' , 'docx' , 'ppt' , 'pptx' , 'xls' , 'xlsx' , 'odt' , 'fodt' , 'odp' , 'fodp' , 'ods' , 'fods' )
重启Seafile容器即可
参考链接