zabbix安裝

環境

192.168.0.219  zabbix server

192.168.0.230  zabbix agentd

軟件

zabbix-2.4.5.tar.gz

Apache+MySQL+PHP

系統

Centos 7

Server端配置

一、關閉防火牆

setenforce 0 

   systemctl stop firewall

   systemctl disable firewall

二、安裝epel擴展源

  Rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

三、安裝LAMP環境

yum install?php php-gd php-mysql php-bcmath php-mbstring php-xml?curl curl-devel net-snmp ? net-snmp-devel perl-DBI

yum y install mariadb*

四、配置數據庫

  systemctl start mariadb.service    啓動數據庫

  mysql u root      進入數據庫,密碼爲空

  MariaDB [(none)]>  create database zabbix character set utf8;  #創建數據庫zabbix,數據庫編碼使用utf8

  MariaDB [(none)]>  grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #允許賬戶能從本機連接至數據庫zabbix

  ?MariaDB [(none)]> flush privileges;

五、ZABBIX的安裝

 (1)wget http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz   下載源碼包

 tar zxf zabbix-2.4.5.tar.gz

 cd zabbix-2.4.5

 mkdir /usr/local/zabbix  創建zabbix的安裝目錄

 ./configure --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix

 --prefix----> 指定zabbix安裝目錄

 --enable-server----> 支持zabbix服務器

 --enable-agent----> 支持zabbix代理

 --enable-proxy----> 支持zabbix代理服務器

 --with-libcurl----> 使用curl

 --with-net-snmp----> 使用net-snmp軟件包,選擇性地指定路徑NET-SNMP配置

 --with-mysql=/usr/bin/mysql_config 使用MySQL客戶端庫可以選擇指定路徑mysql_config注:configure: error: no acceptable C compiler found in $PATH  錯誤

   原因沒有安裝gcc

   yum -y install gcc 

make install

(2)導入數據庫

  mysql -u root

  MariaDB [(none)]> use zabbix;

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/schema.sql

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/data.sql

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/images.sql

  MariaDB [zabbix]> exit

3)拷貝相關的配置文件到/etc/

      [root@localhost ~]# mkdir -p /etc/zabbix

   [root@localhost ~]# cp -r zabbix-2.4.5/conf/* /etc/zabbix/

   [root@localhost ~]# chown -R zabbix:zabbix /etc/zabbix

   [root@localhost ~]#ln -s /usr/local/zabbix/etc /etc/zabbix/

   [root@localhost ~]# ln -s /usr/local/zabbix/bin/* /usr/bin/

   [root@localhost ~]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/

4) 配置zabbix_server.conf文件

      

[root@slave4 etc]# egrep -v '^$|^#' zabbix_server.conf

LogFile=/tmp/zabbix_server.log

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix


5)配置zabbix_agentd文件  

六、php配置

    vi /etc/php.ini

   max_execution_time = 300

    max_input_time = 300

   memory_limit = 128M

   upload_max_filesize = 2M

   date.timezone = Asia/Shanghai

   post_max_size = 28M

七、配置web站點

    cd zabbix-2.4.5/

  cp -r frontends/php /var/www/html/zabbix

    修改httpd.conf的參數

 vi /etc/httpd/conf/httpd.conf

   <IfModule dir_module>

         DirectoryIndex index.html index.php

  </IfModule>

     啓動httpd服務

     Systemctl start httpd

八、初始化安裝

     在瀏覽器中輸入http://192.168.0.219/zabbix 訪問web端,      

     根據提示進行

九、添加開機腳本

cd zabbix-2.4.5/

 cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/zabbix_server

  cp misc/init.d/fedora/core5/zabbix_agent /etc/init.d/zabbix_agentd

  chmod +x /etc/init.d/zabbix_server 

  sed i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd

 chmod +x /etc/init.d/zabbix_agentd

  chkconfig zabbix_server on?

  chkconfig zabbix_agentd on

 /usr/local/zabbix/sbin/zabbix_server start


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章