本文共 5964 字,大约阅读时间需要 19 分钟。
软件版本:
Redhat6.9zabbix-3.4.7percona mysql-5.7.20准备工作:
关闭防火墙,或者添加相应端口。关闭selinux———— (安装如下zabbix依赖包)————
####这里的包是我网上找的,如有需要请回复。#####rpm -ivh *.rpmfping-3.5-3.el6.x86_64.rpmiksemel-1.4-2_2.el6.x86_64.rpmiksemel-devel-1.4-2_2.el6.x86_64.rpmlibevent-devel-1.4.13-4.el6.x86_64.rpmlibevent-doc-1.4.13-4.el6.noarch.rpmlibevent-headers-1.4.13-4.el6.noarch.rpmlibiconv-1.14-3.el6.x86_64.rpmlibiconv-devel-1.14-3.el6.x86_64.rpmlibiksemel3-1.4-2_2.el6.x86_64.rpmlibssh2-devel-1.4.2-2.el6_7.1.x86_64.rpmOpenIPMI-devel-2.0.16-14.el6.x86_64.rpmphp54w-5.4.45-2.w6.x86_64.rpmphp54w-bcmath-5.4.45-2.w6.x86_64.rpmphp54w-cli-5.4.45-2.w6.x86_64.rpmphp54w-common-5.4.45-2.w6.x86_64.rpmphp54w-gd-5.4.45-2.w6.x86_64.rpmphp54w-ldap-5.4.45-2.w6.x86_64.rpmphp54w-mbstring-5.4.45-2.w6.x86_64.rpmphp54w-mysql-5.4.45-2.w6.x86_64.rpmphp54w-pdo-5.4.45-2.w6.x86_64.rpmphp54w-xml-5.4.45-2.w6.x86_64.rpmunixODBC-devel-2.2.14-14.el6.x86_64.rpm————————————————rpm -qa | grep mysql
卸载系统自带mysql
rpm -e mysql mysql-server mysql-devel解压从Percona官网下载的rpm安装包:
tar zxvf Percona-Server-5.7.20-19-r119-el6-x86_64-bundle.tarcd Percona-Server-5.7.20-19-r119-el6-x86_64-bundle
安装以下四个包即可:
rpm -ivh Percona-Server-server-57-5.7.20-19.1.el6.x86_64.rpm Percona-Server-client-57-5.7.20-19.1.el6.x86_64.rpm Percona-Server-devel-57-5.7.20-19.1.el6.x86_64.rpm Percona-Server-shared-57-5.7.20-19.1.el6.x86_64.rpm创建zabbix用户:
useradd -u 1000 zabbixchgrp zabbix /usr/sbin/fping
chmod 4710 /usr/sbin/fping
解压从官网下载下来的zabbix-3.4.7源码安装包:
tar zxvf zabbix-3.4.7.tar.gz编译安装(编译参数可根据自己需求更改):
./configure --prefix=/usr/local --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libevent --with-libpcre --with-ldap --with-openssl --with-libcurl --with-iconv --sysconfdir=/etc/zabbixmake && make install
修改数据库引擎:
vim /etc/my.cnf————————————末尾添加————————————[mysqld]default-storage-engine=InnoDB————————————————————————————chkconfig mysql on
service mysql start
由于mysql5.7版本以后初始密码机制有所改变,第一次不能用匿名用户登陆,但是密码保存在mysql日志文件/var/log/mysqld.log中。如下字段中kk&q)j88uKwU
就是默认的root密码,可根据如下提供的关键字搜索。
kk&q)j88uKwU
输入日志中的默认密码,登陆mysql
mysql -u root -p修改root密码:(注意,mysql5.7版本以后密码需要满足复杂性要求;必须包含数字,大写字母,小写字母,特殊字符其中三项才可以)
————以下代码为sql语句,请登陆mysql后在mysql中执行————set password for root@localhost=password ('12345.Com');flush privileges;
创建zabbix数据库
create database zabbix character set utf8 collate utf8_bin;给zabbix数据库授权,密码为12345.Com:
grant all privileges on zabbix. to zabbix@localhost identified by '12345.Com';flush prvileges;
————————————————————导入zabbix数据至zabbix数据库:
cd /zabbix-3.4.7/database/mysql/mysql -uzabbix -p zabbix <schema.sql
mysql -uzabbix -p zabbix <images.sql
mysql -uzabbix -p zabbix <data.sql
修改zabbix_server 配置文件
vim /etc/zabbix/zabbix_server——————————修改—————————38行LogFile=/var/log/zabbix/zabbix_server.log68行
PidFile=/var/log/zabbix/zabbix_server.pid85行
DBHost=localhost ##mysql数据库IP,此环境mysql与zabbix-server在同一机器上95行
DBName=zabbix ##mysql数据库111行
DBUser=zabbix ##mysql用户119行
DBPassword=12345.Com ##mysql密码126行
DBSocket=/var/lib/mysql/mysql.sock ##这里需要注意。用 find / -name mysql.sock查看,然后再填入。322行
SNMPTrapperFile=/var/run/zabbix/zabbix_traps.tmp588行
Include=/usr/local/etc/zabbix_server.conf.d/*.conf——————————————————修改zabbix_agent 配置文件
————————修改——————————vim /etc/zabbix/zabbix_agentd.conf11行
PidFile=/var/log/zabbix/zabbix_agentd.pid30行
LogFile=/var/log/zabbix/zabbix_agentd.log265行
Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf——————————————————————创建zabbix 日志目录
mkdir -p /var/run/zabbixmkdir -p /var/log/zabbix
chown -R zabbix:zabbix /var/run/zabbix/ /var/log/zabbix/
复制zabbix启动脚本
cp zabbix-3.4.7/misc/init.d/fedora/core5/zabbix_server /etc/init.d/cp zabbix-3.4.7/misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
开机启动
chkconfig zabbix_server onchkconfig zabbix_agentd on
mkdir -p /usr/local/etc/zabbix_server.conf.d
mkdir -p /usr/local/etc/zabbix_agentd.conf.d
service zabbix_server restart
service zabbix_agentd restart
创建zabbix web页面
mkdir /var/www/html/zabbixcd zabbix-3.4.7/frontends/php
cp -a . /var/www/html/zabbix
chown -R zabbix:zabbix /var/www/html/zabbix/
vim /etc/httpd/conf/httpd.conf
————————————末尾追加一下内容—————————————Alias /zabbix /var/www/html/zabbix<Directory "/var/www/html/zabbix">Options FollowSymLinksAllowOverride NoneOrder allow,denyAllow from all<IfModule mod_php5.c>php_value max_execution_time 300php_value memory_limit 128Mphp_value post_max_size 16Mphp_value upload_max_filesize 2Mphp_value max_input_time 300php_value always_populate_raw_post_data -1php_value date.timezone Asia/Shanghai</IfModule></Directory><Directory "/var/www/html/zabbix/conf">Order deny,allowDeny from all<files .php>Order deny,allowDeny from all</files></Directory><Directory "/var/www/html/zabbix/app">Order deny,allowDeny from all<files .php>Order deny,allowDeny from all</files></Directory><Directory "/var/www/html/zabbix/include">Order deny,allowDeny from all<files *.php>Order deny,allowDeny from all</files></Directory>————————————————————————————————chkconfig httpd on
service httpd restart
此时即可用web访问http://10.1.1.1/zabbix 进行手动配置zabbix—web
或者也可按照以下方式手动创建:vim /var/www/html/zabbix/conf/zabbix.conf.php
———————————————————添加以下内容—————————————————————————<?php//Zabbix GUI configuration file.global $DB;$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';$DB['PORT'] = '0';$DB['DATABASE'] = 'zabbix';$DB['USER'] = 'zabbix';$DB['PASSWORD'] = '12345.Com';// 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;
————————————————————————————————————————chown zabbix.zabbix /var/www/html/zabbix/conf/zabbix.conf.php
此时zabbix_server端即配置完毕。
(此文章仅为个人安装配置笔记内容,如有不足之处还请各位前辈多多指教!)
转载于:https://blog.51cto.com/12256367/2090334