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

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/20.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
ServerName zabbix.example.com

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 
; http://php.net/date.timezone
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 mariadb.org 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';
FLUSH PRIVILEGES; 
QUIT 

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:

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
sudo apt install ./zabbix-release_5.0-1+focal_all.deb

Ubuntu 18.04:

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+bionic_all.deb
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
zabbix-server-mysql:
  Installed: 1:5.4.0~beta3-1+ubuntu20.04
  Candidate: 1:5.4.0~beta3-1+ubuntu20.04
  Version table:
 *** 1:5.4.0~beta3-1+ubuntu20.04 500
        500 http://repo.zabbix.com/zabbix/5.3/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     1:4.0.17+dfsg-1 500
        500 http://mirrors.digitalocean.com/ubuntu 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.

DBName=zabbix
DBUser=zabbix
DBPassword=StronDBPassw0rd

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
Hostname=zabbix-server.computingforgeeks.com

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

zabbix 5 web 1

Confirm that all pre-requisites are satisfied.

zabbix setup 02

Configure DB settings as added before:

zabbix setup 03

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

zabbix setup 04

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

zabbix setup 05

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

zabbix setup 06

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

Username: "admin"
Password: "zabbix"
zabbix setup 07

Default dashboard page is as below:

zabbix setup 08

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

zabbix setup chnage 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”.

zabbix setup 09

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

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

zabbix setup 11

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

For Installation of Zabbix agent, look at Installing and configure Zabbix agent on Ubuntu

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here