The Zabbix Server is a powerful monitoring tool for inspecting the performance of computer systems and networks. It collects data from various devices and applications, analyzing trends through visualization.
The Zabbix server helps in preventing potential problems before they occur. Additionally, you can personalize the Zabbix server to meet your specific needs.
This post aims to demonstrate the process of installing the Zabbix server on the CentOS 9 Stream system.
How to Install Zabbix Server on Centos 9?
You must ensure the following packages are installed on your CentOS 9 system for the Zabbix server:
- How to Configure the Apache and PHP Modules on the CentOS 9 System?
- How to Configure MariaDB on the CentOS 9 System?
- How to Install Zabbix Server on Centos 9 System?
- How to Access the Zabbix Server Dashboard?
How to Configure the Apache and PHP Modules on the CentOS 9 System?
This section will demonstrate the complete process of configuring the Apache server and PHP modules on your CentOS 9 system.
Step 1: Update CentOS 9 System Files
Let’s initiate the installation process with the essential command, to update and refresh the CentOS 9 system files:
sudo dnf update
After you have refreshed and updated the system, proceed with installing packages, such as Apache, PHP, MariaDB, and Zabbix server.
Step 2: Install Apache and PHP
To smoothly run the Zabbix server, you need to install the Apache and PHP modules using the command:
sudo dnf install httpd php php-cli php-gd php-curl php-zip php-mbstring php-mysqlnd -y
The “Complete” on your terminal indicates that Apache, PHP, and its modules have been installed on your CentOS 9 Stream system.
Step 3: Enable the Apache Service on the Boot
To start on the boot, you need to enable the Apache Services through the command:
sudo systemctl enable httpd
The Apache services are now enabled on your CentOS 9 system.
Step 4: Start the Apache Service
Utilize this command to start the Apache server on your system:
sudo systemctl start httpd
Step 5: Verify the Active Status of Apache
Use the following command to display a detailed status report of the Apache service:
sudo systemctl status httpd
Verify that the Apache service is active on your CentOS 9 Stream system.
How to Configure MariaDB on the CentOS 9 System?
Here are essential steps to configure the MariaDB package on your CentOS 9 system.
Step 1: Install MariaDB
MariaDB package provides the necessary database backend that stores and manages all the configuration and monitoring data for the Zabbix server. Therefore, you are required to install the MariaDB package via the command:
sudo dnf install mariadb-server mariadb -y
As shown in the above screenshot, MariaDB has been successfully installed on your CentOS 9 Stream system.
Step 2: Enable the MariaDB Service
Upon installing the MariaDB package, run the provided command to enable it to start on boot:
sudo systemctl enable mariadb
This command ensures that the MariaDB service is always available and running on your CentOS 9 system.
Step 3: Start the MariaDB Service
Let, initiate the MariaDB service from the terminal using the command:
sudo systemctl start mariadb
The output with no content indicates that the MariaDB service has been started without encountering any error.
Step 4: Confirm the Active Status of MariaDB
Here is the command that can be used to confirm the active status of MariaDB services on your CentOS 9 Stream system:
sudo systemctl status mariadb
If you see the “active (running)” in the output, it indicates that the MariaDB package has been successfully configured on your CentOS 9 Stream system.
How to Install Zabbix Server on Centos 9 System?
Follow the provided procedural steps to set up the Zabbix server on your CentOS 9 Stream system.
Step 1: Add Zabbix Repository
To install the Zabbix server, first, add the Zabbix repository on your CentOS 9 system from the terminal:
sudo nano /etc/yum.repos.d/epel.repo
In the Zabbix repository file, add the following line of code, under the [epel] heading:
excludepkgs=zabbix*
Save the file after the necessary changes and close the file.
Step 2: Install and Configure Zabbix Repository
Next, configure the Zabbix repository through the below-given command:
sudo rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm
The above command has configured the Zabbix repository on your CentOS 9 system, successfully.
Step 3: Clean Files
After installing the Zabbix repository on your system, execute the command to clean the cache files:
sudo dnf clean all
This command is used to clean the local cache of downloaded packages and metadata in the DNF package manager on the CentOS 9 Stream system.
Step 4: Install Zabbix Server
Finally, you can install the Zabbix server packages on your CentOS system using the command:
sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
During the installation process, you can inspect the Zabbix server packages. These package files include the Zabbix server, web interface, Apache configuration, and MySQL scripts, on your CentOS 9 machine.
Step 5: Create the Zabbix Database
Once you have completed all the above steps, let’s create a Zabbix database with the following codes:
sudo mysql -uroot -p
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user 'zabbix'@'localhost' identified by 'your_password';
grant all privileges on zabbix.* to 'zabbix'@'localhost';
set global log_bin_trust_function_creators = 1;
quit;
After copying the above commands, you can close your MariaDB or MySQL command prompt.
Note: Use a strong password to protect your data.
Step 6: Initialize the Zabbix Database Schema
You can now use the command to initialize the Zabbix database schema for storing Zabbix monitoring data:
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Remember to enter the password you created for the Zabbix Database. (see the Step 5: Create the Zabbix Database)
Step 7: Configure Zabbix Server
Access the “zabbix_server.conf” file with the following command to further configure the Zabbix server on your CentOS 9 system:
sudo nano /etc/zabbix/zabbix_server.conf
Navigate the “DBUser=zabbix > DBPasswrod=” and specify your strong password:
DBPassword=your_password
Close the configuration file after saving the necessary changes.
Step 8: Start the Zabbix Server
Execute the command to restart the Zabbix server, Apache server, and PHP service:
systemctl restart zabbix-server zabbix-agent httpd php-fpm
Step 9: Enable the Zabbix Server
Utilize the following command to ensure the Zabbix server, Apache server, and PHP service start automatically on boot:
systemctl enable zabbix-server zabbix-agent httpd php-fpm
After executing this command, Zabbix and its associated services will always be available and running on your CentOS 9 system.
How to Access the Zabbix Server Dashboard?
You can access the graphical dashboard of the Zabbix server through the following steps.
Step 1: Access Zabbix Server via Localhost
You can use any web browser of your choice to access the Zabbix server. A new user must perform a few steps before accessing the Zabbix server dashboard:
- Copy the following URL to the address bar.
- Select the Language.
- Click on the “Next step” button.
http://localhost/zabbix
Step 2: Check of Zabbix Prerequisites
After checking of Zabbix prerequisites, proceed to the next step:
Step 3: Configure Zabbix Database Connection
Go through the given fields to configure the Zabbix database connection:
Step 4: Set the Zabbix Server Name and Timezone
Specify the Zabbix server name (i.e. putorius) and your timezone:
Review the configuration summary:
When you see the “Congratulations!” message on your screen, it indicates that the Zabbix server has been installed and configured on your system:
Step 5: Login to Zabbix Server Dashboard
Enter the username (i.e. Admin) and password for the Zabbix server dashboard:
Here you go! The Zabbix server dashboard is on your screen:
You have successfully performed each step to install the Zabbix server on the CentOS 9 Stream system.
Conclusion
On the CentOS 9 Stream system, the Zabbix server can be installed using a few commands. As a prerequisite, you must install Apache, PHP, and MariaDB/MySQL on your CentOS machine.
Then, use the command “sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent” to install the complete Zabbix server package. After updating the Zabbix configuration file, you can access the Zabbix server dashboard at “http://localhost/zabbix”.