以下是一个简单的 shell 脚本,用于在 CentOS 8.5上安装 Zabbix 6.0
时间: 2024-01-24 12:19:59 浏览: 33
好的,以下是一个简单的 shell 脚本,用于在 CentOS 8.5 上安装 Zabbix 6.0:
```shell
#!/bin/bash
# Install Zabbix 6.0 on CentOS 8.5
# Update system packages
dnf update -y
# Install required packages
dnf install -y epel-release
dnf install -y https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent mysql-server
# Start and enable MySQL
systemctl start mysqld
systemctl enable mysqld
# Configure MySQL for Zabbix
mysql_secure_installation
mysql -u root -p
create database zabbix character set utf8 collate utf8_bin;
create user 'zabbix'@'localhost' identified by 'password';
grant all privileges on zabbix.* to 'zabbix'@'localhost';
exit;
# Import Zabbix database schema
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
# Configure Zabbix server
nano /etc/zabbix/zabbix_server.conf
DBPassword=password
# Start and enable Zabbix server and agent
systemctl start zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
# Configure firewall
firewall-cmd --add-service={http,https} --permanent
firewall-cmd --add-port={10050/tcp,10051/tcp} --permanent
firewall-cmd --reload
```
请注意,此脚本是基于 CentOS 8.5 和 Zabbix 6.0 编写的。如果您使用不同的操作系统版本或 Zabbix 版本,请相应地调整脚本。此外,脚本中的密码应该使用您自己的密码替换。