How To Install Zabbix Server on Ubuntu 20.04|18.04

Posted on 215 views

This guide aims at helping you to Install Zabbix Server on Ubuntu 20.04|18.04 Linux server. Zabbix is an enterprise-grade open source monitoring tool designed to monitor and track applications, systems, and Network devices status. The core of the Zabbix server is written in Java and C, with the frontend interface written in PHP.

Zabbix architecture uses the Server/Client model. The server communicates to the native software agents available for various Operating systems like Linux, NIX, and Windows. For systems without an agent, generic monitoring protocols such as Simple Network Management Protocol (SNMP) or Intelligent Platform Management Interface (IPMI) can be used.

Install Zabbix Server on Ubuntu 20.04|18.04

Installation of Zabbix has a number of steps and Prerequisites that we need to fulfill first. Among the dependencies required are:

  • Apache httpd web service
  • PHP
  • MySQL/ MariaDB database server

MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. Follow steps below to have Zabbix server installed and working on your Ubuntu system.

Step 1: Install and Configure Apache httpd server

Upgrade system:

sudo apt update && sudo apt -y full-upgrade

Reboot system:

sudo reboot

Install apache2 package using the apt-get command:

sudo apt update
sudo apt install apache2

After installing Apache, configure basic security by allowing Prod ServerTokens only.

sudo vim /etc/apache2/conf-enabled/security.conf

Change line 26

ServerTokens Prod

This directive configures what you return as the Server HTTP response. Valid options are Full | OS | Minimal | Minor | Major | Prod.

Set ServerName:

$ sudo vim /etc/apache2/apache2.conf

Set Server Admin to receive an email in case of issues.

$ sudo vim /etc/apache2/apache2.conf
ServerAdmin [email protected]

You need to restart apache web service after making these changes:

sudo systemctl restart apache2

If you have UFW firewall service running add http|https

$ sudo ufw allow http
Rule added
Rule added (v6

$ sudo ufw allow https
Rule added
Rule added (v6)

Step 2: Install PHP and required modules

Install all required PHP extensions using the commands below.

sudo apt -y install php php-cgi php-common libapache2-mod-php php-mbstring php-net-socket php-gd php-xml-util php-mysql php-bcmath

This will install php v7.x on Ubuntu , you can confirm using the command php -v

$ php -v
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( 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

Configure Apache:

sudo  a2enconf php7.*-cgi

Ensure you set correct timezone:

$ sudo vim /etc/php/*/apache2/php.ini 
date.timezone = "Africa/Nairobi"

Restart apache2 after this change:

sudo systemctl restart apache2

Step 3: Install MariaDB Database Server

Run the commands below to install MariaDB database server:

sudo apt update
sudo apt install mariadb-server

Once Database server installation is done open MySQL terminal

$ sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 56
Server version: 10.3.7-MariaDB-1:10.3.7+maria~bionic-log binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Create a database and user for Zabbix:

CREATE DATABASE zabbix character set utf8 collate utf8_bin;;
GRANT ALL PRIVILEGES ON zabbix.* TO [email protected]'localhost' IDENTIFIED BY 'StronDBPassw0rd';

Step 4: Install Zabbix Server on Ubuntu 20.04|18.04

We need to add Zabbix repositories to get the latest release of Zabbix Server installed on Ubuntu 20.04|18.04:

Ubuntu 20.04:

sudo apt install ./zabbix-release_5.0-1+focal_all.deb

Ubuntu 18.04:

sudo apt install ./zabbix-release_5.0-1+bionic_all.deb

Do system update and install Zabbix server packages

sudo apt update
sudo apt install zabbix-agent zabbix-server-mysql php-mysql zabbix-frontend-php

This can also be used to upgrade the Zabbix server. To check the installed version, use:

$ apt-cache policy zabbix-server-mysql
  Installed: 1:5.0.17-1+focal
  Candidate: 1:5.0.17-1+focal
  Version table:
 *** 1:5.0.17-1+focal 500
        500 focal/main amd64 Packages
        100 /var/lib/dpkg/status
     1:4.0.17+dfsg-1 500
        500 focal/universe amd64 Packages

Import database data using the command:

sudo su -
zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz | mysql -uzabbix -p 'StronDBPassw0rd'

Step 5: Configure and Start Zabbix Server on Ubuntu

Zabbix configuration file is located under  /etc/zabbix/zabbix_server.conf. Ensure the following lines are configured correctly.


Restart Zabbix server after modifying this file:

sudo systemctl restart zabbix-server

Edit /etc/php/*/apache2/php.ini to set php requirements for Zabbix server.

$ sudo vim /etc/php/*/apache2/php.ini
max_execution_time = 300
max_input_time = 300
post_max_size = 16M

Configure Zabbix agent to monitor Zabbix server itself.

$ sudo vim /etc/zabbix/zabbix_agentd.conf

Start and enable Zabbix Server:

sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache

Configure Firewall

If you have ufw firewall installed and running on your system, ensure you allow port 5000 and port 5001

sudo ufw allow proto tcp from any to any port 10050,10051

Step 6: Perform Zabbix initial setup on Ubuntu 20.04|18.04

Access “http://(Zabbix server’s hostname or IP address)/zabbix/”  to begin Zabbix initial setup.

Step 1 is a welcome page, click “Next step” to proceed.


Confirm that all pre-requisites are satisfied.


Configure DB settings as added before:


Confirm Hostname and Port number for Zabbix server. It is okay to use localhost in place of name.


Verify all settings and click Next step to finish the initial setup.


If all goes well, you should get congratulations page. Click the Finish button to end installation.


You’ll then get the login page. Default logins are:

Username: "admin"
Password: "zabbix"


Default dashboard page is as below:


Step 7: Change Admin Password

Login to Zabbix admin dashboard with admin user and password zabbix. You need to change the password for admin user after the first login for security reasons.

Navigate to Administration > Users > Admin > Password > Change Password


Enter the new password twice then click on the Update button to change.

Step 8: Configure Monitoring Target host

Now that we have our Zabbix server ready for monitoring, let’s configure first monitoring target host – This is Zabbix server monitoring itself.

Login to Zabbix admin dashboard with the username admin and click on Configuration > Hosts. You should have seen that the host localhost status is set to “Disabled”.


Click on the disabled button to enabled Zabbix agent on this server to monitor the host.  The “Status” is turned to “enabled” and the server is now being monitored.

zabbix-setup-10 (1)

After few minutes, monitoring data will start flowing in, to check host graphs go to Monitoring > Screens > Server name


In our next article, we’ll look at how to monitor Linux and Windows systems with Zabbix.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.