快速部署lamp环境(Linux+Apache+Mysql+PHP)
说明:php版本要求大于等于5.4
yum -y install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath php-ldap
1. 安装mysql 。。。略
2. 初始化mysql
解压zabbix安装包,找到初始化sql文件并导入数据库
sql文件位置/opt/zabbix-3.0.32/database/mysql
导入sql
source /opt/zabbix-3.0.32/database/mysql/schema.sql
source /opt/zabbix-3.0.32/database/mysql/images.sql
source /opt/zabbix-3.0.32/database/mysql/data.sql
3. 编译安装zabbix
./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
4. 修改server配置文件
vi /opt/zabbix/etc/zabbix_server.conf
内容如下
LogFile=/tmp/zabbix_server.log
DBName=zabbix3
DBUser=root
DBPassword=123456
Timeout=4
LogSlowQueries=3000
5. 修改agent配置文件
vi /opt/zabbix/etc/zabbix_agentd.conf
内容如下
LogFile=/tmp/zabbix_agentd.log
Server=192.168.119.11 #server的机器ip
ServerActive=192.168.119.11 #server的机器ip
Hostname=192.168.119.11 #本机ip(根据agent机器做相应修改)
Include=/opt/zabbix/etc/zabbix_agentd.conf.d/*.conf #自定义key的配置文件路径
6. 修改php.ini文件(/etc/php.ini)
sed -i ‘s/post_max_size = 8M/post_max_size = 32M/g‘ /etc/php.ini
sed -i ‘s/upload_max_filesize = 2M/upload_max_filesize = 50M/g‘ /etc/php.ini
sed -i ‘s/;date.timezone =/date.timezone =PRC/‘ /etc/php.ini
sed -i ‘s/max_execution_time = 30/max_execution_time = 600/g‘ /etc/php.ini
sed -i ‘s/max_input_time = 60/max_input_time = 600/g‘ /etc/php.ini
sed -i ‘s/memory_limit = 128M/memory_limit = 256M/g‘ /etc/php.ini
7. 拷贝zabbix服务端、客户端启动脚本到/etc/init.d目录下(可省略)
cp zabbix_server /etc/init.d/
cp zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_*
8. 拷贝zabbix web程序到 WEB 服务目录下
mkdir /var/www/html/zabbix
cp -r /opt/zabbix/frontends/php/* /var/www/html/zabbix/
9. 重启Apache
systemctl restart httpd
10. 启动server和agent
sbin/zabbix_server
sbin/zabbix_agentd
11. 通过WEBUI继续进行安装
WEBUI:server_ip/zabbix/setup.php