Install and Configure Zabbix Server on Ubuntu 24.04
Zabbix is a professional, open-source monitoring solution used by large organizations to track the performance, uptime, and security of networks, servers, and applications. Licensed under the GNU GPL, it is free, highly stable, and capable of scaling to manage thousands of devices across Linux, Windows, and Unix environments.
Key Benefits of Zabbix:
Cost-Effective & Open Source: Licensed under GNU GPL, it is free to deploy, modify, and tune to specific organizational needs.
Highly Scalable: Built for large-scale environments, it uses Proxy servers to efficiently monitor thousands of devices without performance loss.
Customizable & Extensible: Supports custom scripts and third-party integrations, allowing for a tailored monitoring experience.
High Availability: Supports Clustering, ensuring the monitoring service remains online even during hardware or software failures.
Advanced Alerting: Features a robust notification system that triggers automated actions or sends alerts via SMS, Email, and API integrations.
Strong Community Support: Backed by active development and a massive library of documentation, tutorials, and forums.
Let's get started. We’ll begin by configuring the dependencies needed for a Zabbix Server installation on Ubuntu 24.04.
2. PHP and required extensions
3. MariaDB database server
1. Ensure the system is updated
sudo apt update && sudo apt -y upgrade
Reboot if kernel updates were applied to the system.
[ -f /var/run/reboot-required ] && sudo reboot -f
2. Install PHP, Apache, and MariaDB
Install PHP and all modules of PHP required to run Zabbix monitoring server on Ubuntu.
sudo apt install php php-{snmp,cgi,mbstring,common,net-socket,gd,xml-util,mysql,bcmath,imap}
Install Apache web server that will serve Zabbix web pages.
sudo apt install apache2 libapache2-mod-php
Our database of choice in this article is MariaDB. Let’s install it.
sudo apt install mariadb-server
Validate installation by checking software versions installed.
$ php --version
PHP 8.3.6 (cli) (built: Apr 15 2024 19:21:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
$ mariadb -V
mariadb Ver 15.1 Distrib 10.11.7-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
$ apache2 -version
Server version: Apache/2.4.58 (Ubuntu)
Server built: 2024-04-18T15:13:41
3:.Add Zabbix APT repository
Zabbix provides repository for Debian and Red Hat based Linux systems. Since Ubuntu is Debian based Linux system we’re downloading .deb package file:
sudo apt install wget -y
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb
Install downloaded repository file:
sudo dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
4. Install and Configure Zabbix Server
Update repository packages list.
sudo apt update
We’ve configured repositories and ready to install Zabbix server packages. Run the commands below to do so.
sudo apt install vim zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Enable PHP CGI by executing the following commands in your terminal.
sudo a2enconf php8.*-cgi
Set correct timezone in your PHP configuration file.
$ sudo vim /etc/php/*/apache2/php.ini
; http://php.net/date.timezone
date.timezone = "Africa/Nairobi"
Reload apache for the changes to be applied.
sudo systemctl restart apache2
Confirm the status of your web service.
$ systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: active (running) since Sun 2024-05-05 16:27:59 UTC; 21s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 18965 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 18968 (apache2)
Tasks: 6 (limit: 2255)
Memory: 13.8M (peak: 14.0M)
CPU: 97ms
CGroup: /system.slice/apache2.service
├─18968 /usr/sbin/apache2 -k start
├─18970 /usr/sbin/apache2 -k start
├─18971 /usr/sbin/apache2 -k start
├─18972 /usr/sbin/apache2 -k start
├─18973 /usr/sbin/apache2 -k start
└─18974 /usr/sbin/apache2 -k start
May 05 16:27:59 noble systemd[1]: Starting apache2.service - The Apache HTTP Server...
May 05 16:27:59 noble systemd[1]: Started apache2.service - The Apache HTTP Server.
Login to MariaDB shell as root user.
sudo mysql -u root
Create a database and user for Zabbix:
CREATE DATABASE zabbix character set utf8 collate utf8_bin;;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'localhost' IDENTIFIED BY 'ZabbixDBPassw0rd';
FLUSH PRIVILEGES;
QUIT
Next, import data into the database created.
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p'ZabbixDBPassw0rd' zabbix
Edit your Zabbix server configuration and set database credentials:
$ sudo vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=ZabbixDBPassw0rd
Restart Zabbix server services using systemctl command.
sudo systemctl restart zabbix-server zabbix-agent
Don’t forget to enable services starting automatically on system boot.
sudo systemctl enable apache2 zabbix-server zabbix-agent
Services status can checked with the commands below.
systemctl status zabbix-server zabbix-agent
5. Configure Zabbix Server from Web UI
A congratulations message is shown if everything went as expected. Finish the installation to login.
Use the following default credentials to access Zabbix admin dashboard.
Username: Admin
Password: zabbix
Here is a screenshot of how the dashboard should look like.
6. Set strong Admin user password.
Go to Administration > Users > Admin > Password > Change Password as below.
Set a strong password for the admin user to better secure your Zabbix installation against attacks.
7. Adding monitoring agents to Zabbix Server
To add a new target host to be monitored by Zabbix, go to Configuration > Hosts, you should see the local Zabbix Server status enabled as below.
Host graphs and dashboards can be viewed by going to Monitoring > Hosts. Other hosts can be added by giving it a name and IP address. But remember to configure Zabbix Agent on the end device.
Closure:
This tutorial provides a step-by-step guide for installing Zabbix Server on Ubuntu 24.04. Key takeaways include:
Versatility: Zabbix is a highly capable and scalable solution, effectively serving both small businesses and large enterprises.
Single Server Setup: This specific installation is optimized for small-scale infrastructures where devices are located within the same Data Center (DC).
High Availability: While this guide covers a standalone setup, Zabbix supports Clustering for organizations requiring a highly available, redundant monitoring environment.
For Reference: Zabix
No comments:
Post a Comment