In this tutorial, we will show you how to install Zabbix on Debian 11. For those of you who didn’t know, Zabbix is an open-source monitoring tool for servers, applications, and network devices. It is used to monitor networks, servers, applications, services as well as cloud resources. It also supports the monitoring of storage devices, databases, virtual machines, telephony, IT security resources, and much more.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Zabbix open-source monitoring tool on a Debian 11 (Bullseye).
Prerequisites
- A server running one of the following operating systems: Debian 11 (Bullseye).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Zabbix on Debian 11 Bullseye
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt
commands in the terminal:
sudo apt update sudo apt upgrade
Step 2. Installing the LAMP stack.
A Debian 11 LAMP server is required. If you do not have LAMP installed, Please read our previous tutorial to install LAMP Server on Debian 11.
Step 3. Installing Zabbix on Debian 11.
By default, Zabbix is not available on Debian 11 base repository. Now we add the official Zabbix repository to your Debian system:
wget https://repo.zabbix.com/zabbix/5.4/debian/pool/main/z/zabbix-release/zabbix-release_5.4-1+debian11_all.deb dpkg -i zabbix-release_5.4-1+debian11_all.deb
Next, install the Zabbix server, frontend, and agent packages using the following command:
sudo apt update sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-sql-scripts
Step 4. Configure MariaDB Database.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. You should read and below each step carefully which will set the root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
Next, we will need to log in to the MariaDB console and create a database for Zabbix. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server, you need to create a database for the Zabbix software:
CREATE DATABASE zabbix_db; CREATE USER 'zabbixuser'@'localhost' IDENTIFIED BY 'Your-Strong-Passwd'; GRANT ALL PRIVILEGES ON `zabbix_db`.* TO 'zabbixuser'@'localhost'; FLUSH PRIVILEGES;
Next, we import the Zabbix default database:
zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -u zabbix -p zabbix
After that, add database name, database user, and database password:
nano /etc/zabbix/zabbix_server.conf
Add the following lines:
DBHost=localhost DBName=zabbix_db DBUser=zabbixuser DBPassword=Your-Strong-Passwd
Step 5. Setup PHP Time Zone.
Now set up PHP to work correctly with the Zabbix frontend by defining your timezone in the /etc/zabbix/apache.conf
file:
nano /etc/zabbix/apache.conf
Add your time zone from the last line:
php_value[date.timezone] = Asia/Jakarta
Finally, start the Zabbix server and agent processes, enabling them to auto-start at system boot as shown:
sudo systemctl restart zabbix-server zabbix-agent apache2 sudo systemctl enable zabbix-server zabbix-agent apache2
Step 6. Configure Firewall.
Now we open ports 80 and 443 to allow Apache server traffic. We will do it with the following commands below:
ufw allow 80/tcp ufw allow 443/tcp ufw reload
Step 7. Accessing Zabbix Web Interface.
Once successfully installed, open your web browser and access the Taskboard using the URL http://your-ip-address
. You will get the following screen:
Congratulations! You have successfully installed Zabbix. Thanks for using this tutorial for installing the latest version of the Zabbix open-source network and application monitoring on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Zabbix website.