首页 > 代码库 > zabbix完全安装
zabbix完全安装
①环境
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
②下载解压
wget http://prdownloads.sourceforge.net/zabbix/zabbix-2.0.10.tar.gz?download
tar zxvf zabbix-2.0.10.tar.gz
③配置zabbix数据库
useradd zabbix
cd zabbix-2.0.10
\cp -rf /usr/share/doc/mysql-server-5.0.77/my-medium.cnf /etc/my.cnf
mysql_install_db --user=mysql
/etc/init.d/mysqld start
进入数据库:
mysql -u root -p
create database zabbix character set utf8;
grant all on zabbix.* to zabbix@localhost identified by ‘pwd@zabbix‘;
grant all on zabbix.* to zabbix@127.0.0.1 identified by ‘pwd@zabbix‘;
flush privileges;
quit
退出数据库
mysql -uzabbix -pzabbixpwd zabbix < create/schema/mysql.sql(schema.sql)
mysql -uzabbix -pzabbixpwd zabbix < create/data/data.sql
mysql -uzabbix -pzabbixpwd zabbix < create/data/images_mysql.sql
④编译安装zabbix
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --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 misc/conf/zabbix_server.conf /etc/zabbix/
cp misc/conf/zabbix_proxy.conf /etc/zabbix/
cp misc/conf/zabbix_agent.conf /etc/zabbix/
cp misc/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
* 启动 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
⑥WEB配置zabbix
打开 http://localhost/,看到提示:
Timezone for PHP is not set. Please set "date.timezone" option in php.ini.
按照提示,修改 php.ini 中时区设置:
date.timezone = Asia/Shanghai
service httpd restart
依次单击下一步,在环境检测时会看到几个fail,再次修改 php.ini,根据提示设置相应参数:
post_max_size = 32M
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
upload_max_filesize = 32M
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
解决后按提示继续安装即可。
⑦结束:
安装完后直接访问:
http://localhost/
默认用户名和密码是:
admin/zabbix
客户端安装配置:
①环境
yum -y install gcc
②下载解压
tar zxf zabbix-2.0.10.tar.gz
③配置zabbix用户
useradd zabbix
cd zabbix-2.0.10
④编译安装zabbix
./configure --prefix=/usr/local/zabbix --enable-agent && \
make && \
make install
⑤zabbix服务配置
* 服务端口定义:
编辑 /etc/services,在后面追加:
cat >> /etc/services << "EOF"
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
EOF
* 复制配置文件:
mkdir /etc/zabbix
cp misc/conf/zabbix_agent.conf /etc/zabbix/
cp misc/conf/zabbix_agentd.conf /etc/zabbix/
* 修改配置文件:
vi /etc/zabbix/zabbix_agent.conf
Server=192.168.168.100
vi /etc/zabbix/zabbix_agentd.conf
Server=192.168.168.100
Hostname=server30
* 安装启动脚本
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
chmod a+x /etc/init.d/zabbix_agentd
* 修改 /etc/init.d/zabbix_agentd 变量定义:
BASEDIR=/usr/local/zabbix
FULLPATH=$BASEDIR/sbin/$BINARY_NAME
* 添加到启动服务:
chkconfig --add zabbix_agentd
* 启动 Zabbix Agentd
/etc/init.d/zabbix_agentd start
zabbix完全安装