How to Install and Configure Zabbix Server 6 on Ubuntu 20.04

Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption. Zabbix has a rich set of features to enable users to monitor more than just hosts, offering great flexibility to administrators when it comes to choosing the most suitable option for each situation.

Zabbix uses XML based template which contains elements to monitor. The backend of Zabbix is written in C programming and PHP is used for the web frontend. **Zabbix **can send you **alerts **to notify the different events and issues based on metrics and thresholds defined for your IT environment. It supports agent-based and agentless monitoring. But Zabbix agents installation can help you to get detailed monitoring e.g. CPU load, network, disk space utilization.

As of the writting of this article, the latest Zabbix version is 6.0. In this guide, we will learn how to install and configure Zabbix on Ubuntu 20.04.

Related content:

# Table of Content

  1. Ensure that the server is up to date
  2. Install Mariadb
  3. Create mysql user for zabbix
  4. Install PHP and required PHP modules
  5. Install Apache web server
  6. Edit PHP and php-fpm configs for Zabbix
  7. Start and enable php-fpm service
  8. Install Zabbix
  9. Configure SELinux and firewall
  10. Complete Zabbix Installation

# 1. Ensure that the server packages are up to date

Before proceeding, let us make sure that our server packages are up to date with this command:

sudo apt update
sudo apt -y upgrade

Let us also install some common packages that we will need

sudo apt install -y vim

# 2. Install Mariadb

Zabbix requires mysql to function. Mariadb is a popular Opensource relational management system. We will use it in this guide. It is available in the default repositories as mariadb-server. For a detailed guide check out How to install and Configure Mariadb 10 in Ubuntu 20.04.

Install Mariadb :

sudo apt install -y mariadb-server

Once mariadb is installed, you can confirm the details using this command:

$ apt-cache policy mariadb-server
  Installed: 1:10.3.32-0ubuntu0.20.04.1
  Candidate: 1:10.3.32-0ubuntu0.20.04.1
  Version table:
 *** 1:10.3.32-0ubuntu0.20.04.1 500
        500 focal-updates/universe amd64 Packages
        500 focal-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     1:10.3.22-1ubuntu1 500
        500 focal/universe amd64 Packages

The Service will be started by default. Confirm the status with this command:

$ sudo systemctl status mariadb
sudo: unable to resolve host No address associated with hostname
● mariadb.service - MariaDB 10.3.32 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-02-23 13:05:12 UTC; 21s ago
       Docs: man:mysqld(8)
   Main PID: 11362 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 4624)
     Memory: 64.3M
     CGroup: /system.slice/mariadb.service
             └─11362 /usr/sbin/mysqld

Feb 23 13:05:12 /etc/mysql/debian-start[11401]: information_schema
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: mysql
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: performance_schema
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: Phase 6/7: Checking and upgrading tables
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: Processing databases
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: information_schema
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: performance_schema
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Feb 23 13:05:12 /etc/mysql/debian-start[11401]: OK
Feb 23 13:05:12 /etc/mysql/debian-start[11467]: Checking for insecure root accounts.

To ensure that mariadb starts on boot, enable it with this systemd command:

sudo systemctl enable mariadb

Once the mysql service is running, you need to secure it. Mysql provides a commandline utility that will do that:

sudo mysql_secure_installation

The above command will take you through prompts to secure and set a root password for the mysql instance.

To confirm the version of MariaDB installed, run the command:

$ mysql -V
mysql  Ver 15.1 Distrib 10.3.32-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

# 3. Create mysql user for Zabbix

We are going to create a dedicated user for zabbix. Check out this guide on managing mysql permissions here.

Connect to mysql server:

mysql -u root -p

After Supplying your root password, enter the following to the mysql prompt:

create database zabbix character set utf8 collate utf8_bin;
create user 'zabbix_user'@'%' identified by 'S0mStrongPa$$word';
grant all privileges on zabbix.* to 'zabbix_user'@'%';

Save the username, db name and password, we will need them later.

Now that we have configured our mysql connection, let’s go to the next section where we install and configure PHP.

# 4. Install PHP and required php modules

Zabbix server uses PHP. We need to install and configure PHP for zabbix to work.

To install PHP and the required PHP modules for Zabbix installation:

sudo apt install -y \
    php \
    php-cli \
    php-common \
    php-fpm \
    php-curl \

Check php version

