How to install the Zabbix server on Ubuntu 20.04

Zabbix is a web-based open source monitoring tool for monitoring various IT components. This includes network devices such as servers, virtual machines, and applications. It offers a wide variety of monitoring metrics such as network usage, CPU usage, and disk usage. This makes troubleshooting easier if the system behaves abnormally. You can visualize the key performance indicators in the form of graphs, screens, maps and overviews.

In this guide, we are going to show you how to install it Zabbix server 5.0 on Ubuntu 04/20 LTS.


Before starting, make sure you have a running Ubuntu 20.04 instance with sudo permissions. Also, make sure you are connected to a stable internet connection.

Step 1: install and set up Apache

In this step we install the Apache web server. First, update all Ubuntu repository lists and install Apache packages by running the following command:

$ sudo apt update 

now Install Apache with the following command:

$ sudo apt install  apache2 

The Apache service is started by default after installation. If not started, run the following command to start Apache2.

$  sudo systemctl start apache2  

to Activate Apache2 Enter the following at boot:

$ sudo systemctl enable apache2

Step 2: Install PHP and related modules

The front end of Zabbix is ​​written in PHP and therefore we have to install PHP. Ubuntu already provides PHP 7.4 by default in its repositories. This is what we’re going to use for this guide.

To install PHP packages use the following apt command:

$ sudo apt install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql

You can check the installed PHP version with the following command:

$ php -v

Once the installation is complete, go to the PHP configuration directory and edit the /etc/php/7.4/apache2/php.ini File. Change the parameters as shown and make sure you set the correct time zone according to your locale.

$ sudo vim /etc/php/7.4/apache2/php.ini
memory_limit 256M
upload_max_filesize 16M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000

Restart the Apache service for the changes to take effect

$ sudo systemctl restart apache2

Step 3: Install MariaDB database server

Next, we’ll install the MariaDB database as our preferred database server for storing user data and storing other metrics.

Install MariaDB Server packages by running the following command:

$ sudo apt install mariadb-server

After the installation, make sure to harden your database server with the following command:

$ sudo mysql_secure_installation

Start by setting the root password.

Set password for Mariadb

Then type ‘AND‘for all remaining prompts:

Harden the maridb instance

Step 4: create the Zabbix user and database

Next we will create a database user for the Zabbix server. You need to log into the MariaDB instance first:

$ sudo mysql -u root -p

Create a Zabbix user and database as shown and give the user all permissions as follows:

CREATE DATABASE zabbix_db character set utf8 collate utf8_bin;
CREATE USER 'zabbix_user'@'localhost' IDENTIFIED BY '[email protected]';
GRANT ALL PRIVILEGES ON zabbix_db.* TO 'zabbix_user'@'localhost' WITH GRANT OPTION;

Create database for Zabbix

Step 5: Activate the Zabbix repository

To add the Zabbix repository to your system, first Download the Zabbix Share the Debian package with the wget command.

$ wget

We use Zabbix 5.01 version This is the case at the latest when this manual is written.

Then enter the following to activate the Zabbix repository:

$ sudo dpkg -i zabbix-release_5.0-1+focal_all.deb

To synchronize the newly added repository with the system, update the package lists

$ sudo apt update

Step 6: Install the Zabbix server on Ubuntu 20.04

To install the Zabbix server we install the zabbix-server-mysql Package that provides MySQL support, the zabbix-frontend-php Package that is next to a web interface for the server zabbix-agent for shipping metrics and the zabbix-apache-conf Package for Apache.

$ sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-apache-conf

Step 7: configure the Zabbix server

With Zabbix installed, some additional tweaking is required. The configuration file is located under /etc/zabbix/zabbix_server.conf Path. So open the file.

$ sudo vim /etc/zabbix/zabbix_server.conf

Update your database configurations according to your database user settings

[email protected]

Then load the standard schema of the Zabbix database.

$ cd /usr/share/doc/zabbix-server-mysql
$ zcat create.sql.gz | mysql -u zabbix_user -p zabbix_db

You’ll need to provide your password so go ahead and enter it.

Now enable the Zabbix service to start at system startup and restart the service to apply the new settings.

$ sudo systemctl enable zabbix-server
$ sudo systemctl restart zabbix-server

You can check the status of Zabbix with the following command:

$ sudo systemctl status zabbix-server

Zabbix also creates its own Apache configuration file /etc/zabbix/apache.conf and creates a link to the Apache configuration directory. Use the following command to restart the Apache services.

$ sudo systemctl restart apache2

Also make sure Apache is running:

$ sudo systemctl status apache2

Your system is now ready for the Zabbix installation.

Step 6: configure the firewall

If you are behind a firewall, you have to allow the Zabbix ports 10050 and 10051 as well as HTTP. Run the following commands to allow the ports:

$ sudo ufw allow 80/tcp
$ sudo ufw allow 10050/tcp
$ sudo ufw 10051

Then reload your firewall service for the changes made above to take effect:

$ sudo ufw reload

Step 7: Complete the Zabbix installation in a browser

We’re all set now. All that remains is to complete the installation in a web browser. So start your browser and navigate to the address shown:

http: // server-ip / zabbix

You will receive a welcome page shown below. Just click Next to go to the next step.

Check whether all requirements have been met by the server and click the Next Step button.

Check requirements

In the next step, enter the database credentials you provided in step 4 when you created a database for Zabbix and click the Next Step button.

Configure the Zabbix database connection
Configure the Zabbix database connection

For the Zabbix server details, enter your server host name and IP address and then click the “Next Step” button again.

Zabbix server details

You will get a pre-installation summary as shown. Make sure all configuration parameters are correct, then click the Next Step button.

Install the Zabbix server on Ubuntu
Summary of the zabbix pre-installation

After the installation has completed successfully you should see the following screen:

Install the Zabbix server on Ubuntu
Zabbix installation completed

Click the Finish button. You will be redirected to the Zabbix front end login page shown below:

Sign in with the following default credentials:

Username: Admin
Password: zabbix

Install the Zabbix server on Ubuntu
Zabbix login page

After successfully signing in, you will see the Zabbix dashboard as shown below:

Install the Zabbix server on Ubuntu
Zabbix dashboard


And that’s it! You can now start adding your hosts to the monitoring server to keep an eye on their performance. In this guide, we have shown you how to install the Zabbix server on the Ubuntu 20.04 system.