Proper monitoring is an essential ingredient for the effective management of your overall IT infrastructure. A robust real-time monitoring solution provides detailed visibility of your network and application performance.
It helps to identify actual moments when errors and incidents occur and sends alerts. By doing so, operation teams can take intervention measures in a timely fashion and ensure business continuity in the shortest time possible.
This helps you make the most of your IT resources and, in turn, maximize your revenue. As such, one cannot undermine the importance of investing in an efficient and reliable monitoring tool.
Zabbix is a free and open-source enterprise-grade monitoring tool that is used for monitoring your entire IT infrastructure. It can monitor anything including network devices, servers (cloud and on-premise) applications, databases, and even docker containers. It also detects errors and sends alerts to enable prompt action by IT teams to resolve the problem.
In this guide, we will focus on the installation of the Zabbix monitoring tool on Rocky Linux / AlmaLinux. At the time of writing this guide, the latest version of Zabbix is Zabbix 6.0 pre-release.
Prerequisites
For this guide, this is what you need to have:
- An instance of Rocky Linux with SSH access.
- An instance of Alma Linux with SSH access.
- A sudo user configured for performing privileged tasks.
Step 1: Install LAMP in Rocky/Alma Linux
Zabbix is a monitoring application that is driven by PHP on the frontend and Java & C in the backend. It also requires a relational database to collect and store its data. As such we need to install a hosting stack on which we will install Zabbix.
LAMP, short for Linux, Apache, MariaDB/MySQL, and PHP is a big household name in developer circles. It comprises the Apache webserver, MariaDB or MySQL (relational databases), and PHP which is a server-side scripting engine.
Installing Apache in Rocky/Alma Linux
We will start off by installing the Apache webserver. To do so, execute the command:
$ sudo dnf install @httpd
Once installed, start Apache and enable it to run on system startup.
$ sudo systemctl start httpd $ sudo systemctl enable httpd
To verify that Apache is running, execute the command:
$ sudo systemctl status httpd
The output confirms that Apache is installed and running as expected.
Installing MariaDB in Rocky/Alma Linux
As mentioned earlier, Zabbix requires a relational database to store all of its data. We have chosen to install MariaDB given its reliability and numerous security and performance enhancements it provides.
The latest version of Zabbix requires MariaDB version 10.5 to function as expected. To get started, you need to enable the MariaDB YUM repository.
So, create a repository file:
$ sudo vim /etc/yum.repos.d/mariadb.repo
Paste the following lines.
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.5/rhel8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 module_hotfixes=1
Save the changes and exit the configuration file.
Next, import the MariaDB GPG signing key:
$ sudo --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Finally, to install the MariaDB server and client, run the command:
$ sudo dnf install MariaDB-server MariaDB-client
When the installation is complete, start the MariaDB server and enable it so that it starts automatically on boot.
$ sudo systemctl start mariadb $ sudo systemctl enable mariadb
Confirm that the database server is running:
$ sudo systemctl status mariadb
To confirm the version of MariaDB installed, run the command:
$ mysql -V
Alternatively, you can log in to the database server as follows.
$ sudo mysql -u root -p
The version of MariaDB will be printed on the welcome message.
Typically, MariaDB’s settings are not configured to the required security recommendations. Thankfully, MariaDB provides the mysql_secure_installation script for enhancing the security of the database server.
So, execute the script as shown.
$ sudo mysql_secure_installation
You will be required to perform a list of tasks. First, switch to the UNIX socket authentication plugin.
For the remaining prompts, type 'Y'
and hit ENTER. This allows you to remove anonymous users, disallow remote users from logging in as root and remove the test database which can be exploited by hackers. Then finally reload privilege tables to save changes.
The UNIX_socket authentication plugin allows the root user to log in to the database server without a password. To enable MariaDB password authentication, log in to MariaDB:
$ sudo mysql -u root -p
Then set the root password as follows.
set password = password("<strong>yourpassword</strong>");
To switch from UNIX socket authentication to mysql_native_password authentication, run the command
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("<strong>yourpassword</strong>");
Now every time you login back in, you will be required to provide a password.
Installing PHP in Rocky/Alma Linux
The last component of the LAMP stack to install is PHP. This is provided in the default AppStream repositories. You can verify this as follows:
$ sudo dnf module list PHP
By default, PHP 7.2 is enabled by default. We need to change this to PHP 7.4.
$ sudo dnf module reset php $ sudo dnf module install php:7.4
Next, install the required PHP modules for Zabbix installation.
$ sudo dnf install php php-curl php-fpm php-mysqlnd
To check the version of PHP, run.
$ php -v
We have installed PHP-FPM (FastCGI Process Manager) service which is a popular alternative implementation of PHP FastCGI.
Start and enable it on boot time.
$ sudo systemctl start php-fpm $ sudo systemctl enable php-fpm
Then verify its status.
$ sudo systemctl status php-fpm
At this point, we have successfully installed the LAMP stack. In subsequent steps, will delve into the installation of Zabbix.
Step 2: Install Zabbix in Rocky/Alma Linux
With the LAMP stack in place, Let’s now install Zabbix by installing the Zabbix repository.
$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.5/rhel/8/x86_64/zabbix-release-5.5-1.el8.noarch.rpm
Once the repository is installed, install the Zabbix server, Zabbix agent, and the associated Zabbix packages as follows.
$ sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
When the installation is complete, you need to create a Zabbix database and a database user that Zabbix will use to access the database.
$ sudo mysql -u root -p CREATE USER zabbix_user@localhost IDENTIFIED BY '<strong>P@ssword321</strong>';
Then grant permissions to the database user to execute all tasks on the database.
GRANT ALL PRIVILEGES ON zabbix_db.* TO zabbix_user@localhost;
Then effect the changes and exit the database server
FLUSH PRIVILEGES; EXIT;
Next, import the database schema:
$ sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -u zabbix_user -p zabbix_db
When prompted for a password, provide the Zabbix user’s password and not the root account’s password.
Additionally, edit the Zabbix configuration file
$ sudo vim /etc/zabbix/zabbix_server.conf
Ensure that the DBName, DBUser, DBPassword values reflect the values you provided for your database
DBHost=localhost DBName=zabbix_db DBUser=zabbix_user DBPassword=P@ssword321
Save the changes and exit the configuration file.
Step 3: Configure PHP-FPM in Rocky/Alma Linux
Next, some additional configuration is needed for the PHP-FPM service. Edit the www.conf configuration file.
$ sudo vim /etc/php-fpm.d/www.conf
Ensure that the following lines appear as they are.
listen = /run/php-fpm/www.sock user = apache group = apache listen.allowed_clients = 0.0.0.0 listen.owner = apache listen.group = apache listen.mode = 0660 pm = dynamic
Save the changes and exit the file.
Additionally, specify the timezone setting in the Zabbix.conf configuration file.
$ sudo vim /etc/php-fpm.d/zabbix.conf
Add the line shown.
php_value[date.timezone] = Africa/Nairobi
Save and exit.
To apply all the changes made, restart all the services as shown
$ sudo systemctl restart zabbix-server zabbix-agent httpd php-fpm
Additionally, consider enabling them on startup.
$ sudo systemctl enable zabbix-server zabbix-agent httpd php-fpm
Step 4: Configure SELinux & Firewall in Rocky/Alma Linux
You need to set SELinux to permissive in order to access the frontend from a browser. To do that, run the command:
$ sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
Next, head over to the firewall and allow HTTP service along with ports 10050 and 10051 which Zabbix server and agent listen on.
$ sudo firewall-cmd --add-port=80/tcp --permanent $ sudo firewall-cmd --add-port={10050,10051}/tcp --permanent $ sudo firewall-cmd --reload
Step 5: Complete Zabbix Installation in Rocky/Alma Linux
Lastly, launch your browser, and go to the URL shown
http://server-ip/zabbix
The first page that greets you is the Zabbix welcome page that boldly displays the version you are installing. Select the installation language and click on the ‘Next step’ button.
In the list of prerequisites, scroll all the way down and ensure all the prerequisites get the ‘OK’ label in the last column. It’s mandatory that all the requirements are satisfied. Then hit the ‘Next step’ button.
On the ‘Configure DB Connection’ page. Fill out your database details. For the database port, leave it at 0. The press ‘Next step’.
Then specify your server’s name, confirm your time zone and feel free to select your preferred theme. Then press ‘Next step’.
Confirm all the settings and if all looks well, press on ‘Next step’ to finalize the installation.
If all the settings you provided are correct, you will get a congratulatory message notifying you of the successful setup of Zabbix’s front end. Press on the ‘Finish’ button.
This directs you to the Zabbix login page. Log in with the following credentials:
Admin: Admin Password: zabbix
Then click on ‘Sign in’ to access the Zabbix dashboard. You can change the password later for added security, so don’t worry about that.
Finally, you will get access to Zabbix’s dashboard.
And there you have it. We have successfully installed the Zabbix monitoring tool on Rocky Linux / AlmaLinux.
The above is the detailed content of How to Install Zabbix on Rocky Linux and AlmaLinux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

Built on Chrome’s V8 engine, Node.JS is an open-source, event-driven JavaScript runtime environment crafted for building scalable applications and backend APIs. NodeJS is known for being lightweight and efficient due to its non-blocking I/O model and

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

Linuxcanrunonmodesthardwarewithspecificminimumrequirements.A1GHzprocessor(x86orx86_64)isneeded,withadual-coreCPUrecommended.RAMshouldbeatleast512MBforcommand-lineuseor2GBfordesktopenvironments.Diskspacerequiresaminimumof5–10GB,though25GBisbetterforad

Written in C, MySQL is an open-source, cross-platform, and one of the most widely used Relational Database Management Systems (RDMS). It’s an integral part of the LAMP stack and is a popular database management system in web hosting, data analytics,

Ubuntu has long stood as a bastion of accessibility, polish, and power in the Linux ecosystem. With the arrival of Ubuntu 25.04, codenamed “Plucky Puffin”, Canonical has once again demonstrated its commitment to delivering a

MongoDB is a high-performance, highly scalable document-oriented NoSQL database built to manage heavy traffic and vast amounts of data. Unlike traditional SQL databases that store data in rows and columns within tables, MongoDB structures data in a J
