groupadd zabbix -g 201
useradd -g zabbix -u 201 -m zabbix
tar xvf zabbix-2.4.4.tar.gz
cd $d
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl
make
make install
mysql -e "create database zabbix default charset utf8;"
mysql -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';"
mysql -e "grant all on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';"
mysql -e "grant all on zabbix.* to zabbix@'%' identified by 'zabbix';"
mysql -uzabbix -pzabbix zabbix < /root/zabbix-2.4.4/database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < /root/zabbix-2.4.4/database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < /root/zabbix-2.4.4/database/mysql/data.sql
#修改/etc/init.d目录下的zabbix_server和zabbix_agentd 启动文件
sed -i 's@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g' /etc/init.d/zabbix_*
# 修改zabbix——server.conf
sed -i 's@LogFile=/tmp/zabbix_server.log@LogFile=/var/log/zabbix/zabbix_server.log@g' /etc/zabbix/zabbix_server.conf
sed -i 's@DBUser=root@DBUser=zabbix@g' /etc/zabbix/zabbix_server.conf
sed -i 's@# DBPassword=@DBPassword=zabbix@g' /etc/zabbix/zabbix_server.conf
# 修改/etc/zabbix/zabbix_agentd.conf,这里的ip地址写的是zabbix_server的ip
sed -i "s@Server=127.0.0.1@Server=127.0.0.1,$hip@g" /etc/zabbix/zabbix_agentd.conf
sed -i "s@ServerActive=127.0.0.1@ServerActive=$hip:10051@g" /etc/zabbix/zabbix_agentd.conf
sed -i "s@/tmp/zabbix_agentd.log@/var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf
sed -i "s@# UnsafeUserParameters=0@UnsafeUserParameters=0@g" /etc/zabbix/zabbix_agentd.conf