$ php -v
PHP 7.4.3 (cli) (built: Nov 25 2021 23:16:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

For more info on setting up PHP and Apache, check out this guide How to install and set up PHP and Apache(LAMP stack) on Ubuntu 20.04.

# 5. Install Apache Web Server

Next, let us install Apache in our system. Use this command to install Apache web server.

sudo apt install -y apache2

Apache 2 will be started by default. Check the status using this command:

$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-02-23 13:29:53 UTC; 4min 42s ago
   Main PID: 23432 (apache2)
      Tasks: 6 (limit: 4624)
     Memory: 11.0M
     CGroup: /system.slice/apache2.service
             ├─23432 /usr/sbin/apache2 -k start
             ├─23435 /usr/sbin/apache2 -k start
             ├─23436 /usr/sbin/apache2 -k start
             ├─23437 /usr/sbin/apache2 -k start
             ├─23438 /usr/sbin/apache2 -k start
             └─23439 /usr/sbin/apache2 -k start

Feb 23 13:29:53 systemd[1]: Starting The Apache HTTP Server...
Feb 23 13:29:53 apachectl[23431]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, usin>
Feb 23 13:29:53 systemd[1]: Started The Apache HTTP Server.

Active: active (running) indicate that the service is now up and running.

To enable the service on boot, use this command:

sudo systemctl enable apache2

# 6. Edit PHP and php-fpm Config for Zabbix

Update the php config to optimize for Zabbix installation.

Open the php ini file

sudo vim /etc/php/7.4/cli/php.ini

Then modify these settings to the values shown. Update the timezone to fit yours.

memory_limit = 2G
max_execution_time = 360
date.timezone = Africa/Nairobi

Next let us edit the php-fpm settings.

sudo vim /etc/php/7.4/fpm/pool.d/www.conf

Then update these values

listen = /run/php/php7.4-fpm.sock
user = www-data
group = www-data

listen.allowed_clients =
listen.owner = www-data = www-data
listen.mode = 0660
pm = dynamic

Save the changes and exit the file.

# 7. Start and enable php-fpm service

The php-fpm service is started by default. Confirm by checking the status:

$ sudo systemctl status php7.4-fpm
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-02-23 13:29:55 UTC; 15min ago
       Docs: man:php-fpm7.4(8)
   Main PID: 23781 (php-fpm7.4)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 4624)
     Memory: 8.0M
     CGroup: /system.slice/php7.4-fpm.service
             ├─23781 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
             ├─23782 php-fpm: pool www
             └─23783 php-fpm: pool www

Feb 23 13:29:55 systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Feb 23 13:29:55 systemd[1]: Started The PHP 7.4 FastCGI Process Manager.

Enable the service to start on boot

sudo systemctl enable php7.4-fpm

At this point, we have successfully installed the LAMP stack. We can now install Zabbix

# 8. Install Zabbix

Zabbix is not available in the default Ubuntu repositories but it provides a repository.

First, download and Install the zabbix repository

curl -LO
sudo dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb

Once the repository is installed, install the Zabbix server, Zabbix agent, and the associated Zabbix packages.

sudo apt update && sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Next, import the database schema:

sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix_user -p zabbix

When prompted for a password, provide the Zabbix user’s password.

Edit Zabbix configuration file and update the db credentials

sudo vim /etc/zabbix/zabbix_server.conf

Ensure that the DBNameDBUserDBPassword values reflect the values you provided for your database


Save the changes and exit the configuration file.

To apply all the changes made, restart all the services as shown

sudo systemctl restart zabbix-server zabbix-agent apache2

Additionally, consider enabling them on startup.

sudo systemctl enable zabbix-server zabbix-agent apache2

# 9. Configure Firewall

If you have ufw firewall installed and enabled, enable web and Zabbix ports

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 10050:10051/tcp
sudo ufw enable

# 10. Complete Zabbix Installation

To complete the installation, launch your browser, and go to this URL:


The first page that greets you is the Zabbix welcome page that boldly displays the version you are installing. Select the installation language and click on the ‘Next step’ button.

Citizix – Zabbix 6 welcome page

In the next page you get a list of prerequisites, scroll all the way down and ensure all the prerequisites get the ‘OK’ label in the last column. It’s mandatory that all the requirements are satisfied. Then hit the ‘Next step’ button.

Citizix - Zabbix prerequisites

Citizix – Zabbix prerequisites

On the ‘Configure DB Connection’ page. Fill out your database details. For the database port, leave it at 0. The press ‘Next step’.

Citizix - Zabbix DB configCitizix - Zabbix DB config

Citizix – Zabbix DB config

Then specify your server’s name, confirm your time zone and feel free to select your preferred theme. Then press ‘Next step’.

Citizix – Zabbix Server 6 Details

Citizix – Zabbix Server 6 Details

Confirm all the settings and if all looks well, press on ‘Next step’ to finalize the installation.

Citizix - Zabbix Preinstall Summary

Citizix – Zabbix Preinstall Summary

If all the settings you provided are correct, you will get a congratulatory message notifying you of the successful setup of Zabbix’s front end. Press on the ‘Finish’ button.

Citizix - Zabbix Install success

Citizix – Zabbix Install success

This directs you to the Zabbix login page. Log in with the following credentials:

Username: Admin
Password: zabbix

Citizix - Zabbix login page

Citizix – Zabbix login page

Then click on ‘Sign in’ to access the Zabbix dashboard. You can change the password later for added security, so don’t worry about that.

Finally, you will get access to Zabbix’s dashboard

Citizix – Zabbix 6 dashboard

Citizix – Zabbix 6 dashboard

 That is it! We have successfully installed the Zabbix monitoring tool on Ubuntu 20.04.

Last updated on Mar 20, 2024 17:19 +0300
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy