环境:已有mysql
mysql> select version(); +------------+ | version() | +------------+ | 5.6.21-log | +------------+ 1 row in set (0.04 sec)os
[root@keepalived13 ~]# lsb_release -d Description: Oracle Linux Server release 6.4
zabbix需要lamp,因为决定使用已有mysql,所以其中的mysql就不再装了
1.1安装主程序 (mysql mysql-server 不装)
# yum -y install httpd php php-mysql
1.2安装apache扩展
# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
1.3安装php扩展 (php-mbstring php-bcmath后面单独装)
# yum -y install php-gd php-xml php-ldap php-pear php-xmlrpc
1.4安装mysql扩展(mysql-devel不装)
# yum -y install mysql-connector-odbc libdbi-dbd-mysql
因为我使用的是本地源,所以本地源没有的包需要下载后安装
yum -y install libmcrypt-2.5.8-9.el6.x86_64.rpm
yum -y install php-mcrypt-5.3.3-1.el6.rf.x86_64.rpm
yum install -y php-mbstring-5.3.3-22.el6.x86_64.rpm
yum install -y php-bcmath-5.3.3-22.el6.x86_64.rpm
sed -i 's/^.*date\.timezone.*=.*$/date\.timezone = Asia\/Shanghai/g' /etc/php.ini
sed -i 's/^.*max_execution_time.*=.*$/max_execution_time = 300/g' /etc/php.ini
sed -i 's/^.*post_max_size.*=.*$/post_max_size = 32M/g' /etc/php.ini
sed -i 's/^.*max_input_time.*=.*$/max_input_time=300/g' /etc/php.ini
sed -i 's/^.memory_limit.*=.*$/memory_limit = 128M/g' /etc/php.ini
sed -i 's/^.mbstring\.func_overload.*=.*$/mbstring.func_overload = 1/g' /etc/php.ini
查看修改结果
[root@oel64 ~]# cat /etc/php.ini | egrep '^date.timezone|^max_execution|^post_max_size|^memory_limit|^mbstring' max_execution_time = 300 memory_limit = 128M post_max_size = 32M date.timezone = Asia/Shanghai mbstring.func_overload = 1
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix@localhost identified by 'pwd4zabbix';
grant all privileges on zabbix.* to zabbix@'192.168.56.%' identified by 'pwd4zabbix';
flush privileges;
下载地址:http://www.sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.1/zabbix-2.4.1.tar.gz/download
yum install -y libcurl-devel.x86_64 net-snmp-devel.x86_64
tar zxf zabbix-2.4.1.tar.gz
cd zabbix-2.4.1
mkdir /usr/local/zabbix
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
make && make install
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
ln -s -f /usr/local/zabbix/bin/* /usr/bin/
ln -s -f /usr/local/zabbix/sbin/* /usr/sbin/
mkdir -p /var/www/html/zabbix
cp -R frontends/php/* /var/www/html/zabbix
chown -R apache.apache /var/www/html/zabbix
cp conf/zabbix_agentd/userparameter_mysql.conf /usr/local/zabbix/etc/zabbix_agentd.conf.d/
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
sed -i 's/^.*DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=pwd4zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBSocket=.*$/DBSocket=\/tmp\/user_3306.sock/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/.*BASEDIR=\/usr\/local.*$/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/.*BASEDIR=\/usr\/local.*$/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
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
service httpd start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
打开 http://192.168.56.13/zabbix
开始界面如图,进入下一步
如果前面/etc/php.ini里的参数配制不对,这儿会有错误提示,根据对应提示可以检查对应的参数,修正后再重试
如果sock文件不对,这一步无法连接,可以加个软链
mkdir /var/lib/mysql/ ln -s /tmp/user_3306.sock /var/lib/mysql/mysql.sock
setenforce 0
后面的按提示进行下一步就可以了
这儿默认用户及密码为admin/zabbix
ok,进入