一.部署环境
系统:CentOS 6.4x64 最小化安装
Server:192.168.3.28
Client:192.168.3.29
二.基础软件包安装
在server安装基础软件包,这里的环境使用yum安装,如果使用源码安装也是可以的。
[[email protected] ~]# yum -y install wget vim tree gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-devel curl-devel
启动httpd、mysql并设置成开机自动启动
[[email protected] ~]# service httpd start [[email protected] ~]# service mysqld start [[email protected] ~]# chkconfig httpd on [[email protected] ~]# chkconfig mysqld on
在iptables中放行80,3306端口。
[[email protected] ~]# iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT #查看防火墙结果 [[email protected] ~]# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports 80,10050:10051 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination #保存iptables规则 [[email protected] ~]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
三.配置PHP参数
zabbix的运行需要特定的php参数支持,修改如下
[[email protected] ~]# sed -i "[email protected];date.timezone [email protected] = Asia/[email protected]" /etc/php.ini [[email protected] ~]# sed -i "[email protected]_execution_time = [email protected]_execution_time = [email protected]" /etc/php.ini [[email protected] ~]# sed -i "[email protected]_max_size = [email protected]_max_size = [email protected]" /etc/php.ini [[email protected] ~]# sed -i "[email protected]_input_time = [email protected]_input_time = [email protected]" /etc/php.ini [[email protected] ~]# sed -i "[email protected]_limit = [email protected]_limit = [email protected]" /etc/php.ini [[email protected] ~]# sed -i "[email protected];mbstring.func_overload = [email protected]_overload = [email protected]" /etc/php.ini
修改httpd的FQDN错误,重启httpd服务
[[email protected] ~]# echo "ServerName localhost:80" >>/etc/httpd/conf/httpd.conf [[email protected] ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
四.下载zabbix-2.4.5.tar.gz
[[email protected] ~]# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz
五.添加zabbix用户和组
[[email protected] ~]# groupadd -g 201 zabbix [[email protected] ~]# useradd -g zabbix -u 201 -s /sbin/nologin zabbix
六.安装zabbix
[[email protected] ~]# tar xf zabbix-2.4.5.tar.gz [[email protected] ~]# cd zabbix-2.4.5 [[email protected] zabbix-2.4.5]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl [[email protected] zabbix-2.4.5]# make && make install #创建zabbix数据库以及相关表 [[email protected] zabbix-2.4.5]# mysql -e "create database zabbix ;" [[email protected] zabbix-2.4.5]# mysql -e "grant all on zabbix.* to [email protected] identified by ‘zabbix‘;" [[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql [[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql [[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql #配置软连接和启动文件信息 [[email protected] zabbix-2.4.5]# mkdir /var/log/zabbix [[email protected] zabbix-2.4.5]# chown zabbix.zabbix /var/log/zabbix [[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/etc/ /etc/zabbix [[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/bin/* /usr/bin/ [[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/ [[email protected] zabbix-2.4.5]# cp /root/zabbix-2.4.5/misc/init.d/fedora/core/zabbix_* /etc/init.d [[email protected] zabbix-2.4.5]# chmod 755 /etc/init.d/zabbix_* #修改/etc/init.d目录下的zabbix_server和zabbix_agentd启动文件 [[email protected] zabbix-2.4.5]# sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_server [[email protected] zabbix-2.4.5]# sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_agent #修改/etc/zabbix/zabbix_server.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected][email protected]" /etc/zabbix/zabbix_server.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected]#[email protected][email protected]" /etc/zabbix/zabbix_server.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected]# [email protected][email protected]" /etc/zabbix/zabbix_server.conf #修改/etc/zabbix/zabbix_agentd.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected]=127.0.0.1,[email protected]" /etc/zabbix/zabbix_agentd.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected]=$IP:[email protected]" /etc/zabbix/zabbix_agentd.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected]/[email protected]/log/zabbix/[email protected]" /etc/zabbix/zabbix_agentd.conf [[email protected] zabbix-2.4.5]# sed -i "[email protected]^# [email protected]=1\[email protected]" /etc/zabbix/zabbix_agentd.conf
时间: 2024-10-23 08:32:27