1、安裝前的準備:php
防火牆關閉:service iptables stopmysql
chkconfigiptables offlinux
Selinux關閉:vi/etc/selinux/config enforing改爲disabled,而後re、bootweb
網絡設置:vi /etc/sysconfig/network-script on boot改爲yessql
而後service network restart數據庫
chkconfig network on瀏覽器
2、 zabbix-server服務器端的安裝服務器
安裝 zabbix官方源和epel源網絡
#rpm –ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpmsocket
#rpm –ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
3、安裝zabbix-server
#yum install –y zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-webzabbix-agent
安裝完成後能夠看到,yum方式安裝並無自動安裝mysql-server。
4、安裝MySQL數據庫服務
#yum –y install mysql-server
[root@zabbix ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommendedto prevent assorted security risks
symbolic-links=0
character-set-server=utf8 #設置字符集爲utf8
innodb_file_per_table=1 #讓innodb的每一個表文件單獨存儲
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#servicemysqld start
#chkconfig mysqld on
建立zabbix的數據庫
# mysqladmin-uroot password admin
# mysql -uroot-padmin
mysql> createdatabase zabbix character set utf8;
mysql> grantall privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> flushprivileges;
導入zabbix-server的數據庫
# mysql -uzabbix–pzabbix
mysql> usezabbix
mysql> source/usr/share/doc/zabbix-server-pgsql-2.4.6/create/schema.sql;
mysql> source/usr/share/doc/zabbix-server-pgsql-2.4.6/create/p_w_picpaths.sql
mysql> source/usr/share/doc/zabbix-server-pgsql-2.4.6/create/data.sql
mysql> showtables;
5、配置zabbix_server.conf
1. 配置zabbix_server.conf
vi/etc/zabbix/zabbix_server.conf
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
# If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
DBHost=localhost #可修改
### Option: DBName
# Database name.
# For SQLite3 path to database file must be provided. DBUser andDBPassword are ignored.
#
# Mandatory: yes
# Default:
# DBName=
DBName=zabbix #默認
### Option: DBSchema
# Schema name. Used for IBM DB2 and PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema=
### Option: DBUser
# Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zabbix #默認
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=zabbix #需修改
### Option: DBSocket
# Path to MySQL socket.
#
# Mandatory: no
# Default:
# DBSocket=/tmp/mysql.sock
DBSocket=/var/lib/mysql/mysql.sock
### Option: DBPort
# Database port when not using local socket. Ignored for SQLite.
以上參數只需關注黑體字部分,這部分爲性能參數,需根據實際狀況進行調整。默認只需修改DBPassword=zabbix便可。
# mkdir/etc/zabbix/alertscripts /etc/zabbix/externalscripts
啓動zabbix-server服務
# service zabbix-server start
#service httpd start
# chkconfig zabbix-server on
# chkconfig httpd on
配置時區參數
vi /etc/httpd/conf.d/zabbix.conf
<Directory"/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
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 Asia/Shanghai #把時區改爲中國上海
</Directory>
<Directory"/usr/share/zabbix/conf">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
#service httpd restart
至此,默認配置完成,打開瀏覽器,輸入http://ip地址/zabbix,會出現以下圖所示的畫面:
下一步:
下一步:
下一步:
下一步:
下一步:
下一步:
默認用戶名:Admin
默認密碼:zabbix