How To Install Zabbix on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Zabbix on Ubuntu 22.04 LTS. For those of you who didn’t know, Zabbix is a free, open-source, and powerful, high-performance monitoring tool for servers. It is designed to track and monitor the status of your system and servers. Zabbix provides support for many database systems including MySQL, PostgreSQL, and SQLite for storing data. Zabbix offers excellent data visualization and reporting using stored data. Zabbix reports and configurations are accessed via a web-based frontend.
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 the step-by-step installation of the Zabbix monitoring on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- 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 Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing LAMP Stack on Ubuntu 22.04.
Before starting this tutorial, the LAMP server must be installed on your server. If you do not have LAMP Stack installed, you can follow our guide here.
Step 3. Installing Zabbix Monitoring Tool on Ubuntu 22.04.
By default, Zabbix is not available on Ubuntu 22.04 base repository. Now run the following command below to download the latest stable version of Zabbix to your Ubuntu system:
wget -q https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
After that, we update the Ubuntu repository lists and install Zabbix packages using the following apt
command:
sudo apt update sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
Step 4. Configuring MariaDB for Zabbix.
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 a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
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 WordPress. 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 WordPress installation:
MariaDB [(none)]> CREATE DATABASE zabbix_db; MariaDB [(none)]> CREATE USER 'zabbix_user'@'localhost' IDENTIFIED BY 'your-strong-password'; MariaDB [(none)]> GRANT ALL ON zabbix_db.* TO 'zabbix_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Next, import the Zabbix database scheme to the ‘zabbix
‘ database using the following command below:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Step 5. Configure Zabbix Server.
Now we edit the Zabbix Server configuration ‘/etc/zabbix/zabbix_server.conf
‘ using nano editor:
nano /etc/zabbix/zabbix_server.conf
Uncomment the following options for the database and change the password with your own:
DBHost=localhost DBPassword=your-strong-password
Save and close the file, then start the Zabbix Server service and add it to the system boot:
sudo systemctl start zabbix-server sudo systemctl enable zabbix-server sudo systemctl status zabbix-server
After configuring the Zabbix Server and Agent, we must restart the Apache service:
sudo systemctl restart apache2
Step 6. Configure Firewall.
Now we set up an Uncomplicated Firewall (UFW) with Apache to allow public access on default web ports for HTTP and HTTPS:
sudo ufw allow OpenSSH sudo ufw allow 'Apache Full' sudo ufw enable
Step 7. Accessing Zabbix Web Interface.
Once successfully installed, open your web browser and access the Zabbix installation wizard using the URL http://Your-IP-Address/zabbix
. You will be redirected to the following page:
Congratulations! You have successfully installed Zabbix. Thanks for using this tutorial for installing the Zabbix monitoring tool on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the Zabbix website.