作者:迷彩三角裤_625 | 来源:互联网 | 2023-09-17 15:16
安装和配置zabbix服务a,安装zabbix源1rpm-Uvhhttps:repo.zabbix.comzabbix5.0rhel7x86_64zabbix-release-5.
安装和配置zabbix服务
a,安装zabbix源
1 rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2 yum clean all
b,安装zabbix服务端和客户端
yum install -y zabbix-server-mysql zabbix-agent
c,安装zabbix前端
yum install -y centos-release-scl
编辑配置文件修改
vi /etc/yum.repos.d/zabbix.repo
设置enable=1其他配置保持不变
1 [zabbix-frontend]
2 name=Zabbix Official Repository frontend - $basearch
3 baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
4 enabled=1
5 gpgcheck=1
6 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
安装zabbix前端包
yum install -y zabbix-web-mysql-scl zabbix-nginx-conf-scl
安装mariadb
yum install -y mariadb-server
启动mariadb
1 systemctl start mariadb
2 systemctl enable mariadb
运行mariadb安全配置
mysql_secure_installation
d,创建数据库
1 [root@localhost ~]# mysql -uroot -p
2 Enter password:
3 Welcome to the MariaDB monitor. Commands end with ; or \g.
4 Your MariaDB connection id is 11
5 Server version: 5.5.68-MariaDB MariaDB Server
6
7 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
8
9 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
10
11 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
12 Query OK, 1 row affected (0.00 sec)
13
14 MariaDB [(none)]> create user zabbix@localhost identified by 'zabbix';
15 Query OK, 0 rows affected (0.00 sec)
16
17 MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
18 Query OK, 0 rows affected (0.01 sec)
退出MYSQL
导入MySQL表
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
e,为zabbix server配置数据库
vi /etc/zabbix/zabbix_server.conf
修改下面数据
DBPassword=zabbix
f,为zabbix前端配置PHP
vi /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
编辑文档
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
修改以下两项
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai
g,启动zabbix服务
1 systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
2 systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
h,使用浏览器页面访问进行配置
本次主机的IP为192.168.1.101
http://192.168.1.101/setup.php