部署zabbix
实验环境:
主机 | 主机名 | IP地址 |
Zabbix监控端 | zabbix | 192.168.10.5 |
Linux被监控端 | Server01 | 192.168.10.4 |
zabbix监控端:192.168.10.5 #zabbix的服务端(若要监控本机,则需要配置本机的zabbix agent)。
Zabbix agent被监控主机:192.168.10.4 #zabbix的客户端(被监控端,需要配置Zabbix agent。
关闭selinux、关闭防火墙
# setenforce 0
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
# systemctl stop firewalld
# systemctl disable firewalld
整个环境所需要的软件包
php-5.6.36
libmcrypt-2.5.7
mysql-5.7.26
nginx-1.10.3
zabbix-4.2.6
搭建 LNMP 的环境
安装mysql-5.7.26
Mysql安装略,具体安装过程可以参考mysql安装文档
安装php-5.6.36
安装依赖软件包:
[root@zabbix ~]# yum -y install make apr* autoconf automake curl-devel gcc gcc-c++ openssl openssl-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* libtool* libxml2 libxml2-devel patch libcurl-devel bzip2-devel freetype-devel
安装libmcrypt:
[root@zabbix ~]# tar zxf libmcrypt-2.5.7.tar.gz
[root@zabbix ~]# cd libmcrypt-2.5.7/
[root@zabbix libmcrypt-2.5.7]# ./configure --prefix=/usr/local/libmcrypt && make && make install
安装php
[root@zabbix ~]# tar zxf php-5.6.36.tar.gz
[root@zabbix ~]# cd php-5.6.36/
[root@zabbix php-5.6.36]# ./configure --prefix=/usr/local/php5.6 --with-config-file-path=/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/usr/local/mysql/mysql.sock --with-gd --with-iconv --with-libxml-dir=/usr --with-mhash --with-mcrypt --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-zlib --with-freetype-dir --with-png-dir --with-jpeg-dir --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt --with-curl
[root@zabbix php-5.6.36]# make && make install
生成php.ini配置文件
[root@zabbix php-5.6.36]# cp php.ini-production /etc/php.ini
编辑配置文件/etc/php.ini ,修改后的内容如下:
找到:
;date.timezone =
修改为:
date.timezone = PRC #设置时区找到:
expose_php = On
修改为:
expose_php = Off #禁止显示php版本的信息找到:
short_open_tag = Off
修改为:short_open_tag = On //支持php短标签
找到:
post_max_size = 8M
修改为:
post_max_size = 16M //上传文件大小
找到:
max_execution_time = 30
修改为:
max_execution_time = 300 //php脚本最大执行时间