centos7安装zabbix6.0+nginx+mysql8+php7.4
时间: 2023-10-05 10:09:42 浏览: 90
以下是在 CentOS 7 上安装 Zabbix 6.0、Nginx、MySQL 8、PHP 7.4 的步骤:
1. 安装 EPEL 和 Remi 源:
```
yum install -y epel-release
rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
```
2. 安装 Nginx:
```
yum install -y nginx
systemctl start nginx
systemctl enable nginx
```
3. 安装 PHP 7.4:
```
yum install -y php74-php-fpm php74-php-mysqlnd php74-php-xmlrpc php74-php-gd php74-php-intl php74-php-mbstring php74-php-soap php74-php-xml php74-php-json php74-php-zip
systemctl start php74-php-fpm
systemctl enable php74-php-fpm
```
4. 安装 MySQL 8:
```
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld
systemctl enable mysqld
```
5. 配置 MySQL:
```
mysql_secure_installation
```
6. 创建 Zabbix 数据库:
```
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';
FLUSH PRIVILEGES;
EXIT;
```
7. 导入 Zabbix 数据库:
```
cd /usr/share/doc/zabbix-server-mysql-6.0.0/
zcat create.sql.gz | mysql -u zabbix -p zabbix
```
8. 安装 Zabbix Server 和 Agent:
```
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
```
9. 配置 Zabbix:
```
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
```
10. 启动 Zabbix Server 和 Agent:
```
systemctl start zabbix-server zabbix-agent
systemctl enable zabbix-server zabbix-agent
```
11. 配置 Nginx:
```
vi /etc/nginx/conf.d/zabbix.conf
server {
listen 80;
server_name localhost;
root /usr/share/zabbix;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php74-php-fpm/zabbix.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
12. 重启 Nginx:
```
systemctl restart nginx
```
13. 打开浏览器,输入服务器 IP 地址,进入 Zabbix Web 界面,按照提示进行 Zabbix 配置即可。
注意:以上步骤仅供参考,具体操作根据实际情况进行调整。