注:这次是采用的rpm包方式安装,因此服务器必需要能链接互联网经过yum方式解决依赖关系php
①系统:mysql
[root@zabbix ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
②软件:linux
zabbix-3.4.0web
关闭防火墙和SElinuxsql
[root@zabbix ~]# systemctl stop firewalld.service [root@zabbix ~]# systemctl disable firewalld.service [root@zabbix ~]# vim /etc/selinux/config SELINUX=enforcing改成SELINUX=disabled [root@zabbix ~]# reboot
[root@zabbix ~]# wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm [root@zabbix ~]# rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm 警告:zabbix-release-3.4-2.el7.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:zabbix-release-3.4-2.el7 ################################# [100%]
下载地址:http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/数据库
各类包的做用:vim
服务端浏览器
zabbix-server-mysql-3.4.0-1.el7.x86_64.rpm //zabbix链接mysql的程序包 zabbix-web-3.4.0-1.el7.noarch.rpm //web界面程序包 zabbix-web-mysql-3.4.0-1.el7.noarch.rpm //web程序链接mysql的程序包 zabbix-get-3.4.0-1.el7.x86_64.rpm //获取agent端信息的程序包
被监控端安全
zabbix-agent-3.4.0-1.el7.x86_64.rpm //zabbix的agent程序 zabbix-sender-3.4.0-1.el7.x86_64.rpm //agent端主动发送信息的程序
安装 [root@zabbix ~]# yum install mariadb-server -y [root@zabbix ~]# systemctl start mariadb [root@zabbix ~]# ss -tnl | grep 3306 LISTEN 0 50 *:3306 *:* #安全初始化数据库 [root@zabbix ~]# mysql_secure_installation Enter current password for root (enter for none): Set root password? [Y/n] y New password: Re-enter new password: Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] n Reload privilege tables now? [Y/n] y #编辑my.cnf加入如下两项参数 innodb_file_per_table=1 skip_name_resolve=1 [root@zabbix ~]# systemctl restart mariadb [root@zabbix ~]# systemctl enable mariadb
MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix123'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
2.6 测试数据库是否能登陆服务器
[root@zabbix ~]# mysql -u zabbix -p Enter password: MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | test | | zabbix | +--------------------+ 3 rows in set (0.00 sec)
由于服务端自身也要被监控(如若否则谁来监控锦衣卫?)因此也须要安装agent端的程序,后面的被监控点就只须要安装agnet便可,另外还提一点就是 web展现的服务不必定非要和zabbixserver端装在一块儿,也能够分离。
[root@zabbix ~]# cd zabbix3.4.0/ [root@zabbix zabbix3.4.0]# ll 总用量 5384 -rw-r--r-- 1 root root 361136 8月 22 2017 zabbix-agent-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 247312 8月 22 2017 zabbix-get-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 258700 8月 22 2017 zabbix-sender-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2046168 8月 22 2017 zabbix-server-mysql-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2577060 8月 22 2017 zabbix-web-3.4.0-1.el7.noarch.rpm -rw-r--r-- 1 root root 5972 8月 22 2017 zabbix-web-mysql-3.4.0-1.el7.noarch.rpm [root@zabbix zabbix3.4.0]# yum localinstall *.rpm -y //会自动解决依赖关系
编译安装的ZABBIX的sql文件会在web程序的文件夹中,可是咱们这里是rpm方式安装,因此sql文件并不是和tar包同样而且再也不是3个.sql文件,而是一个create.sql.gz的压缩文件
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.0/ [root@zabbix zabbix-server-mysql-3.4.0]# ll 总用量 2028 -rw-r--r-- 1 root root 98 8月 21 2017 AUTHORS -rw-r--r-- 1 root root 777403 8月 21 2017 ChangeLog -rw-r--r-- 1 root root 17990 8月 21 2017 COPYING -rw-r--r-- 1 root root 1263114 8月 21 2017 create.sql.gz [root@zabbix zabbix-server-mysql-3.4.0]# gunzip -c create.sql.gz > create.sql [root@zabbix zabbix-server-mysql-3.4.0]# mysql -uzabbix -pzabbix123 -Dzabbix < create.sql 导入完成后检查数据库,成功导入的话一共是140张表 | users_groups | | usrgrp | | valuemaps | | widget | | widget_field | +----------------------------+ 140 rows in set (0.00 sec) MariaDB [zabbix]>
[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf 改以下几项,有注释的就去掉注释 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix123
[root@zabbix ~]# vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1,192.168.116.137 //被动让server端采集数据的,服务器地址能够有多个,使用逗号隔开 ServerActive=127.0.0.1,192.168.116.137 //主动向zabbix-server发送数据,注意这是server端,因此127.0.0.1不能删除不然会报错 Hostname=Zabbix server //agent名称,若是是采用主动发送数据这个名称必须全局惟一
[root@zabbix ~]# systemctl enable zabbix-server.service [root@zabbix ~]# systemctl enable zabbix-agent.service [root@zabbix ~]# systemctl enable httpd.service
[root@zabbix ~]# systemctl start zabbix-server [root@zabbix ~]# systemctl start zabbix-agent [root@zabbix ~]# systemctl start httpd
[root@zabbix ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 *:3306 *:*LISTEN 0 128 *:10050 *:* LISTEN 0 128 *:10051 *:*LISTEN 0 128 :::80 :::*LISTEN 0 128 :::10050 :::* LISTEN 0 128 :::10051 :::*
[root@zabbix ~]# vim /etc/php.ini ;date.timezone = 改成 date.timezone = Asia/Shanghai
浏览器访问 http://192.168.116.137/zabbix
下一步后会进行条件检查,符合后才能下一步
这个地方的参数和上面改zabbix-server配置文件的参数同样
用户名 Admin (必定要大写A)
密码 zabbix
改成中文显示
至此zabbix的安装已经完成,下一篇文件将介绍zabbix的使用