Centos7 and 8 uses docker-compose to install zabbix

0
472

Build and run a zabbix system through docker’s basic operation command, which involves zabbix-server, zabbix-web-Nginx-mysq, and mysql container. Operation up relatively tedious, and every time to run to come again is very inconvenient. Here’s how to deploy zabbix with a docker-compose

Install Docker and Docker-compose

The first thing to do is to install Docker and Docker compose in our system. For centos7, use the following command.

For the rest of the releases, it’s best to read the official Docker documentation.

[root@localhost ~]# yum install docker python-pip docker-compose -y

Check that the installation is successful

 [root@localhost ~]# docker-compose -v && docker -v
Check docker and docker-compose
Check docker and docker-compose

Deploy zabbix using Docker-compose

  • First, create a folder and then create docker-compose.yml files in it
[root@localhost ~]# mkdir zabbix
[root@localhost ~]# cd zabbix/
[root@localhost zabbix]# touch docker-compose.yml
  • Edit docker-compose.yml file
[root@localhost zabbix]# vim docker-compose.yml 
 version: '3'
 services:
   zabbix-mysql:
     image: mysql:5.6
     container_name: zabbix-mysql
     ports:
       - '3306:3306'
     environment:
       MYSQL_ROOT_PASSWORD: zabbix
     volumes:
       - /root/zabbix/mysql-data:/var/lib/mysql
 zabbix-server:
     image: zabbix/zabbix-server-mysql:ubuntu-3.0.4
     container_name: zabbix-server
     environment:
       DB_SERVER_HOST: "zabbix-mysql"
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
     ports:
       - '10051:10051'
     links:
       - zabbix-mysql
     depends_on:
       - zabbix-mysql
 zabbix-web:
     image: zabbix/zabbix-web-nginx-mysql:ubuntu-3.0.4
     container_name: zabbix-web
     environment:
       DB_SERVER_HOST: zabbix-mysql
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
       ZBX_SERVER_HOST: "zabbix-server"
       PHP_TZ: Asia/Shanghai
     ports:
       - '80:80'
       - '443:443'
     links:
       - zabbix-mysql
       - zabbix-server
     depends_on:
       - zabbix-mysql
       - zabbix-server

Important environment variable Settings

  • Zabbix-web-nginx-mysql and zabbix-web-nginx-mysql image versions remain consistent (ubuntu-3.0.4 or other)
  • MYSQL_ROOT_PASSWORD: mysql root password
  • MYSQL_USER: Connect the mysql user
  • MYSQL_PASSWORD: Connect the mysql password

Running and testing zabbix

[root@localhost ~]# docker-compose up -d
[root@localhost ~]# docker-compose ps
Deploy zabbix using docker-compose
Deploy zabbix using docker-compose

Wait 2 minutes for the database initialization to complete

Next, open your web browser and go to your server using the port 80.

zabbix login
zabbix login

Log in using Zabbix’s default user and password
user: Admin password:zabbix
After that, you will see the dashboard

zabbix dashboard
zabbix dashboard

In a nutshell with Docker Compose, you no longer need to use shell scripts to start the container. In the configuration file, all containers are defined through the services, and then the application is started, stopped, and restarted using the docker-compose script, along with the services in the application and all containers that depend on the services. Docker Compose is a tool for defining and running multi-container Docker applications. it USES YAML files to configure the service of the application and a single command to perform the creation and startup of all containers. The docker-compose cli tool allows users to run commands for multiple containers simultaneously.

administration (22) android (15) Apache (37) bionic (44) Buster (41) CentOS (110) Centos 8 (36) data (17) database (35) Databases (42) debian (90) development (16) Docker (17) fedora (36) firefox (16) How to (237) howto (256) install (15) java (30) Linux (461) linux mint (26) mariadb (34) monitoring (19) mysql (28) network (16) News (25) New version (36) Nginx (15) opensuse (27) PHP (42) postgresql (17) Programming (69) RHEL (42) Security (54) server (156) SQL (38) tools (22) Tutorial (303) ubuntu (147) unix (27) web (23) web server (26) Windows (31) Windows 10 (69) Windows server 2019 (28)

LEAVE A REPLY

Please enter your comment!
Please enter your name here