
Your Ultimate Guide to Installing Zabbix Server on Ubuntu 22.04
In the world of IT infrastructure management, proactive monitoring is not just a luxury—it’s a necessity. Zabbix stands out as a powerful, enterprise-grade, open-source monitoring solution that allows you to collect, analyze, and visualize data from virtually any source. Whether you’re tracking server performance, network devices, or application health, Zabbix provides the tools you need to stay ahead of potential issues.
This comprehensive guide will walk you through every step of installing a fully functional Zabbix Server on Ubuntu 22.04 (Jammy Jellyfish). By the end of this tutorial, you’ll have a robust monitoring platform ready to manage your entire technology stack.
Prerequisites
Before we begin, ensure you have the following:
- An Ubuntu 22.04 server instance.
- A user account with
sudo
or root privileges. - Basic familiarity with the Linux command line.
Let’s get started!
Step 1: Update Your System
First things first, it’s always a best practice to update your system’s package list and upgrade existing packages to their latest versions. This ensures compatibility and security.
Open your terminal and run the following commands:
sudo apt update
sudo apt upgrade -y
Step 2: Install the LAMP Stack
Zabbix requires a web server, a database, and PHP to function. The most common combination is the LAMP stack: Linux, Apache, MySQL, and PHP.
Install Apache, MySQL, and PHP:
Run this single command to install all the necessary components, including the required PHP extensions for Zabbix.sudo apt install apache2 mysql-server php php-cli php-fpm php-mysql php-mbstring php-gd php-xml php-bcmath php-ldap -y
Secure Your MySQL Installation:
Once the installation is complete, it’s crucial to run the security script that comes with MySQL. This will help you set a root password, remove anonymous users, and enhance overall database security.sudo mysql_secure_installation
Follow the on-screen prompts. It’s highly recommended to set a strong root password and answer “yes” to the security questions.
Step 3: Create the Zabbix Database
Zabbix needs its own dedicated database and user to store monitoring data. We’ll now log into MySQL to create them.
Log into the MySQL shell as the root user:
sudo mysql -u root -p
Enter the root password you set in the previous step.
Inside the MySQL prompt, execute the following commands one by one. Remember to replace
'your-strong-password'
with a secure password of your own.CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your-strong-password'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost'; FLUSH PRIVILEGES; EXIT;
You have now successfully created a database named
zabbix
, a user also namedzabbix
, and granted it full permissions over its database.
Step 4: Install Zabbix Server and Frontend
Zabbix is not included in the default Ubuntu repositories, so we need to add the official Zabbix repository first.
Download and Install the Zabbix Repository Package:
Usewget
to download the repository configuration package for Ubuntu 22.04 and install it usingdpkg
.wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
Update Your Package List Again:
Now that the new repository is added, refresh your package list.sudo apt update
Install Zabbix Components:
Install the Zabbix server with MySQL support, the web frontend, and the Zabbix agent. The Zabbix Agent is a small client that can be installed on servers you want to monitor. It’s good practice to install it on the Zabbix server itself.sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y
Step 5: Import the Initial Zabbix Database Schema
The Zabbix installation package includes a default database schema. We need to import this into the database we created earlier. This process populates the database with the necessary tables and initial data.
Use the following command to import the schema. You will be prompted for the zabbix
user password you created in Step 3.
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
Step 6: Configure the Zabbix Server
Now, we need to tell the Zabbix server how to connect to our newly configured database.
Open the Zabbix server configuration file with a text editor like
nano
:sudo nano /etc/zabbix/zabbix_server.conf
Find the
DBPassword
parameter. Uncomment it (by removing the#
) and set its value to the password you created for thezabbix
database user.# Example from zabbix_server.conf ... ### Option: DBPassword # Database password. # Comment this line if no password is used. # # Mandatory: no # Default: DBPassword=your-strong-password ...
Save the file and exit the editor (press
Ctrl+X
, thenY
, thenEnter
in nano).
Step 7: Start and Enable Zabbix Services
With all the configuration in place, it’s time to start the Zabbix server, agent, and Apache web server. We’ll also enable them to start automatically on boot.
sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2
Step 8: Complete the Web-Based Installation
The final part of the setup is done through the Zabbix web interface.
Access the Zabbix Frontend:
Open your web browser and navigate to your server’s IP address or domain name, followed by/zabbix
.http://your_server_ip/zabbix
Welcome Screen: You should see the Zabbix welcome screen. Click Next step.
Check of Pre-requisites: The installer will check if all PHP requirements are met. Thanks to our installation in Step 2, all items should show “OK” in green. Click Next step.
Configure DB Connection: Enter the database details you configured in Step 3.
- Database type: MySQL
- Database host: localhost
- Database name: zabbix
- User: zabbix
- Password: The password you set for the
zabbix
user.
Click Next step.
Zabbix Server Details: You can leave the Host and Port as default. Give your server a name if you wish. Click Next step.
Pre-Installation Summary: Review the summary of your settings. If everything looks correct, click Next step.
Finish: Congratulations! The installation is complete. Click Finish. You will be redirected to the Zabbix login page.
Post-Installation Security and Login
You are now ready to log in and start monitoring.
- Default Username:
Admin
(case-sensitive) - Default Password:
zabbix
Actionable Security Tip: Your very first action after logging in should be to change the default administrator password. Navigate to Administration -> Users, select the Admin
user, and go to the “Password” tab to set a new, strong password.
Additionally, ensure your server’s firewall is configured correctly. You should allow traffic on the standard web ports and the Zabbix ports.
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS (if you set up SSL)
sudo ufw allow 10050/tcp # Zabbix Agent port
sudo ufw allow 10051/tcp # Zabbix Server port
sudo ufw enable
Conclusion
You have successfully deployed a powerful Zabbix monitoring server on Ubuntu 22.04. From here, you can begin exploring the vast capabilities of Zabbix—start by adding hosts to monitor, configuring items to collect data, and setting up triggers to alert you when things go wrong. Your journey to comprehensive and automated infrastructure monitoring has just begun.
Source: https://kifarunix.com/install-zabbix-server-on-ubuntu/