RHEL7下安裝Zabbix

一、安裝環境

1.RHEL7.X系統

2.關閉了火牆和SELINUX

3.配置YUM源

4.zabbix官網下載zabbix源碼包或者RPM包(自選方式)

5.系統安裝必要的運行工具

yum install gcc gcc-c++ make openssl-devel curl wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel gnutls gnutls-devel libxml2 libxml2-devel

6.安裝HTTP和PHP以及mariadb並啓動

yum install httpd -y
#啓動apache
systemctl start httpd
systemctl enable httpd

yum install -y mariadb-server mariadbsystemctl start mariadb
systemctl enable mariadb
systemctl start mariadb
#最簡單方法,如果想了解php構建過程,推薦手工打包安裝
yum install -y php php-mysql php-gd php-pear


二、安裝Zabbix服務端

#Configure the ZabbixZone package repository

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum clean all
yum list zabbix\*
yum install -y zabbix.x86_64 zabbix-agent.x86_64 zabbix-server.x86_64 zabbix-server-mysql.x86_64 zabbix-web.noarch zabbix-web-mysql.noarch mariadb-server


三、修改配置

  1. PHP

vim /etc/php.ini
date.timezone = "Asia/Shanghai"        ###也可安下面修改zabbix.conf裏面的方式修改

vim /etc/my.cnf
character-set-server=utf8

重新啓動一下mariadb

2.修改zabbix配置文件

#vim /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#systemctl start zabbix-server
#systemctl enable zabbix-server

#vim /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai

#systemctl enable httpd
#systemctl start httpd

3.創建zabbix數據庫

cd /usr/share/doc/zabbix-server-mysql-2.4.5/create
#mysql        可設置一下mysql的root密碼(set password=password('xxxpwd');)
mysql> create database zabbix;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;
mysql -uzabbix -pzabbix zabbix < data.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < schema.sql

4.apache設置(針對於RHEL7&CentOS7)

vim /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    #Order allow,deny
    #Allow from all
    Require all granted                ###此行是在7系列裏使用,其上兩行爲7之前版本使用
    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    # php_value date.timezone Europe/Riga
</Directory>

5.啓動

systemctl start zabbix-server
systemctl start zabbix-agent
systemctl restart httpd
systemctl restart mariadb

注:均要設置開機自動啓動

6.瀏覽器打開設置zabbix


四、安裝和配置客戶端

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.8.136        ##主動方式
...
ServerActive=192.168.8.136   ##被動方式

Hostname=zab01        ##添加主機時,使用此名稱


systemctl enable zabbix-agent
systemctl start zabbix-agent


附:

語言爲中文時,翻譯及亂碼問題

cd /usr/share/zabbix/fonts/   #可將想用的字體放到此目錄下,注意字體文件的後綴一定要爲小寫字母

vim /usr/share/zabbix/include/defines.inc.php
#define('ZBX_GRAPH_FONT_NAME',          'graphfont'); // font file name
define('ZBX_GRAPH_FONT_NAME',           'SIMKAI'); // font file name
#define('ZBX_FONT_NAME', 'graphfont');
define('ZBX_FONT_NAME', 'SIMKAI');

下載一個解決亂碼的文件(frontend.po)

cp frontend.po /usr/share/zabbix/locale/zh_CN/LC_MESSAGES/
/usr/share/zabbix/locale/make_mo.sh


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