Share your love
Install and Configure Zabbix on AlmaLinux 8
In this article, we want to teach you How To Install and Configure Zabbix on AlmaLinux 8.
Zabbix is the ultimate enterprise-level software designed for real-time monitoring of millions of metrics collected from tens of thousands of servers, virtual machines, and network devices.
It is Open Source and comes at no cost.
How To Install and Configure Zabbix on AlmaLinux 8
Before you start to install Zabbix on AlmaLinux 8, you need some requirements.
Requirements
First, you need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our article the Initial Server Setup with AlmaLinux 8.
Then, you need to have the LAMP stack installed on your server. To dot his, you can check our article How To Install LAMP stack on AlmaLinux 8.
When you are done with these requirements, you can start to set up Zabbix on AlmaLinux 8.
Set up Zabbix on AlmaLinux 8
At this point, you need to visit the Zabbix Downloads Page and check the latest LTS version.
Then, you need to use the following commands to add the Zabbix repository on AlmaLinux 8:
$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm $ sudo dnf clean all
Next, you can use the following command to install the Zabbix on your server:
sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
When your installation is completed, you need to create a Zabbix database and user.
Log in to your MariaDB console with the following command:
sudo mysql -u root -p
Next, from your MariaDB console run the following command to create a user, here we named it orca, you can choose your desired name. Remember to choose a strong password for your user.
CREATE USER orca@localhost IDENTIFIED BY 'password';
Create the database with the command below:
CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
Now grant all the privileges to the Zabbix database user:
GRANT ALL PRIVILEGES ON zabbixdb.* TO orca@localhost;
Flush the privileges and exit from your MariaDB console with the command below:
FLUSH PRIVILEGES; EXIT;
Here you need to import the database schema with the following command:
sudo zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u orca -p zabbixdb
You will be asked to enter your Zabbix user password.
Now you need to edit the Zabbix configuration file on AlmaLinux 8.
Open the file with your favorite text editor, here we use vi:
sudo vi /etc/zabbix/zabbix_server.conf
Find the line below and change them to your database settings:
DBHost=localhost DBName=zabbixdb DBUser=orca DBPassword=password
You need to uncomment the DBHost and DBPassword lines by removing the “#” from the beginning of the lines.
When you are done, save and close the file.
Configure PHP-FPM on AlmaLinux 8
At this point, you need to make some configuration changes for the PHP-FPM service.
Open the file with the following command:
sudo vi /etc/php-fpm.d/www.conf
Find the lines below and make sure that they are like as shown below:
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
When you are done, save and close the file.
Now you need to specify the timezone setting in the Zabbix configuration on AlmaLinux 8. To do this, run the command below:
sudo vi /etc/php-fpm.d/zabbix.conf
Find the line below and uncomment it by removing the “;” from the begging of the line and adding your timezone:
php_value[date.timezone] = America/New_York
When you are done, save and close the file.
Restart all the services to apply the changes:
sudo systemctl restart zabbix-server zabbix-agent httpd php-fpm
To enable the services to start on boot, run the following command:
sudo systemctl enable zabbix-server zabbix-agent php-fpm
Configure SELinux and Firewall on AlmaLinux 8
At this point, you need to set SELinux to be allowed in order to access the Zabbix frontend on AlmaLinux 8. To do this, run the following command:
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
Then, you need to allow traffic on ports 10050 and 10051 through the AlmaLinux firewall with the command below:
sudo firewall-cmd --add-port={10050,10051}/tcp --permanent
Reload the firewall to apply the changes:
sudo firewall-cmd --reload
Access Zabbix Web Interface
Here you access the Zabbix web interface on AlmaLinux 8 by typing your server’s IP address in your web browser followed by /Zabbix:
http://server-ip/zabbix
You will see the Zabbix welcome page just click on the next step.
In the next window, you will see the check for the pre-requisites. Make sure all the required PHP extensions are installed then click on the Next step button.
Then, you will see the configure DB connection page. Set your database details and click on the next step.
Set your Zabbix server details and press the next step.
At this point, check the Zabbix pre-installation summary and click on the next step.
When your installation is completed, you will see the following page.
Now click on the finish button and you will see the Zabbix login screen. Enter the Admin as a username and Zabbix as a password and click on the sign-in button.
You will see your Zabbix dashboard.
Conclusion
At this point, you learn to set up and configure Zabbix on AlmaLinux 8.
Hope you enjoy using it.