DzzOffice 是一套开源办公套件,适合企业或团队自建一个类似「Google 企业应用套件」「微软 Office365」的协同办公平台,官网在 http://www.dzzoffice.com/。这篇记录它在一台 CentOS 7 虚机上的完整部署过程。
功能与部署要求
社区版自带这些模块:网盘(文件集中管理)、在线文档 / 表格 / 演示文稿(对应 Word、Excel、PPT 协作)、多人协作记录、企业新闻通知、通讯录、文集、相册、任务板、讨论板、表单问卷、FTP/SFTP 上传,外加一个支持一键安装组件的应用市场。
运行环境要求:Nginx 最新稳定版、MySQL 5.7 或 8.0、PHP 7.4 / 8.0、Redis 5.6 / 6.0 / 7.0。可以用现成的 LNMP 一键脚本先把底座装好(脚本须以 root 执行,仅适用于 CentOS 7):
#脚本执行用户必须为root,授予脚本执行权限执行
chmod +x lnmp+redis_install
./lnmp+redis_install
手动准备的话,先处理防火墙和 SELinux,再补齐编译与运维常用工具包:
# 检查防火墙是否运行
firewall-cmd --state
# 如果防火墙运行,则执行下面的命令关闭
systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld
#检查SELinux是否运行,必须关闭
getenforce
#如果SELinux运行,则执行下面的命令将永久其关闭
sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0 && getenforce
yum -y install gcc gcc-c++ libaio make cmake zlib-devel openssl-devel pcre pcre-devel wget git curl lynx lftp mailx mutt rsync ntp net-tools vim lrzsz screen sysstat yum-plugin-security yum-utils createrepo bash-completion zip unzip bzip2 tree tmpwatch pinfo man-pages lshw pciutils gdisk system-storage-manager git gdbm-devel sqlite-devel
部署 Nginx
Nginx 用 RPM 方式安装,版本 1.18,包在官方仓库 http://nginx.org/packages/rhel/7/x86_64/RPMS/ 都有:
[root@localhost ~]# mkdir /opt/soft
[root@localhost ~]# cd /opt/soft/
[root@localhost soft]# rpm -ivh nginx-1.18.0-1.el7.ngx.x86_64.rpm
主配置重点改两处:上传相关把 client_max_body_size 放宽到 500M、超时 120 秒;虚拟主机删掉默认 server 段,站点根目录指向 /var/www/dzzoffice,PHP 请求转给 127.0.0.1:9000 的 php-fpm:
[root@localhost ~]# vim /etc/nginx/nginx.conf
#user nobody;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
accept_mutex on;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens on;
keepalive_timeout 65;
charset utf-8;
types_hash_max_size 2048;
client_max_body_size 500M; //上传文件大小标准
client_body_timeout 120; //上传文件超时时间
gzip on;
gzip_min_length 1k;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
include /etc/nginx/conf.d/*.conf;
}
[root@localhost ~]# vim /etc/nginx/nginx.conf
#user nobody;
worker_processes 4; #根据实际CPU核数配置
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
accept_mutex on;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens on;
keepalive_timeout 65;
charset utf-8;
types_hash_max_size 2048;
client_max_body_size 16M;
gzip on;
gzip_min_length 1k;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
include /etc/nginx/conf.d/*.conf;
}
#将下面默认的配置内容全部删除,然后将下面的配置文件复制黏贴进去,注意文件存储路径修改为自己存储的路径
[root@localhost ~]# echo > /etc/nginx/conf.d/default.conf
[root@localhost ~]# vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /var/www/dzzoffice; #dzzoffice文件存储的路径
location / {
index index.php index.html index.htm;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000; #php服务的地址
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
[root@localhost ~]# mkdir -p /var/www/dzzoffice
[root@localhost ~]# chown -R nginx. /var/www/dzzoffice
启动并设置开机自启:
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# systemctl enable nginx
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
[root@localhost ~]# firewall-cmd --reload
部署 MySQL
MySQL 5.7.30 同样走 RPM 安装,包可以从官网归档页 https://dev.mysql.com/downloads/mysql/ 或清华镜像 https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/ 取:
[root@localhost soft]# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-common-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-libs-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-libs-compat-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-devel-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm
[root@localhost soft]# rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
[root@localhost soft]# yum -y install mysql-community-*
[root@localhost soft]# systemctl start mysqld
[root@localhost soft]# systemctl enable mysqld
装完先重置 root 密码(临时关闭强度校验策略),再建 DzzOffice 专用的库。示例里直接用了 root,生产环境建议单独建授权用户:
#重置ROOT密码
[root@localhost ~]# cat /var/log/mysqld.log |grep password
[root@localhost ~]# mysql -uroot -p
Enter password:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_number_count=0;
mysql> set global validate_password_special_char_count=0;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'dqz123.';
#创建DzzOffice库
mysql> CREATE DATABASE `dzzoffice` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
#我这里直接使用root账号了,建议生产环境单独创建一个DzzOffice的用户
部署 PHP
PHP 用 remi 源装 7.4,先加源和 libargon2 依赖:
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#安装依赖
[root@localhost ~]# rpm -Uvh http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libargon2-20161029-3.el7.x86_64.rpm
[root@localhost ~]# yum install libargon2
安装 php74-php 系列组件,配置 PATH 并做软链:
[root@localhost ~]# yum --enablerepo=remi install php74-php php74-php-pear php74-php-bcmath php74-php-pecl-jsond-devel php74-php-mysqlnd php74-php-gd php74-php-common php74-php-fpm php74-php-intl php74-php-cli php74-php php74-php-xml php74-php-opcache php74-php-pecl-apcu php74-php-pdo php74-php-gmp php74-php-process php74-php-pecl-imagick php74-php-devel php74-php-mbstring php74-php-zip php74-php-ldap php74-php-imap php74-php-pecl-mcrypt
[root@localhost ~]# vim /etc/profile
export PATH=/opt/remi/php74/root/usr/bin:$PATH
[root@localhost ~]# source /etc/profile
[root@localhost ~]# ln -sv /opt/remi/php74/root/bin/php /usr/bin/php
[root@localhost ~]# php -v
两项关键配置:php-fpm 的运行用户改成 nginx,上传限制按 DzzOffice 建议放到 50M 以上(注意这里的 upload_max_filesize、post_max_size 要和前面 Nginx 的 client_max_body_size 一起调,只放开一边照样传不了大文件):
#如果你运行的是nginx而不是apache,修改
[root@localhost ~]# vim /etc/opt/remi/php73/php-fpm.d/www.conf
#更改为nginx用户和组
user = nginx
group = nginx
#修改php文件上传大小限制,dzzoffice建议50M以上
[root@localhost ~]# vim /etc/opt/remi/php74/php.ini
upload_max_filesize= 50M //这个是文件上传大小限制
post_max_size=50M //这个是post请求大小限制
[root@localhost ~]# systemctl start php74-php-fpm.service
[root@localhost ~]# systemctl enable php74-php-fpm.service
安装 DzzOffice 本体
程序包在官网和 GitHub / 码云仓库都能下载:


解压到 Nginx 站点目录并授权、重载:
[root@localhost soft]# tar -xf dzzoffice-2.02.1.tar.gz
[root@localhost soft]# mv dzzoffice-2.02.1/* /var/www/dzzoffice/
[root@localhost soft]# chown -R nginx. /var/www/dzzoffice/
#重载Nginx配置
[root@localhost soft]# nginx -s reload
之后浏览器直接访问服务器 IP 进入安装向导,依次确认环境检测、填写刚才建好的数据库信息和管理员账号即可:











装好后进入应用市场,未安装的组件会显示【安装】按钮,装完再启用,网盘、文档这些模块就是这么按需加的:


收尾提醒
上传大文件失败时先查日志确认卡在 Nginx 还是 PHP,两边限制要对齐;数据目录建议挂独立磁盘,方便后续扩容和迁移。


















暂无评论内容