天天看點

CentOS6.5安裝與配置Zabbix4.3.13

0、環境準備

配置PHP環境

rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm

yum install php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64

編輯php的ini檔案(vim /etc/php.ini)并修改一下内容,注意date.timezone一定要寫對,否則在配置完zabbix後,顯示的界面全部報錯 
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
always_populate_raw_post_data = -1
ldap.max_links = 10
date.timezone Asia/Shanghai
extension=bcmath.so

yum install php-bcmath php-mbstring php-xml  

不安裝為報以下問題:
PHP bcmath extension missing (PHP configuration parameter --enable-bcmath).
PHP mbstring extension missing (PHP configuration parameter --enable-mbstring).
PHP xmlwriter extension missing.
PHP xmlreader extension missing.
           

配置Http服務

vim /etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.html.var index.php

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

設定web前端
mkdir /var/www/html/zabbix
cp -a zabbix-3.4.13/frontends/php/ /var/www/html/zabbix/

設定apache的執行和所有者
chown -R apache:apache /var/www/html/zabbix

賦予可執行權限
chmod +x /var/www/html/zabbix/conf/
           

1、建立Mysql資料庫

create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to [email protected]'%' identified by 'zabbix';
flush privileges;

mysql>use zabbix;
mysql>source /opt/schema.sql;
mysql>source /opt/images.sql;
mysql>source /opt/data.sql;
           

2、下載下傳解壓安裝包

wget "https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.4.13/zabbix-3.4.13.tar.gz"
tar -zxvf zabbix-3.4.13.tar.gz

cd zabbix-3.4.13/
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

錯誤解決:
configure: error: Unable to use libevent (libevent check failed)
yum install libevent-devel -y
configure: error: Unable to use libpcre (libpcre check failed)
yum -y install pcre* 

make
make install


配置zabbix的服務和參數

cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd



vim /usr/local/zabbix/etc/zabbix_server.conf

DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
 

#修改 /etc/init.d/zabbix_server /etc/init.d/zabbix_agentd的BASEDIR=/usr/local/為BASEDIR=/usr/local/zabbix
sed -i 's#BASEDIR=/usr/local/#BASEDIR=/usr/local/zabbix#g' /etc/init.d/zabbix_{server,agentd}
           

3.服務啟動

#啟動Apache服務
service httpd start

#啟用mysql服務
service mysqld start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

http://10.66.3.219/zabbix/
           

  

  

轉載于:https://www.cnblogs.com/kevinlucky/p/10043326.html