①环境
yum -y install gcc mysql-server httpd php php-mysql php-gd php-bcmath php-xml php-mbstring mysql-devel php-snmp net-snmp-devel net-snmp net-snmp-utils OpenIPMI-devel curl-devel
②下载解压
tar zxvf zabbix-2.0.*.tar.gz
mysql
③配置zabbix数据库
useradd zabbix
cd zabbix-2.0.0
\cp -rf /usr/share/doc/mysql-server-5.0.95/my-medium.cnf /etc/my.cnf
mysql_install_db --user=mysql
/etc/init.d/mysqld start
进入数据库:
mysql
create database zabbix character set utf8;
grant all on zabbix.* to zabbix@localhost identified by 'zabbixpwd';
quit
退出数据库
mysql -uzabbix -pzabbixpwd zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbixpwd zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbixpwd zabbix < database/mysql/data.sql
④编译安装zabbix
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-openipmi && \
make && \
make install
⑤zabbix服务配置
* 服务端口定义:
编辑 /etc/services,在后面追加:
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
* 复制配置文件:
mkdir /etc/zabbix
cp conf/zabbix_server.conf /etc/zabbix/
cp conf/zabbix_proxy.conf /etc/zabbix/
cp conf/zabbix_agent.conf /etc/zabbix/
cp conf/zabbix_agentd.conf /etc/zabbix/
* 修改 zabbix server 配置文件 /etc/zabbix/zabbix_server.conf 中的数据库用户名和密码:
sed -i '95s/root/zabbix/' /etc/zabbix/zabbix_server.conf
sed -i '103a\DBPassword=zabbixpwd' /etc/zabbix/zabbix_server.conf
* 安装启动脚本
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
* 修改 /etc/init.d/zabbix_server 变量定义:
sed -i '19s#opt#usr/local#' /etc/init.d/zabbix_server
sed -i '25s#bin#sbin#' /etc/init.d/zabbix_server
* 修改 /etc/init.d/zabbix_agentd 变量定义:
sed -i '19s#opt#usr/local#' /etc/init.d/zabbix_agentd
sed -i '25s#bin#sbin#' /etc/init.d/zabbix_agentd
# vi /etc/zabbix/zabbix_server.conf
修改 DBUser=zabbix (102行)
#vi /etc/zabbix/zabbix_agentd.conf
修改Agentd配置文件,更改HOST NAME 为本机的hostname就好了 (92行)
* 启动 Zabbix Server:
/etc/init.d/zabbix_server start
* 启动 Zabbix Agentd
/etc/init.d/zabbix_agentd start
* 配置WEB,复制 Web Interface 到 web 目录:
cp -r frontends/php/* /var/www/html/
/etc/init.d/httpd start
⑥修改php.ini:
# vi /etc/php.ini 找到如下几项,改成下面的值,前面有;号的要删掉
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
upload_max_filesize = 32M
重启apache
#service httpd restart
关闭防火墙:
#service /etc/init.d/iptables stop
关闭SELinux
#setup
WEB配置zabbix
打开 http://localhost/
Current value Required Recommended
PHP version 5.1.6 5.0 5.3.0 Ok
PHP memory limit 16M 128M 256M Fail
PHP post max size 8M 16M 32M Fail
PHP upload max filesize 2M 2M 16M Ok
PHP max execution time 30 300 600 Fail
PHP max input time 60 300 600 Fail
PHP timezone Asia/Shanghai Ok
PHP databases support MySQL Ok
PHP BC math yes Ok
PHP MB string yes Ok
PHP Sockets yes Ok
PHP GD 2.0.28 2.0 2.0.34 Ok
GD PNG Support yes Ok
libxml module 2.6.26 2.6.15 2.7.6 Ok
ctype module yes Ok
解决后按提示继续安装即可。
mysql登录信息:
mysql 端口号:3306
用户名:zabbix
mysql登录界面:
端口号:3306
用户名:zabbix
密码:zabbixpwd
保存zabbix.conf.php
把这个文件放置在 /var/www/html/conf 下面
⑦结束:
安装完后直接访问:
http://localhost/
默认用户名和密码是:
admin/zabbix
本文出自 “PETER-疏狂少年” 博客,谢绝转载!