系统:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.2.2.el7.x86_64
//关闭SELinux,机器需要重启
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
//验证
# grep SELINUX=disabled /etc/selinux/config
SELINUX=disabled
//关闭SELinux,不需要重启
# setenforce 0
setenforce: SELinux is disabled
//关闭防火墙
# systemctl stop firewalld.service
//开机不启动防火墙
# systemctl enable firewalld.service
//开始安装,首先安装mariadb
# yum -y install mariadb-server mariadb
Installed:
mariadb.x86_64 1:5.5.56-2.el7 mariadb-server.x86_64 1:5.5.56-2.el7
Dependency Installed:
libaio.x86_64 0:0.3.109-13.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-5.el7
perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
Complete!
//mariadb的相关命令
//systemctl start mariadb #启动MariaDB
//systemctl stop mariadb #停止MariaDB
//systemctl restart mariadb #重启MariaDB
//systemctl enable mariadb #设置开机启动
# systemctl start mariadb
# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
//rpm方式直接安装zabbix
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-3.4-1.el7.centos ################################# [100%]
# yum -y install zabbix-server-mysql zabbix-web-mysql
Installed:
zabbix-server-mysql.x86_64 0:3.4.7-1.el7 zabbix-web-mysql.noarch 0:3.4.7-1.el7
Dependency Installed:
OpenIPMI-libs.x86_64 0:2.0.19-15.el7 OpenIPMI-modalias.x86_64 0:2.0.19-15.el7
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7
dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7
fontpackages-filesystem.noarch 0:1.44-8.el7 fping.x86_64 0:3.10-4.el7
gnutls.x86_64 0:3.3.26-9.el7 httpd.x86_64 0:2.4.6-67.el7.centos.6
httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 iksemel.x86_64 0:1.4-6.el7
libX11.x86_64 0:1.6.5-1.el7 libX11-common.noarch 0:1.6.5-1.el7
libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.12-1.el7
libevent.x86_64 0:2.0.21-4.el7 libjpeg-turbo.x86_64 0:1.2.90-5.el7
libpng.x86_64 2:1.5.13-7.el7_2 libtool-ltdl.x86_64 0:2.4.2-22.el7_3
libxcb.x86_64 0:1.12-1.el7 libxslt.x86_64 0:1.1.28-5.el7
libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7
net-snmp-libs.x86_64 1:5.7.2-28.el7_4.1 nettle.x86_64 0:2.7.1-8.el7
php.x86_64 0:5.4.16-43.el7_4.1 php-bcmath.x86_64 0:5.4.16-43.el7_4.1
php-cli.x86_64 0:5.4.16-43.el7_4.1 php-common.x86_64 0:5.4.16-43.el7_4.1
php-gd.x86_64 0:5.4.16-43.el7_4.1 php-ldap.x86_64 0:5.4.16-43.el7_4.1
php-mbstring.x86_64 0:5.4.16-43.el7_4.1 php-mysql.x86_64 0:5.4.16-43.el7_4.1
php-pdo.x86_64 0:5.4.16-43.el7_4.1 php-xml.x86_64 0:5.4.16-43.el7_4.1
t1lib.x86_64 0:5.1.2-14.el7 trousers.x86_64 0:0.3.14-2.el7
unixODBC.x86_64 0:2.3.1-11.el7 zabbix-web.noarch 0:3.4.7-1.el7
Complete!
//zabbix-server相关命令
//systemctl start zabbix-server #启动zabbix
//systemctl stop zabbix-server #停止zabbix
//systemctl restart zabbix-server #重启zabbix
//systemctl enable zabbix-server #配置开机启动
//创建数据库
# mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> exit
//导入数据库
# zcat /usr/share/doc/zabbix-server-mysql-3.4.7/create.sql.gz | mysql -uzabbix -pzabbix zabbix
//配置数据库用户和密码
# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
101:DBName=zabbix
117:DBUser=zabbix
125:DBPassword=zabbix //重点修改这一行
330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
448:Timeout=4
490:AlertScriptsPath=/usr/lib/zabbix/alertscripts
500:ExternalScripts=/usr/lib/zabbix/externalscripts
536:LogSlowQueries=3000
//启动zabbix-server
# systemctl start zabbix-server
//更改PHP前端zabbix配置,修改时区,第19行时区修改为 Asia/ShangHai
# vim /etc/httpd/conf.d/zabbix.conf
19 php_value date.timezone Asia/ShangHai
//SELinux配置,不知道为什么这样设置,前面SELinux已经关闭了,知道的大神留言说下
# setsebool -P httpd_can_connect_zabbix on
setsebool: SELinux is disabled.
# setsebool -P httpd_can_cetwork_connect_db on
setsebool: SELinux is disabled.
//启动httpd
# systemctl start httpd
//httpd相关命令
//systemctl start httpd #启动
//systemctl stop httpd #停止
//systemctl restart httpd #重启
//systemctl enable httpd #开机自启
//安装zabbix web,浏览器访问,并进行安装
//http://localhost/zabbix/
//步骤如下(不上图,自行领悟^_^):
//点击next step
//点击next step
//输入数据库的密码,点击next step
//点击 next step
//确认信息无误,点击 next step
//点击 Finish
//完成安装,会在/etc/zabbix/web/zabbix.conf.php生成配置文件
# cat /etc/zabbix/web/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'] = 'zabbix';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix 监控平台';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
//登录
//浏览器输入: IP/zabbix
//zabbix-server 默认用户Admin 默认密码zabbix
//安装zabbix-server结束
//zabbxi-agent安装及配置
# yum -y install zabbix-agent
//配置zabbxi-agent
# vim /etc/zabbix/zabbix_agentd.conf
//第97行 填写 zabbix-server IP地址
97 Server=127.0.0.1
//第139行 填写 ServerActive IP地址
139 ServerActive=127.0.0.1
//zabbix-aget相关命令
//systemctl start zabbix-agent.service #启动
//systemctl restart zabbix-agent.service #重启
//systemctl stop zabbix-agent.service #停止
//systemctl enable zabbix-agent.service #开机自启
# systemctl start zabbix-agent.service
//至此,zabbix-servier、zabbix-agent安装完毕
自己的实操安装演练^_^