安装依赖包:
[root@zabbix src]# yum -y install 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-devel curl-devel unixODBC-devel \
> OpenIPMI-devel java-devel openldap openldap-devel libssh2-devel
修改php所需环境:
[root@zabbix src]# vi /etc/php.ini
date.timezone = Asia/Chongqing
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
mbstring.func_overload = 1
添加用户:
[root@zabbix src]# groupadd zabbix -g 201
[root@zabbix src]# useradd -g zabbix -u 201 -m zabbix
下载zabbix并安装:
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz
[root@zabbix src]# tar zxf zabbix-2.4.5.tar.gz
[root@zabbix src]# cd zabbix-2.4.5
[root@zabbix zabbix-2.4.5]# ./configure --prefix=/usr/local/zabbix \
> --enable-server --enable-proxy --enable-agent \
> --with-mysql --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc \
> --with-ldap --with-ssh2 --enable-java
注:这里全部功能都安装了,所以加的参数也比较多,如果只安装服务器,只需要开启--enable-server。如果安装缺少相应的依赖包,yum 安装缺少的软件名即可
[root@zabbix zabbix-2.4.5]# make && make install
准备mysql数据库:
[root@zabbix zabbix-2.4.5]# /etc/init.d/mysqld start
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
mysql> flush privileges;
导入数据库:
[root@zabbix zabbix-2.4.5]# cd /usr/local/src/zabbix-2.4.5/database/mysql/
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < schema.sql
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < images.sql
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < data.sql
创建日志文件夹并修改所属组和所有者:
[root@zabbix ~]# mkdir /var/log/zabbix
[root@zabbix ~]# chown zabbix.zabbix /var/log/zabbix/
复制service启动脚本:
[root@zabbix zabbix-2.4.5]# cd /usr/local/src/zabbix-2.4.5
[root@zabbix zabbix-2.4.5]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@zabbix zabbix-2.4.5]# chmod 755 /etc/init.d/zabbix_*
[root@zabbix zabbix-2.4.5]# vi /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
[root@zabbix zabbix-2.4.5]# vi /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
配置zabbix_server.conf服务器配置文件:
[root@zabbix zabbix-2.4.5]# vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
LogSlowQueries=1000
复制zabbix网页文件到apache目录:
[root@zabbix zabbix-2.4.5]# cp -r frontends/php/ /var/www/html/
[root@zabbix zabbix-2.4.5]# mv /var/www/html/php/ /var/www/html/zabbix
[root@zabbix zabbix-2.4.5]# chown -R apache.apache /var/www/html/zabbix/
开启zabbix服务:
[root@zabbix zabbix-2.4.5]# /etc/init.d/zabbix_server start
[root@zabbix zabbix-2.4.5]# /etc/init.d/httpd start
开启zabbix服务
#chkconfig zabbix_server on
#chkconfig httpd on
#chkconfig mysqld on
#service mysqld
#service httpd
#service zabbix_server
添加系统目录:
[root@zabbix src]# ln -s /usr/local/zabbix/bin/* /usr/local/bin/
[root@zabbix src]# ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
注:
默认用户名/密码:Admin/zabbix
如果报java错误,现用yum卸载原有的java,在安装java和java-devel。即可
本文转自 zhuxtqw 51CTO博客,原文链接:http://blog.51cto.com/1054054/1703257,如需转载请自行联系原作者