centos7搭建zabbix
时间: 2023-10-08 18:10:07 浏览: 94
好的,下面是 CentOS 7 搭建 Zabbix 的步骤:
1. 安装 EPEL 和 Zabbix 源
```
yum -y install epel-release
rpm -ivh https://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-release-5.2-1.el7.noarch.rpm
```
2. 安装 Zabbix Server、Agent 和 Web
```
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
```
3. 安装数据库
```
yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
```
4. 创建 Zabbix 数据库和用户
```
mysql -u root -p
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
MariaDB [(none)]> quit;
```
5. 导入初始数据
```
cd /usr/share/doc/zabbix-server-mysql-5.2.3/
zcat create.sql.gz | mysql -u zabbix -p zabbix
```
6. 修改 Zabbix Server 配置文件
```
vi /etc/zabbix/zabbix_server.conf
DBPassword=password
```
7. 修改 PHP 配置
```
vi /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
```
8. 启动服务并设置开机自启
```
systemctl start zabbix-server
systemctl enable zabbix-server
systemctl start zabbix-agent
systemctl enable zabbix-agent
systemctl start httpd
systemctl enable httpd
```
9. 访问 Web 界面
在浏览器中输入 http://服务器IP/zabbix,用户名和密码默认为 Admin/zabbix。
以上就是 CentOS 7 搭建 Zabbix 的步骤,希望对你有所帮助。