Zabbix is an open source monitoring software for companies. It is not limited to monitoring servers, but can also monitor network devices, cloud services, virtual machines and containers, databases and applications, IoT sensors, etc.
The open source monitoring tool Zabbix is built on security: Communication between Zabbix components is encrypted by default. Zabbix is 100% open source and can be used both on-premise and in the cloud. It also supports distributed monitoring and high availability.
Thanks to extensive support from software and hardware providers, Zabbix can be integrated into numerous applications and services. For example, the integration of Zabbix into cloud services such as Google Cloud and Amazon Web Services or the integration of Zabbix into Prometheus and Grafana, etc.
The main component of Zabbix (server and agent) is written in C, the frontend in PHP. You can install Zabbix with various database backends, including MySQL, PostgreSQL, TimescaleDB, Oracle and SQLite. Zabbix is a free monitoring tool released under the GNU GPL v2 license.
Below are some notable features of Zabbix:
- Wide support of operating systems (Linux, Windows, macOS, BSD, AIX, Solaris)
- Multiple alerting methods (Pagerduti like services, email, SMS, webhook integration, Slack like services)
- Detailed data visualization (graphs, infrastructure maps, reports)
- Comprehensive support for software and hardware providers
- Enterprise-grade security (encryption, authentication, user roles and permissions, etc.)
- Distributed monitoring and support for high availability
Prerequisites
In this article you will install Zabbix on Debian 11 Bullseye.
Below you can see the environment for an example:
- Operating system: Debian 11 Bullseye
- Server-IP-Adresse: 192.168.1.10
- Root privileges
You will install Zabbix together with the following software:
- Web server: Apache
- PHP version: 7.x
- Database: MariaDB
Now let’s start with the installation of Zabbix.
Install dependencies
In this step, you install some packages that are required for Zabbix. You install and configure the Apache2 web server, the PHP packages and the MariaDB database.
1. run the following apt command to install Apache2 and PHP packages.
sudo apt install apache2 php php-mysql php-mysqlnd php-ldap php-bcmath php-mbstring php-gd php-common php-xml libapache2-mod-php
Type“y” and press“Enter” to complete the installation.
When the installation of the packages is complete, start and activate the apache2 service with the following command.
sudo systemctl enable --now apache2
Check the status of the apache2 service and make sure it is active and running.
sudo systemctl status apache2
Below you can see a similar output when the apache2 service is running.
2. next, run the apt command to install the MariaDB packages.
sudo apt install mariadb-server mariadb-client
Type“y” to confirm the installation and press“Enter“.
After the installation is complete, start and activate the MariaDB service and check the service. Make sure it is active and running.
sudo systemctl enable --now mariadb sudo systemctl status mariadb
As you can see on the screenshot below, the MariaDB service is active and running.
3. now you need to set up the MariaDB root password. The MariaDB packages contain the command line program“mysql_secure_installation” which you can use to set up the MariaDB installation.
Execute the“mysql_secure_installation” command below to set up the MariaDB root password.
sudo mysql_secure_installation
You can enter a new root password for MariaDB and confirm all configurations with“y” and“Enter“.
The installation of the package dependencies for Zabbix is now complete.
Set up database and user for Zabbix
In this step you create a new database and the user Zabbix. The database and user are listed below as an example:
- Database name: zabbix
- User: zabbix
- Password: StrongPasswordZabbix
1. to create a new MariaDB database and a new user, log in to the MariaDB shell with the following command.
sudo mysql -u root -p
Enter the MariaDB root password and press“Enter“.
2) Next, create a new database with the following query.
create database zabbix character set utf8 collate utf8_bin;
3. create a new MariaDB user and grant him all rights for the database“zabbix“.
grant all privileges on zabbix.* to zabbix@localhost identified by 'StrongPasswordZabbix';
4. now reload all authorizations for the tables and enter“exit” to log out of the MariaDB shell.
flush privileges; exit
Now you are ready to install Zabbix.
Installing and configuring Zabbix on Debian 11
In this step, you install and configure the Zabbix monitoring tool. By default, Zabbix officially provides repository packages for Debian-based distributions. You can install all packages related to Zabbix from the official Zabbix repository.
1. download the ‘.deb’ file containing the Zabbix repository to your system.
wget --no-check-certificate https://repo.zabbix.com/zabbix/5.5/debian/pool/main/z/zabbix-release/zabbix-release_5.5-1+debian11_all.deb
Add the Zabbix repository and update your Debian repository with the command below.
sudo dpkg -i zabbix-release_5.5-1 debian11_all.deb sudo apt update
After you have updated the Debian repository, you can install Zabbix.
2. run the following command to install the Zabbix monitoring tool packages.
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Type“y” and press“Enter” to continue the installation.
3. after the installation of Zabbix is complete, import the Zabbix database schema into the“zabbix” database using the following command.
zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -p zabbix
Enter the MariaDB password for the user“zabbix” and press“Enter“.
4. next you need to configure the database for Zabbix.
Edit the Zabbix configuration“https://vitux.com/etc/zabbix/zabbix_server.conf” with the nano editor.
nano /etc/zabbix/zabbix_server.conf
Change the database name, user and password with your specifications.
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=StrongPasswordZabbix
Save the configuration and finish it.
5. to configure the time zone for the Zabbix frontend, edit the Zabbix configuration “https://vitux.com/etc/zabbix/apache.conf” with the nano editor.
nano /etc/zabbix/apache.conf
Copy the following configuration and paste it into the section ” … “ section.
..... ...... ....... php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value max_input_vars 10000 php_value always_populate_raw_post_data -1 php_value date.timezone Europe/Amsterdam
Save the configuration and exit.
6. to apply the new zabbix configuration, restart the apache2 service with the following command
sudo systemctl restart apache2
7. now start and activate the services“zabbix-server” and“zabbix-agent” with the following command.
sudo systemctl enable --now zabbix-server zabbix-agent
8. check the two services “zabbix-server” and “zabbix-agent” with the following command.
sudo systemctl status zabbix-server sudo systemctl status zabbix-agent
The screenshot of the zabbix-server service is active and running.
The screenshot of the zabbix-agent service, which is active and running.
The basic installation of the Zabbix monitoring tool is complete.
Open HTTP and HTTPS port in the UFW firewall
If you have the UFW firewall on your Debian server, you need to add the HTTP and HTTPS service to the UFW rule.
1. run the following bash script to add the SSH, HTTP and HTTPS services to the ufw firewall.
for i in http https ssh do ufw allow $i done
2. now reload the UFW service and the rule with the following command.
ufw reload
And now you can access your Zabbix monitoring tool.
Zabbix installation
To complete the Zabbix installation, open your web browser and enter the IP address of your server with the path “https://vitux.com/zabbix” in the address bar.
http://192.168.1.10/zabbix/
1. click on the“Next step” button on the Zabbix welcome page to continue
2. the web installer will check all system requirements for Zabbix. Make sure that all statuses are“OK“. Click on the “Next step” button to continue. 3.
3. select“MySQL” as“Database type” and enter your database name, user and password. Then click on the “Next step” button.
4. enter the server name of your Zabbix installation and select the time zone for your Zabbix frontend.
Now click on the “Next step” button again.
5. check the details of your installation again. When you are ready, click on the “Next step” button to install Zabbix.
6. when the installation is complete, you will see the following page.
Click on the“Finish” button.
7. you will now be redirected to the Zabbix login page.
Enter the default user“Admin” and the password“zabbix” and then click on the“Login” button.
8. you will now see the Zabbix admin dashboard as shown below.
9. wait a few minutes for the Zabbix agent to collect data about your Zabbix server and then click on the “Hosts” menu.
Right-click on the name of your Zabbix server and select“Graph“.
You will now see the graphical monitoring of your Zabbix server.
This completes the installation of Zabbix on Debian 11 Bullseye.
Conclusion
Congratulations! You have successfully installed the Zabbix monitoring tool on the latest Debian 11 Bullseye. You have installed Zabbix with the Apache2 web server, PHP and the MariaDB database.
In the next step, you can add your hosts, devices or services to be monitored to the Zabbix server.