第三章 监控系统-zabbix-4.2官方源安装

一、配置zabbix官方仓库

CentOS/RHEL 8:
# rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/8/x86_64/zabbix-release-4.2-1.el8.noarch.rpm

CentOS/RHEL 7:
# rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm

CentOS/RHEL 6:
# rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/6/x86_64/zabbix-release-4.2-1.el6.noarch.rpm
[root@redis01 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
[root@redis01 ~]# yum clean all

二、安装zabbix

[root@redis01 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

三、安装数据库Mariadb

# yum install -y  mariadb-server.x86_64 mariadb-devel.x86_64 mariadb-libs.x86_64 
# chmod -R 777 /var/lib/mysql
# systemctl enable mariadb
# systemctl start mariadb
# mysql_secure_installation
Enter current password for root (enter for none):<–初次运行直接回车
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
剩下的一律 y 一直到配置完成。

四、配置zabbix数据库

[root@redis01 ~]# mysql -uroot -p

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on zabbix.* to 'zabbix'@localhost identified by 'zabbix';
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit;

五、导入zabbix数据库

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

六、配置Zabbix

# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

# vim   /etc/httpd/conf.d/zabbix.conf   修改时区为上海
php_value date.timezone Asia/Shanghai

七、安装apache

# yum install -y httpd*   粗略安装,详细安装请自行搜寻

八、启动apache和zabbix

# systemctl start httpd
# systemctl enable httpd
# systemctl start zabbix-server
# systemctl enable zabbix-server
# systemctl start zabbix-agent.service 
# systemctl enable zabbix-agent.service 

九、访问测试

#1.输入http://ip/zabbix

#2.web安装
1、下一步
2、等待自我检测,全部OK即可下一步,有问题需要进行排查。
3、填入数据库密码
4、zabbix命名
5、确认信息无误
6、完成

#3.登录zabbix了
默认用户名密码:
Admin
zabbix
 
ps:以上是基于图形化安装界面提供的步骤说明,如果没有安到图形化这么高级,可能会缺少一些依赖包,下面补充:
# yum install gcc mysql-devel php-mbstring php-bcmath php-mysql OpenIPMI OpenIPMI-devel libcurl libcurl-devel libxml2 libxml2-devel net-snmp net-snmp-devel fping  -y
posted @ 2021-12-21 14:31  年少纵马且长歌  阅读(98)  评论(0编辑  收藏  举报