You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This guide aims at helping you to Install Zabbix Server on Ubuntu 18.04. 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.


How to Install Zabbix Server 4.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS

Other Monitoring Tutorials available are:

How to Monitor Linux Server Performance with Prometheus and Grafana in 5 minutes

How to Monitor BIND DNS server with Prometheus and Grafana

Monitoring MySQL / MariaDB with Prometheus in five minutes

Install Prometheus Server on CentOS 7 and Ubuntu 18.04

Monitoring MySQL and MongoDB with Prometheus and Grafana – PMM

Install Grafana and InfluxDB on CentOS 7

How to Monitor Redis Server with Prometheus and Grafana in 5 minutes

Monitor Linux System with Grafana and Telegraf

Monitoring Ceph Cluster with Prometheus and Grafana

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.

Installing Zabbix Server on Ubuntu 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 18.04 system.

Step 1: Install Apache httpd server

Update your system then install apache2 package using the apt-get command:

sudo apt update
sudo apt upgrade
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:

# grep ServerName /etc/apache2/apache2.conf

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

# grep ServerAdmin /etc/apache2/apache2.conf
ServerAdmin [email protected]

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

sudo systemctl restart apache2

Enable firewall service and add http|https

$ sudo ufw enable
$ sudo ufw allow http
Rule added
Rule added (v6

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

Step 2: Install php for Apache

Configure Apache2 to use PHP scripts by  installing the following packages:

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

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

$ php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Configure Apache:

$ sudo  a2enconf php7.2-cgi 
Enabling conf php7.2-cgi.
To activate the new configuration, you need to run:
systemctl reload apache2

Ensure you set correct timezone:

# grep date.timezone /etc/php/7.2/apache2/php.ini 
date.timezone = "Africa/Nairobi"

Restart apache2 after this change:

sudo systemctl restart apache2

Step 3: Install MariaDB server

For the installation of MariaDB on Ubuntu, use my previous guide:

How to Install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7

Once Database server installation is done, you need to create a database for Zabbix user:

$ mysql -u root -p
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.

MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected]'localhost' identified by 'password';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> flush privileges; 
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> exit 

Step 4: Install Zabbix Server

As of this writing, the latest version of Zabbix Server is 3.4 but the version available on Ubuntu repositories is 3.0. To install version 3.4, you need to add Zabbix repositories for this version:


$ sudo dpkg -i zabbix-release_3.4-1+bionic_all.deb 
Selecting previously unselected package zabbix-release.
(Reading database ... 108829 files and directories currently installed.)
Preparing to unpack zabbix-release_3.4-1+bionic_all.deb ...
Unpacking zabbix-release (3.4-1+bionic) ...
Setting up zabbix-release (3.4-1+bionic) ...

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:3.4.10-1+bionic
Candidate: 1:3.4.10-1+bionic
Version table:
*** 1:3.4.10-1+bionic 500
500 bionic/main amd64 Packages
100 /var/lib/dpkg/status
1:3.0.12+dfsg-1 500
500 bionic/universe amd64 Packages

Import database data using the command:

# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:

Step 5: Configure and start Zabbix server

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

Set php always_populate_raw_post_data to off

# vim /usr/share/zabbix/include/classes/setup/CFrontendSetup.php

Look for the lines:

public function checkPhpAlwaysPopulateRawPostData() {
$current = ini_get('always_populate_raw_post_data');

Then add the line ‘$current = -1‘  after $current = ini_get(‘always_populate_raw_post_data’);. The final setting should look like below:

public function checkPhpAlwaysPopulateRawPostData() {
    $current = ini_get('always_populate_raw_post_data');
    $current = -1;

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

# vim /etc/php/7.2/apache2/php.ini
max_execution_time = 300
max_input_time = 300
post_max_size = 16M

Configure Zabbix agent to monitor Zabbix server itself.

# vim /etc/zabbix/zabbix_agentd.conf

Start and enable Zabbix Server:

# systemctl start zabbix-server
# systemctl enable zabbix-server
Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-server

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 5: Perform Zabbix initial setup

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 6: 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.

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.

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.

For Installation of Zabbix agent, look at How to Install and configure Zabbix agent on Ubuntu 18.04

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF