# 创建 zabbix 网络
docker network create -d bridge zbx-net

# 创建 zabbix 服务端
mkdir -p /data/docker/zabbix-server/{certs,modules,ssh_keys,mibs,export,keys,ssl_ca,enc,externalscripts,alertscripts}
docker run --name zabbix-server -t \
    --net zbx-net \
    -e DB_SERVER_HOST="<mysql数据库IP>" \
    -e MYSQL_DATABASE="zabbix" \
    -e MYSQL_USER="zabbix" \
    -e MYSQL_PASSWORD="<数据库密码>" \
    -e ZBX_STARTPINGERS="10" \
    -e ZBX_STARTVMWARECOLLECTORS="2" \
    -v /data/docker/zabbix-server/certs:/var/lib/zabbix/ssl/certs \
    -v /data/docker/zabbix-server/modules:/var/lib/zabbix/modules \
    -v /data/docker/zabbix-server/ssh_keys:/var/lib/zabbix/ssh_keys \
    -v /data/docker/zabbix-server/mibs:/var/lib/zabbix/mibs \
    -v /data/docker/zabbix-server/export:/var/lib/zabbix/export \
    -v /data/docker/zabbix-server/keys:/var/lib/zabbix/ssl/keys \
    -v /data/docker/zabbix-server/ssl_ca:/var/lib/zabbix/ssl/ssl_ca \
    -v /data/docker/zabbix-server/enc:/var/lib/zabbix/enc \
    -v /data/docker/zabbix-server/externalscripts:/usr/lib/zabbix/externalscripts \
    -v /data/docker/zabbix-server/alertscripts:/usr/lib/zabbix/alertscripts \
    -v /data/docker/zabbix-server/snmptraps:/var/lib/zabbix/snmptraps \
    -p 10051:10051 \
    --restart unless-stopped \
    -d zabbix/zabbix-server-mysql:alpine-latest	

# 创建 dhparam.pem
mkdir -p /data/docker/certs/
mkdir -p /data/docker/zabbix-web/certs
[ ! -f /data/docker/zabbix-web/certs/dhparam.pem ] && openssl dhparam -dsaparam -out /data/docker/zabbix-web/certs/dhparam.pem 2048

# 创建 zabbix web端
docker run --name zabbix-web \
    --net zbx-net \
    -e DB_SERVER_HOST="<mysql数据库IP>" \
    -e MYSQL_USER="zabbix" \
    -e MYSQL_PASSWORD="<数据库密码>" \
    -e ZBX_SERVER_HOST="zabbix-server" \
    -e PHP_TZ="PRC" \
    -v /data/docker/certs/ssl.crt:/etc/ssl/nginx/ssl.crt:ro \
    -v /data/docker/certs/ssl.key:/etc/ssl/nginx/ssl.key:ro \
    -v /data/docker/zabbix-web/certs/dhparam.pem:/etc/ssl/nginx/dhparam.pem:ro \
    -p 443:443 \
    --restart unless-stopped \
    -d zabbix/zabbix-web-nginx-mysql:alpine-latest

中文字体安装

# 方法一:Docker 内安装字体
Docker exec -it zabbix-web sh
mv /usr/share/zabbix/assets/fonts/DejaVuSans.ttf /usr/share/zabbix/assets/fonts/DejaVuSans.ttf.bak
wget https://raw.githubusercontent.com/googlefonts/noto-cjk/master/NotoSansSC-Regular.otf -O /usr/share/zabbix/assets/fonts/DejaVuSans.ttf

# 方法二:通过系统复制到 Docker 内
yum install google-noto-sans-simplified-chinese-fonts.noarch -y
docker cp /usr/share/fonts/google-noto/NotoSansSC-Regular.otf zabbix-web:/usr/share/zabbix/assets/fonts/DejaVuSans.ttf


原文链接地址:http://blog.exsvc.cn/article/zabbix-server-docker-install.html
转载请注明:转载自 易科博客 ,谢谢!

发表评论

电子邮件地址不会被公开。 必填项已用*标注