1、安装docker compose
(1)官方下载docker-compose
curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
(2)赋予执行权限
chmod +x /usr/local/bin/docker-compose
(3)查看版本
docker-compose --version

2、部署zabbix
(1)创建部署目录
mkdir /etc/zabbix
cd /etc/zabbix
(2)添加.env文件
vi .env

DEPLOY_PATH="/etc/zabbix/zabbix6.0"
MYSQL_ROOT_PASSWORD="AZZabbix.com"
MYSQL_USER=zabbix
MYSQL_PASSWORD="AZZabbix.com"
ZABBIX_NETWORK_SUBNET="10.10.10.0/24"
ZABBIX_WEB_PORT="3999"
ZABBIX_HISTORYCACHESIZE=2048M
(3)添加docker-compose.yaml文件

version: '3'
services:
  zabbix-server:
    image: zabbix/zabbix-server-mysql:latest
    environment:
      - ZBX_SERVER_HOST=localhost
    ports:
      - "10051:10051"
 
  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:latest
    environment:
      - ZBX_SERVER_HOST=zabbix-server
      - ZBX_MEMORY_LIMIT=256M
      - ZBX_PHP_TZ=Europe/Riga
      - ZBX_SERVER_NAME=Zabbix server
      - ZBX_DB_HOST=zabbix-db
    ports:
      - "80:80"
 
  zabbix-db:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix
      - MYSQL_ROOT_PASSWORD=zabbix
    volumes:
      - zabbix-db-storage:/var/lib/mysql
 
volumes:
  zabbix-db-storage:

保存文件后,通过以下命令启动服务:
docker-compose up -d


stray
129 声望10 粉丝

« 上一篇
运维知识汇总