How to install Zabbix 6 on Ubuntu 20.04 step by step

In this tutorial I will be showing you how to install Zabbix 6 step by step on Ubuntu 20.04.

Zabbix is an open-source tool for monitoring IT infrastructure like networking, servers, cloud services and virtual machines.

Zabbix collects and display basic metrics on a dashboard. It uses a flexible notification mechanisms that allows users to configure email based alerts for all the events that happened. This allows fast reaction to server problems. Zabbix offers excellent data visualization and reporting using stored data. Zabbix reports and configurations are accessed via a web based frontend.

Features of Zabbix 6

  • Zabbix 6 now supports monitoring of over 100k Zabbix instances, which is now great whenever you want to monitor your instances.
  • You can now in a position to define your user permission on any business service provided.
  • Now you are in a position to define read-write or read-only permissions to your specific business services.
  • You are now in a position to receive alerts and be able to react to any business changes thanks to Zabbix 6 capability.
  • You are now capable of assigning weight to each of your business services
  • Empowering your business service monitoring is now possible with root cause analysis. You can gather all the root cause analysis using the Zabbix API.
  • Its now possible to have out of the box high availability cluster for Zabbix server.
  • They have embedded new way of learning in the context of machine learning and Kubernetes monitoring capability.

Zabbix Architecture

What are the components of Zabbix?

Server: It is the central component which agents reports the availability and integrity of the information.

Storage: All information are stored in a database mostly MySQL.

Web interface: Its where you monitor your Zabbix server activities

Zabbix proxy: It helps to distribute the load of any Zabbix server

Agents: They are deployed on monitoring targets to actively monitor local resources and reports gathered data to Zabbix server.

Installing Zabbix 6 from packages.

There a few ways you can install Zabbix, i.e. installing from the sources, from packages and installing from containers. We will be installing from the Ubuntu packages.

So this is how we are going to achieve this

  1. OS distribution will be Ubuntu 20.04
  2. Database will be PostgreSQL
  3. Web server will be NGINX

Lets begin our installation.

1. Update system repositories.

The first step is to update system repositories, this will make our system repositories up to date and also avoid running into errors.

sudo apt update && apt upgrade

2. Install Zabbix repository.

We are going to download Zabbix .deb packages and later install it. Make sure you run system wide updates to enable the changes take effect.

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb

After the download is complete we need to install it using the following command.

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

Then we need to update our repositories again before installing the frontend, server and the agent.

sudo apt update

3. Install Zabbix server, Frontend and agent

Let’s now proceed to install Zabbix server, frontend and agent. Use the following command.

apt install zabbix-server-pgsql zabbix-frontend-php php7.4-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

When installation is complete, we can verify the Zabbix server installed using the following command.

apt-cache policy zabbix-server-pgsql

4. Install Postgresql database

To install Postgresql check out this article How to install PostgreSQL 14 on Ubuntu 20.04|21.10

Create a file repository for Postgresql

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Next is to import GPG key

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

After this, we need to update our system again.

apt update

And lastly install Postgresql 14 with the following command;

sudo apt install postgresql-14 -y

Once installed login into Postgresql shell;

sudo -i -u postgres

We now need to create a database user with permissions like this:

sudo -u postgres createuser --pwprompt zabbix

Setup the database Zabbix with previously created user.

sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix

After this we now need to import initial schema and data. Enter your initial created password when prompted.

zcat /usr/share/doc/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix

5. Configure database for Zabbix server

Open your preferred text editor and edit the following /etc/zabbix/zabbix_server.conf. I am using vim as text editor.

sudo vi /etc/zabbix/zabbix_server.conf

Add this

DBPassword=password

6. Configure PHP for Zabbix frontend

To configure PHP we need to edit /etc/zabbix/nginx.conf, uncomment and set listen and server_name directives.

sudo vi /etc/zabbix/nginx.conf

Make sure listen is in port 80 and server_name set to your ip address

Lastly you need to start Zabbix server and agent

#restart
systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm
# enable
systemctl enable zabbix-server zabbix-agent nginx php7.4-fpm

7. Configure Zabbix frontend

To configure frontend head over to http://<server ip/domain> and follow the instructions.

Conclusion

I hope this tutorial have gave you more insight about Zabbix. Head over to the Zabbix documentation for more information.

About Kipkoech Sang

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Kipkoech Sang →

Leave a Reply

Your email address will not be published.