1、安裝環境php
1.RHEL7.X系統mysql
2.關閉了火牆和SELINUXc++
3.配置YUM源web
4.zabbix官網下載zabbix源碼包或者RPM包(自選方式)sql
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並啓動apache
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
2、安裝Zabbix服務端vim
#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
3、修改配置bash
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 < p_w_picpaths.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
4、安裝和配置客戶端
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