lnmp部署安装

一、服务器环境说明
1.基于Centos7.4
2.自带python2.7.5
3.关闭SELinux
4.防火墙开放nginx 80端口,zabbix_agent 10050端口,mysql本地3306端口
二、lnmp环境部署
1.安装nginx服务
1)yum -y install nginx (安装nginx服务,Centos7.4为1.12.2)
2)vim /etc/nginx/nginx.conf 修改nginx配置文件,在server中添加如下内容:
location / {
index index.php index.html index.htm;
}

    location ~ .php$ {
        fastcgi_buffer_size 128k;
        fastcgi_buffers 32 32k;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

lnmp部署安装_第1张图片
3)systemctl enable nginx (设置开机启动)
4)systemctl start nginx (启动nginx)
5)访问http://ip/ 若显示nginx界面则nginx启动成功
2.安装php环境
1)yum -y install php php-fpm
2)vim /etc/php.ini (修改php配置文件)
3)sed -i ‘s/max_execution_time = 30/max_execution_time = 300/’ /etc/php.ini
sed -i ‘s/max_input_time = 60/max_input_time = 300/’ /etc/php.ini
sed -i ‘s/post_max_size = 8M/post_max_size = 16M/’ /etc/php.ini
sed -i ‘s/;date.timezone =/date.timezone = Asia/Shanghai/’ /etc/php.ini
(修改php.ini配置文件,以符合zabbix的配置要求)
4)systemctl enable php-fpm (设置开机启动)
5)systemctl start php-fpm (启动php-fpm)
6)创建php测试页面
vim /usr/share/nginx/html/test.php 添加如下内容

7)访问http://ip/test.php 若显示php版本信息,则nginx已支持php
3.安装mysql数据库
1)下载mysql rpm源
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2)rpm -ivh mysql80-community-release-el7-1.noarch.rpm (安装rpm源)
3)vim /etc/yum.repos.d/mysql-community.repo 将5.7的enable改为1,8.0的enable改为0(yum将安装mysql5.7最新版,若需要安装其他版本,将其enable修改为1即可)
lnmp部署安装_第2张图片
4)yum -y install mariadb-server (安装mysql5.7.22)
5)systemctl start mysqld (启动mysql)
6)cat /var/log/mysqld.log |grep ‘pass’ (查看mysql随机密码)
7)mysql -u root -p (登陆mysql)
8)set password = password(‘ROOT_pass1’) (设置密码)
9)create database zabbix character set utf8 collate utf8_bin; (创建zabbix数据库)
10)grant all privileges on zabbix.* to zabbix@localhost identified by ‘password’; (创建zabbix用户)

4.安装zabbix_server服务
1)下载zabbix_server rpm源
wget https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2)rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm (安装rpm源)
3)yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
4)vim /etc/zabbix/zabbix_server.conf (设置server端配置文件中的DBPassword库密码)
5)systemctl start zabbix-server systemctl start zabbix-agent (启动服务端及客户端)
6)zcat /usr/share/doc/zabbix-server-mysql-3.4.11/create.sql.gz |mysql -uzabbix -p zabbix (执行建库脚本)
7)cp -r /usr/share/zabbix/* /usr/share/nginx/html/ (将zabbix php文件复制至nginx根目录)
三、zabbix服务端web页面配置
1)http://120.78.74.213/setup.php (浏览zabbix web配置页面)
lnmp部署安装_第3张图片
2)php预检测
lnmp部署安装_第4张图片
3)填写数据库信息,若mysql端口为默认值3306则端口处填写0
lnmp部署安装_第5张图片
lnmp部署安装_第6张图片
lnmp部署安装_第7张图片
lnmp部署安装_第8张图片
4)配置完成,服务端配置信息保存在/etc/zabbix/web/zabbix.conf.php中
默认登陆账号Admin密码zabbix
(服务端日志默认路径为/var/log/zabbix/zabbix_server.log)

你可能感兴趣的:(zabbix安装部署)