Introduction

Info
Zabbix is a powerful open-source network monitoring solution. This guide will walk you through the installation of Zabbix Network Management System (NMS) 7.0 on Ubuntu using Docker Compose, along with importing hosts from a CSV file.

Prerequisites

Warning
Ensure you meet the following prerequisites before proceeding:
  • Ubuntu 20.04, 22.04, or 24.04 installed
  • Regular user with sudo rights
  • 2 CPUs / vCPUs
  • 4 GB RAM or more
  • 20 GB Hard drive
  • Internet Connection

Installation Steps

Step 1: Install Docker and Docker Compose

Note
Login to your Ubuntu system and run the following commands to install Docker and Docker Compose:
bash
$ sudo apt update
$ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt update
$ sudo apt install -y docker-ce docker-ce-cli containerd.io
$ sudo systemctl start docker
$ sudo systemctl enable docker
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

Verify the installation:

bash
$ docker --version
$ docker-compose --version

Step 2: Create Docker Compose File

Tip
Create a directory for your Zabbix setup and navigate into it:
bash
$ mkdir zabbix-docker && cd zabbix-docker

Create a docker-compose.yml file:

bash
$ vi docker-compose.yml

Add the following content to the docker-compose.yml file:

yaml
version: '3.7'
services:
  zabbix-server:
    image: zabbix/zabbix-server-mysql:alpine-7.0-latest
    container_name: zabbix-server
    ports:
      - "10051:10051"
    environment:
      - DB_SERVER_HOST=mysql-server
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_ROOT_PASSWORD=root_pwd
    networks:
      - zabbix-net
    depends_on:
      - mysql-server

  mysql-server:
    image: mysql:8.0
    container_name: mysql-server
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_ROOT_PASSWORD=root_pwd
    networks:
      - zabbix-net

  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:alpine-7.0-latest
    container_name: zabbix-web
    ports:
      - "80:8080"
    environment:
      - ZBX_SERVER_HOST=zabbix-server
      - DB_SERVER_HOST=mysql-server
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_ROOT_PASSWORD=root_pwd
    networks:
      - zabbix-net
    depends_on:
      - mysql-server
      - zabbix-server

  zabbix-agent:
    image: zabbix/zabbix-agent:alpine-7.0-latest
    container_name: zabbix-agent
    ports:
      - "10050:10050"
    environment:
      - ZBX_HOSTNAME=zabbix-agent
      - ZBX_SERVER_HOST=zabbix-server
    networks:
      - zabbix-net
    depends_on:
      - zabbix-server

networks:
  zabbix-net:
    driver: bridge

Step 3: Start Zabbix NMS

Success
Start the Zabbix NMS using Docker Compose:
bash
$ docker-compose up -d

Verify that all containers are running:

bash
$ docker-compose ps

You should see all containers (zabbix-server, mysql-server, zabbix-web, and zabbix-agent) in the Up state.

Import Hosts from CSV

Step 1: Prepare CSV File

Example
Create a CSV file with the list of hosts you want to import. The CSV file should have the following format:
bash
host,ip,group,templates
Host1,192.168.1.10,Linux servers,Template OS Linux
Host2,192.168.1.11,Windows servers,Template OS Windows

Save the file as hosts.csv.

Step 2: Import Hosts via Zabbix Web Interface

  1. Open your web browser and navigate to http://<your-server-ip>.
  2. Log in to the Zabbix web interface using the default credentials:
    • Username: Admin
    • Password: zabbix
  3. Go to Configuration > Hosts.
  4. Click on the Import button.
  5. Select the hosts.csv file and configure the import options as needed.
  6. Click Import to add the hosts to Zabbix.

Conclusion

Success
That’s all from this post. I believe you have found it informative and useful.