LNMP环境一键部署脚本
价格:免费
系统要求 | CentOS 7.x |
注意事项 | 系统环境干净 |
安装内容 | Nginx、MySQL、PHP |
最近更新 | 2020年09月27日 |
一、程序简介
DzzOffice是一套开源办公套件,适用于企业、团队搭建自己的 类似“Google企业
官网地址:http://www.dzzo
二、功能介绍
开源社区版本包含如下功能:
- 网盘:企业、团队文件集中管理
- 文档:在线Word协作工具
- 表格:在线Excel协作工具
- 演示文
文章来源(Source):浅时光博客 稿:在线PPT协作工具 - 记录:能够多人参与协作的记录本
- 新闻:文章系统,可用于企业新闻
原文链接:https://www.dqzboy.com 、通知等用途 - 通讯录:企业人员联系方式查询
- 文集:通过树形目录有序管理文档
- 相册:企业图片管理工具
- 任务板:任务管理、团队协作工具
- 讨论板:企业内部论坛
- 表单:表单、问卷工具
- FTP/SFTP:文件上传等
- 应用市场:在线安装自己所需组件,支持一键安装
三、环境准备
LNMP环境一键部署脚本,脚本部署说明:
- Nginx:最新稳定版
- MySQL:5.7+\8.0+
- PHP:PHP74\PHP80
- Redis:5.6+\6.0+\7.0+
#脚本执行用户必须为root,授予脚本执行权限执行
chmod +x lnmp+redis_install
./lnmp+redis_install
注:此脚本只适合CentOS 7系统使用;脚本执行完成后,您可直接参照本文第四章节第4小节部署程序即可!
1、关闭防火墙
# 检查防火墙是否运行
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
2、安装工具
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
四、安装部署
1、部署Nginx
- 我这块采用RPM包的方式安装Nginx,Nginx版本为1.18
- 下载地址:http://ngin
文章来源(Source):浅时光博客 x.org/packages/rhel/7/x86_64/RPMS/
1.1:下载安装
[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
1.2:修改配置
[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
1.3:启动程序
[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
2、部署MySQL
- 我这块采用RPM包的方式安装MySQL,MySQL版本为5.7.30
- 下载地址:
2.1:下载
[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
2.2:安装
[root@localhost soft]# rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
[root@localhost soft]# yum -y install mysql-community-*
2.3:启动
[root@localhost soft]# systemctl start mysqld
[root@localhost soft]# systemctl enable mysqld
2.4:配置
#重置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的用户
3、部署PHP
- 安装方式YUM安装,版本7.4
3.1:添加YUM源
[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
3.2:安装程序
[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
3.3:修改配置
#如果你运行的是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请求大小限制
3.4:启动服务
[root@localhost ~]# systemctl start php74-php-fpm.service
[root@localhost ~]# systemctl enable php74-php-fpm.service
4、部署DzzOffice
4.1:下载部署
- 上面github与码云都可以进行下载,比如我这里通过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
4.2:访问安装
- 因为上面我们是通过nginx代理托管的,所以直接输入IP地址进行访问安装
4.3:应用安装
- 下图为我已经安装好的程序,如果没有安装则会显示【安装】按钮,安装完成后选择启用即可
lnmp脚本会升级内核,执行完后,重启会进不到系统的
手动选择下内核
是指执行完脚本,重启后,选择内核 进入系统 ?
请教一下, 如果执行完,又要手工设置回原来的内核,那么升级内核的目的是什么呢?
升级完内核,需要手动去选择你系统要运行的哪个内核
问题是内核跟lnmp没什么关系,而且,这个脚本升级的5.18内核是进不去的
打不开安装页面啊,显示404
那说明你Nginx配置的有问题