该脚本在CentOS 6.0 64位和RedHat 5.5 32位上都测试通过
脚本内容
#!/bin/bash
#author suzezhi
#this line below is essential
#the myql user who have an privilege to create a database for zabbix
MySQLuser="root"
#the password of zabbix database user
zabbixpasswd="zabbix"
#the mysqlpath you installed
mysqlpath="/usr/local/mysql/bin/mysql_config"
#the zabbix path you want to install
zabbixpath="/usr/local/zabbix"
mysqlpassword=""
if [ -z $mysqlpassword ];then
mysqlpasswd=""
else
mysqlpasswd=-p$mysqlpassword
fi
yum -y install OpenIPMI-devel curl-devel net-snmp-devel
groupadd zabbix
useradd -g zabbix zabbix
tar xzvf zabbix-1.8.8.tar.gz
cd zabbix-1.8.8
mysql -u $mysqluser -p$mysqlpasswd -e 'create database zabbix character set utf8'
mysql -u $mysqluser -p$mysqlpasswd -e "grant all privileges on zabbix.* to zabbix@localhost identified by '$zabbixpasswd'"
mysql -u $mysqluser -p$mysqlpasswd zabbix < create/schema/mysql.sql
mysql -u $mysqluser -p$mysqlpasswd zabbix < create/data/images_mysql.sql
mysql -u $mysqluser -p$mysqlpasswd zabbix < create/data/data.sql
./configure --prefix=$zabbixpath --enable-server --enable-proxy --enable-agent --with-mysql=$mysqlpath --with-net-snmp --with-libcurl --with-openipmi
make install
cat >> /etc/services << EOF
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
EOF
#modify the configuration file
mkdir /etc/zabbix
cp misc/conf/zabbix_server.conf /etc/zabbix/
cp misc/conf/zabbix_agent.conf /etc/zabbix/
cp misc/conf/zabbix_agentd.conf /etc/zabbix/
cp misc/conf/zabbix_proxy.conf /etc/zabbix/
sed -i 's/^DBUser=root/DBUser=zabbix/' /etc/zabbix/zabbix_server.conf
sed -i "/^DBUser=zabbix/a\DBPassword=$zabbixpasswd" /etc/zabbix/zabbix_server.conf
cp misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d/zabbix-agentd
cp misc/init.d/redhat/8.0/zabbix_server /etc/init.d/zabbix-server
chmod a+x /etc/init.d/zabbix-agentd
chmod a+x /etc/init.d/zabbix-server
chkconfig --add zabbix-server
chkconfig --add zabbix-agentd
sed -i 's#zabbix/bin#zabbix/sbin#' /etc/init.d/zabbix-server
sed -i 's#zabbix/bin#zabbix/sbin#' /etc/init.d/zabbix-agentd
/etc/init.d/zabbix-server start
/etc/init.d/zabbix-agentd start
chkconfig zabbix-server on
chkconfig zabbix-agentd on
先大概的解释一下,前面一部分是设置环境变量的,你可以根据自己具体的环境,进行具体的设置
然后就是安装一些依赖包,并添加zabbix这个用户,
再然后就是创建数据库,并导入结构,再导入数据
然后就是安装,添加端口了
最后修改配置文件,添加开机启动
脚本运行完之后,把frontends/php目录下的文件都拷贝到一个位置,并新建一个虚拟主机,指向这个目录
下面就可以进行安装了
截图如下:
点击下一步即可(在这里可能还需要修改php的配置文件)