1、安装LANMP环境
yum -yinstall gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysqlhttpd-manual mod_ssl mode_perl mod_auth_mysql php-gd php-xml php-mbstringphp-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devellibdbi-dbd-mysql net-snmp-devel curl-devel unix0DBC-devel OpenIPMI-develjava-devel
2、测试PHP
cd /var/www/html/
vim index.php
<?php
phpinfo();
?>
chkconfig httpd on
service http restart
在网页输入服务器的IP地址,测试PHP是否正常:
3、安装Zabbix-Server
tar zxvf zabbix-2.2.10.tar.gz
cd zabbix-2.2.10
./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
checking for main in -lodbc... yes
checking whether unixodbc is usable... no
configure: error: cannot use unixODBC library
yum install unixODBC-devel
./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
checking for SSH2 support... no
configure: error: SSH2 library not found
yum install -y libssh2-devel
./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
checking for LDAP support... no
configure: error: Invalid LDAP directory - unable to find ldap.h
yum install openldap
yum install openldap-devel
./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
make && make install
4、配置MySQL,导入zabbix数据库
useradd zabbix
cd zabbix-2.2.10
chkconfig mysqld on
service mysqld restart
修改root密码,创建名为zabbix的数据库及用户名和密码都是zabbix的用户
mysqladmin -uroot password ‘mysql_pass‘
mysql -uroot -p
create database zabbix characer set utf8;
grant all privileges on zabbix.* to [email protected] identified by ‘zabbix‘;
flush privileges;
导入数据库
mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix/
5、复制启动脚本
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_server
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
6、服务器端配置,将数据库、用户名、密码修改为刚才新建的
vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
7、复制网页文件值apache目录
cp -r ./frontends/php/ /var/www/html/zabbix
chown -R apache.apache /var/www/html/zabbix
chkconfig zabbix_server on
service zabbix_server restart
8、通过WEB配置Zabbix-Server
修改/etc/php.ini后,重启httpd服务
service httpd restart