1. 安装依赖包:
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 unix-ODBC-devl OpenIPMI-devel java-devel
2. 配置PHP所需环境
Vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
mbstring.func_overload = 2
3下载安装Zbbix-Server
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz -P /root
增加zabbix用户
groupadd zabbix
useradd –g zabbix –m zabbix
tar zxf zabbix-2.2.2-tar.gz –C /usr/src
cd /usr/src/zabbix-2.2.2
./configure --prefix=/usr/local/zabbix --sysconfir=/etc/zabbix –enable-server –enable-proxy –enable-agent –enable-ipv6 –with-mysql=/usr/bin/msyql_config –with-net-snmp –with-libcurl –with-openipmi –with-unixodbc –with-ldap –with-ssh2 –enable-java
安装yum install php-pecl-ssh2 libssh2-devel
安装 :
yum install openldap openldap-devel
编译安装:
make && make install
3. 开户数据库
service mysqld start
chkconfig mysqld on
4. 创建zabbix 数据库
mysql –u root
create database zabbix ;
grant all on zabbix.* to zabbix@localhsot identified by ‘zabbix’;
导入zabbix-server的数据库
cd /usr/src/zabbix-2.2.2/database/mysql
mysql –u zabbix –p zabbix < schema.sql
注意:如果是安装proxy,只导入SCHEMA.SQL就好,无须导入下面的SQL,否则proxy无法工作
mysql –u zabbix –p zabbix < images.sql
mysql –u zabbix –p zabbix < data.sql
或者在数据库里这样导入:source /usr/src/zabbix-2.2.2/database/mysql/schema.sql
5. 复制Service 启动脚本
cp /usr/src/zabbix-2.2.2/misc/init.d/fedora/core/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_server
并修改/etc/init.d/zabbix_server
BASEDIR=/usr/local 改为:/usr/local/zabbix
6. 配置zabbix_server.conf
DBUser=zabbix
DBName=zabbix
DBPassword=zabbix
7. 复制网页文件到/var/www/html 下
cp -r /usr/src/zabbix-2.2.2/frontends/php/ /var/www/html/zabbix
chown –R apache.apache /var/www/html/zabbix
8. 开启zabbix服务
chkconfig zabbix_server on
service zabbix_server start
service httpd start
chkconfig httpd on
9. 访问http://ip/zabbix
点击 next
vim /etc/php.ini
搜索date.timezone =
修改:date.timezone=Asia/Shanghai
测试连接:
输入名字:
OK,finish
登录:默认用户名admin 密码:zabbix
到此,zabbix-server 安装完成。
注:防火墙,selinux。
1. 可以直接关闭防火墙和selinux
service iptables stop
vim /etc/selinux/config SELINUX=disable
2或者设置策略
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 22 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 80 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 10051 –j ACCEPT
iptables –A OUTPUT –m state –state NEW –m tcp –p tcp –dport 10050 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 10050 –j ACCEPT