一、zabbix简介

1、简介

zabbix([`zæbiks])是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数如:CPU负荷、内存使用、磁盘使用、网络状况、端口监视、日志监视等。zabbix主要由2部分构成,zabbix server与可选组件zabbix agent。

zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

zabbix agent需要安装在被监视主机上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。zabbix agent可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X,Tru64/OSF1,Windows NT4.0,Windows (2000/2003/XP/Vista)等系统之上。

2、实验环境

系统:centos 7 

软件:Apache 2.4.6-93   mariadb 5.5.65  php 5.4.16  zabbix 4.0.21

3、安装前的准备工作

# 1、设置本机IP地址:192.168.10.100
[root@bogon ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=84e3956a-e882-4039-baa3-1a7dd1c733ea
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.10.100
NETMASE=255.255.255.0
GATEWAY=192.168.10.2
DNS1=192.168.10.2

# 2、设置主机名为:zabbix-server
[root@bogon ~]# vim /etc/hostname
zabbix-server

# 3、关闭selinux
[root@bogon ~]# vim /etc/selinux/config
...
SELINUX=disabled
...

# 4、重启电脑
[root@bogon ~]# reboot

二、使用yum安装LAMP

1、安装Apache

[root@zabbix-server ~]# yum install httpd -y

1.1 验证Apache

启动Apache服务

[root@zabbix-server ~]# systemctl start httpd

访问本机127.0.0.1,你会看到如下界面:

centos 7 安装zabbix 4.0

2、安装mariadb

[root@zabbix-server ~]# yum install mariadb-server mariadb -y 

2.1 验证mariadb

centos 7 安装zabbix 4.0

2.2 对mariadb进行初始化安全设置

 1 [root@zabbix-server ~]# systemctl start mariadb  # 启动mariadb
 2 [root@zabbix-server ~]# mysql_secure_installation   # 初始化mariadb数据库
 3 
 4 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 5       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 6 
 7 In order to log into MariaDB to secure it, we'll need the current
 8 password for the root user.  If you've just installed MariaDB, and
 9 you haven't set the root password yet, the password will be blank,
10 so you should just press enter here.
11 
12 Enter current password for root (enter for none):   # 默认root密码为空,这里回车即可
13 OK, successfully used password, moving on...
14 
15 Setting the root password ensures that nobody can log into the MariaDB
16 root user without the proper authorisation.
17 
18 Set root password? [Y/n] Y   # 是否设置root密码
19 New password:     # 设置root密码
20 Re-enter new password:   # 确认密码
21 Password updated successfully!
22 Reloading privilege tables..
23  ... Success!
24 
25 
26 By default, a MariaDB installation has an anonymous user, allowing anyone
27 to log into MariaDB without having to have a user account created for
28 them.  This is intended only for testing, and to make the installation
29 go a bit smoother.  You should remove them before moving into a
30 production environment.
31 
32 Remove anonymous users? [Y/n] Y   # 是否删除匿名用户,建议删除,否则可以通过匿名用户访问数据库
33  ... Success!
34 
35 Normally, root should only be allowed to connect from 'localhost'.  This
36 ensures that someone cannot guess at the root password from the network.
37 
38 Disallow root login remotely? [Y/n] n  # 是否拒绝root远程登录,这里是实验环境我们允许
39  ... skipping.
40 
41 By default, MariaDB comes with a database named 'test' that anyone can
42 access.  This is also intended only for testing, and should be removed
43 before moving into a production environment.
44 
45 Remove test database and access to it? [Y/n] Y  # 是否删除默认test数据库,这个随意
46  - Dropping test database...
47  ... Success!
48  - Removing privileges on test database...
49  ... Success!
50 
51 Reloading the privilege tables will ensure that all changes made so far
52 will take effect immediately.
53 
54 Reload privilege tables now? [Y/n] Y  # 是否使设置立即生效
55  ... Success!
56 
57 Cleaning up...
58 
59 All done!  If you've completed all of the above steps, your MariaDB
60 installation should now be secure.
61 
62 Thanks for using MariaDB!
mysql_secure_installation

相关文章:

  • 2022-01-25
  • 2021-07-11
  • 2021-10-06
  • 2021-08-30
  • 2021-05-09
  • 2022-12-23
  • 2021-04-20
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2021-08-18
  • 2022-01-26
  • 2021-09-23
  • 2022-12-23
  • 2021-08-23
相关资源
相似解决方案