centos7安裝配置zabbix3.2.11

切換至root帳戶php

sudo bashmysql

 

關閉防火牆並關閉開機啓動linux

systemctl stop firewalld.servicenginx

systemctl disable firewalld.serviceweb

 

關閉SELinux安全機制sql


(1). 臨時關閉數據庫

    setenforce 0vim

(2). 永久關閉瀏覽器

    vim /etc/selinux/config安全

設置SELINUX=enforcing爲SELINUX=disabled


搭建zabbix所須要的lamp環境


切換源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

    cd /etc/yum.repos.d/

    wget http://mirrors.aliyun.com/repo/Centos-7.repo

    yum clean all

    yum makecache

 

配置mysql環境(CentOS7已使用mariadb替換mysql)

  (1). 檢查

    yum search mysql|tac

  (2). 安裝LAMP環境

    yum -y install mariadb mariadb-server php php-mysql httpd

  (3). 配置數據庫開機啓動

    systemctl enable mariadb
    systemctl start mariadb

  (4). 初始化mysql數據庫,並配置root用戶密碼

    mysql_secure_installation

    注意:首先確認當前密碼(默認爲空密碼)

  (5). 建立zabbix數據庫及訪問用戶

    mysql -uroot -proot -e "create database zabbix default character set utf8 collate utf8_bin;"

    mysql -uroot -proot -e "grant all on zabbix.* to 'zabbix'@'%' identified by 'zabbix';"

  (6). 測試剛建立的數據庫及用戶

    mysql -uzabbix -pzabbix

    show databases;

    exit;

 

設置Apache開機啓動(默認開放80端口)

  systemctl enable httpd

  systemctl start httpd

  注意:若有nginx等佔用80端口,httpd啓動會失敗,能夠經過如下方式更換監聽端口:

    vi /etc/httpd/conf/httpd.conf

    設置Listen 80爲其餘端口

 

安裝Zabbix Server端

  (1). 導入yum源

    rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

  (2). 安裝Zabbix(下載文件過程可能因爲網絡差別致使失敗,建議採用代理:Linux代理方式)

    yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

  (3). 導入zabbix數據結構

    cd /usr/share/doc/zabbix-server-mysql-3.2.4

    注意:最後一級目錄可能不是zabbix-server-mysql-3.2.4,請確認安裝的zabbix-server-mysql的版本:zabbix-server-mysql-{version}

    zcat create.sql.gz | mysql -uroot -proot zabbix

  (4). 修改Zabbix Server配置文件

    vi /etc/zabbix/zabbix_server.conf

    新增以下內容:

      DBHost=localhost

      DBName=zabbix

      DBUser=zabbix

      DBPassword=zabbix

  (5). 修改Zabbix的php配置文件

    vi /etc/httpd/conf.d/zabbix.conf

    取消內容爲:php_value date.timezone的註釋,並調整值爲:Asia/Shanghai

  (6). 啓動Zabbix Server,並配置開機啓動

    systemctl enable zabbix-server

    systemctl start zabbix-server

  (7). 重啓Apache

    systemctl restart httpd

  (8). 瀏覽器訪問zabbix,並相關配置

    地址:http://127.0.0.1/zabbix,也可以使用服務器ip

 


安裝zabbix-agent


(1). 導入yum源

  rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm


(2). 安裝zabbix-agent

  yum -y install zabbix-agent


(3). 配置zabbix-agent

  vi /etc/zabbix/zabbix_agentd.conf

  * 修改Server的IP,地址爲服務端地址:Server=ServerIP

  * 修改ServerAcive的IP,地址爲服務端地址:ServerActive=ServerIP

  * Hostname修改成網頁裏面添加的Hostname,須要保持一致:Hostname=Zabbix server

  * 設置爲0 僅爲主動模式,若是須要發送數據等 能夠不修改此項:StartAgents=0

(4). 啓動zabbix-agent,並配置開機啓動

   systemctl enable zabbix-agent

   systemctl start zabbix-agent

相關文章
相關標籤/搜索