Dokcer部署zabbix6.0
zabbix官网下载地址:https://www.zabbix.com/cn/download
zabbix官方文档:https://www.zabbix.com/documentation/6.0/zh/manual
服务器参数
CPU:2U
内存:8GB
Docker版本:Docker version 26.0.0, build 2ae903e
操作系统版本:openEuler-22.03-LTS-SP3
创建zabbix网络
[root@localhost ~]# docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zabbix-net
拉取zabbix镜像
[root@localhost ~]# docker pull mariadb
[root@localhost ~]# docker pull zabbix/zabbix-java-gateway:alpine-6.2-latest
[root@localhost ~]# docker pull zabbix/zabbix-server-mysql:alpine-6.2-latest
[root@localhost ~]# docker pull zabbix/zabbix-web-nginx-mysql:alpine-6.2-latest
启动zabbix容器
按顺序启动,不然会报错.
# 创建数据库
#!如果用的是低版本的zabbix请用mariadb数据库
[root@localhost ~]# docker run --name mysql-server -t \
-p 3306:3306 \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
--network=zabbix-net \
--restart unless-stopped \
-d mariadb --default-authentication-plugin=mysql_native_password \
--character-set-server=utf8 --collation-server=utf8_bin
# 创建zabbix网关
[root@localhost ~]# docker run --name zabbix-java-gateway -t \
--network=zabbix-net \
--restart unless-stopped \
-d zabbix/zabbix-java-gateway:alpine-6.2-latest
# 创建zabbix应用端
[root@localhost ~]# docker run --name zabbix-server-mysql -t \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
--network=zabbix-net \
-p 10051:10051 \
--restart unless-stopped \
-d zabbix/zabbix-server-mysql:alpine-6.2-latest
# 创建nginx代理
[root@localhost ~]# docker run --name zabbix-web-nginx-mysql -t \
-e ZBX_SERVER_HOST="zabbix-server-mysql" \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
--network=zabbix-net \
-p 80:8080 \
--restart unless-stopped \
-d zabbix/zabbix-web-nginx-mysql:alpine-6.2-latest
验证容器运行
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb54c7846520 zabbix/zabbix-web-nginx-mysql:alpine-6.2-latest "docker-entrypoint.sh" 2 minutes ago Up 2 minutes 8443/tcp, 0.0.0.0:80->8080/tcp, :::80->8080/tcp zabbix-web-nginx-mysql
eccfb74b00b2 zabbix/zabbix-server-mysql:alpine-6.2-latest "/sbin/tini -- /usr/…" 3 minutes ago Restarting (1) 48 seconds ago zabbix-server-mysql
278d2b5450d5 zabbix/zabbix-java-gateway:alpine-6.2-latest "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 10052/tcp zabbix-java-gateway
cd0a1d118b92 mariadb "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp mysql-server
输入浏览器进行登录:http://127.0.0.1/ 默认账号:`Admin` 默认密码:`zabbix`
官方是支持中文的,设置中文页面: