Linux安装 zabbix

zabbix监控安装

1、准备环境

IP地址查看

ifconfig eth0 | awk 'NR==2{print$2}'

关闭selinux

getenforce

2、zabbix-server内存尽量大点,4G更好

3、安装Zabbix存储库,清除yum源

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

yum clean all

 

4、安装Zabbix服务器和代理

yum install zabbix-server-mysql zabbix-agent

5、安装Zabbix前端,启用Red Hat软件集合

yum install centos-release-scl

6、编辑配置文件 /etc/yum.repos.d/zabbix.repo

vim /etc/yum.repos.d/zabbix.repo

[zabbix-frontend]

...

enabled=1

...

7、安装Zabbix前端包

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

8、创建初始数据库失败,首先yum下载mariadb-server数据库

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

-bash: mysql: command not found

[root@backup ~]# systemctl start mariadb.service

Failed to start mariadb.service: Unit not found.

yum -y install mariadb-server

启动数据库

[root@backup ~]# systemctl start mariadb.service

[root@backup ~]# systemctl status mariadb.service

数据库启动后再执行以下命令

mysql -uroot -p #直接回车

password

#创建数据库zabbix字符集utf8 collate utf8\u bin

mysql> create database zabbix character set utf8 collate utf8_bin;

#创建用户zabbix@localhost由“密码”标识;

mysql> create user zabbix@localhost identified by 'password';

#将zabbix.*上的所有特权授予zabbix@localhost;

mysql> grant all privileges on zabbix.* to zabbix@localhost;

#退出数据库

mysql> quit;

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

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 2

Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user zabbix@localhost identified by 'password';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit;

Bye

9、导入初始架构和数据,系统将提示您输入新创建的密码

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

 

10、为Zabbix server配置数据库,编辑配置文件 /etc/zabbix/zabbix_server.conf

vim /etc/zabbix/zabbix_server.conf

126 行添加 DBPassword=password

11、为Zabbix前端配置PHP,编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

; php_value[date.timezone] = Europe/Riga #去掉注释;

 

12、启动Zabbix server和agent进程,并为它们设置开机自启

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm

systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

 

13、在网页输入http://ip地址/zabbix进入网页端

14、登录账号密码默认

Admin

zabbix

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值