1、準備軟件環境php
安裝相關組件:html
首先關閉iptables和安裝lnmp環境:
java
配置前先關閉iptables和SELINUX,避免安裝過程當中報錯。 [root@zabbix ~]# service iptables stop [root@zabbix ~]# chkconfig iptables off [root@zabbix ~]# yum -y install gcc gcc-c++ autoconf [root@zabbix ~]# yum -y install mysql-server php-mysql mod_ssl mod-perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath [root@zabbix ~]# yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql [root@zabbix ~]# yum -y install net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel [root@zabbix ~]# yum -y install libxml2 libxml2-devel openldap* libssh2*
2、建立zabbix用戶python
[root@zabbix ~]# groupadd zabbix [root@zabbix ~]# useradd zabbix -g zabbix -s /sbin/nologin
3、下載zabbix軟件並安裝mysql
wget如下內容
nginx
http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.8/zabbix-2.2.8.tar.gz
c++
[root@zabbix zabbix-2.2.8]# ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
4、報錯解決方案sql
報錯1: checking for main in -lmysqlclient... no configure: error: Not found mysqlclient library 解決:[root@zabbix zabbix-2.0.6]# ln -s /usr/lib64/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so 報錯2: checking libxml2 install dir... no checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. 解決:檢查是否安裝了libxm包 [root@XKWB3403 php-5.3.8]# rpm -qa |grep libxml2 libxml2-2.6.26-2.1.12 libxml2-python-2.6.26-2.1.12 從新安裝libxml2和libxml2-devel包 yum install libxml2 yum install libxml2-devel -y 報錯3: checking for LDAP support... no configure: error: Invalid LDAP directory - unable to find ldap.h 解決:yum -y install openldap*
5、數據庫操做:數據庫
mysql> create database zabbix character set utf8; mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix'; mysql> flush privileges; mysql> use zabbix; mysql> source /tmp/zabbix-2.4.3/database/mysql/schema.sql mysql> source /tmp/zabbix-2.4.3/database/mysql/data.sql; mysql> source /tmp/zabbix-2.4.3/database/mysql/p_w_picpaths.sql;
6、建立日誌文件瀏覽器
[root@zabbix zabbix-2.4.3]# mkdir /var/log/zabbix [root@zabbix zabbix-2.4.3]# chown zabbix.zabbix /var/log/zabbix/
7、建立自啓動腳本
[root@zabbix zabbix-2.4.3]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ [root@zabbix zabbix-2.4.3]# chmod 755 /etc/init.d/zabbix_* [root@zabbix zabbix-2.4.3]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_server [root@zabbix zabbix-2.4.3]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
8、配置zabbix_server.conf服務端的文件
[root@zabbix zabbix-2.4.3]# vi /etc/zabbix/zabbix_server.conf DBName=zabbix //數據庫名稱 DBUser=zabbix //數據庫用戶 DBPassword=zabbix //數據庫密碼 StartPollers=5 CacheSize=256M [root@zabbix zabbix-2.4.3]# mkdir /etc/zabbix/alertscripts /etc/zabbix/externalscripts
9、複製zabbix網頁,並開啓zabbix服務
root@zabbix zabbix-2.4.3]# cp -r frontends/php/ /usr/share/nginx/html/zabbix [root@zabbix zabbix-2.4.3]# service zabbix_server start Starting zabbix_server: [ OK ] [root@zabbix zabbix-2.4.3]# chkconfig zabbix_server on
10、配置zabbix.conf.php.example
[root@zabbix html]# cd zabbix/conf [root@zabbix conf]# ls maintenance.inc.php zabbix.conf.php.example [root@zabbix conf]# vi zabbix.conf.php.example <?php // Zabbix GUI configuration file. global $DB; $DB["TYPE"] = 'MYSQL'; $DB["SERVER"] = 'localhost'; $DB["PORT"] = '0'; $DB["DATABASE"] = 'zabbix'; $DB["USER"] = 'zabbix'; $DB["PASSWORD"] = 'zabbix'; // Schema name. Used for IBM DB2 and PostgreSQL. $DB["SCHEMA"] = ''; $ZBX_SERVER = 'localhost'; $ZBX_SERVER_PORT = '10051'; $ZBX_SERVER_NAME = ''; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?> "zabbix.conf.php.example" 19L, 420C written [root@zabbix conf]#
11、支持中文服務
zabbix默認不支持中文,必須修改配置文件以後才能在語言修改頁面顯示支持中文 root@zabbix include]# vi locales.inc.php 'zh_CN' => array('name' => _('Chinese (zh_CN)'), 'display' => true), 將false改成true,支持中文
12、檢測安裝環境
打開瀏覽器訪問http://server_ip/zabbix/