FedoraRHEL Based

How To Install Zabbix on Fedora 40

Install Zabbix on Fedora 40

In today’s complex IT environments, monitoring the health and performance of your systems is crucial. Zabbix, an open-source monitoring solution, offers powerful features to keep track of your network, servers, and applications. This guide will walk you through the process of installing Zabbix on Fedora 40, providing you with a robust monitoring platform for your infrastructure.

Zabbix is a versatile, enterprise-class monitoring solution that can handle thousands of devices and metrics. It provides real-time monitoring, alerting, and visualization capabilities, making it an excellent choice for businesses of all sizes. Fedora 40, known for its stability and cutting-edge features, serves as an ideal platform for hosting Zabbix.

By the end of this guide, you’ll have a fully functional Zabbix installation on your Fedora 40 system, ready to monitor your IT infrastructure effectively.

Prerequisites

Before we begin the installation process, ensure that you have the following:

  • A Fedora 40 server with at least 2GB of RAM and 20GB of disk space
  • Root or sudo access to the server
  • Basic knowledge of Linux command-line operations
  • Familiarity with database management and web server configuration

It’s also recommended to have a clean, minimal installation of Fedora 40 to avoid potential conflicts with existing software.

Updating Fedora 40

Before installing Zabbix, it’s crucial to ensure your system is up-to-date. This step helps prevent compatibility issues and ensures you have the latest security patches.

Open a terminal and run the following command:

sudo dnf update -y

This command will update all installed packages to their latest versions. Once the update process is complete, reboot your system to apply any kernel updates:

sudo reboot

Installing Required Dependencies

Zabbix requires several components to function properly. We’ll start by installing the LAMP (Linux, Apache, MySQL, PHP) stack and additional necessary tools.

Run the following command to install the required packages:

sudo dnf install httpd mariadb-server php php-mysqlnd php-gd php-xml php-bcmath php-ldap php-mbstring -y

This command installs Apache web server, MariaDB (MySQL), PHP, and several PHP extensions required by Zabbix.

After the installation is complete, start and enable the Apache and MariaDB services:

sudo systemctl start httpd mariadb
sudo systemctl enable httpd mariadb

Adding Zabbix Repository

Zabbix is not available in the default Fedora repositories, so we need to add the official Zabbix repository. This ensures we get the latest version of Zabbix and can easily update it in the future.

To add the Zabbix repository, run the following command:

sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/8/x86_64/zabbix-release-latest.el8.noarch.rpm

This command downloads and installs the Zabbix repository configuration file. After adding the repository, update the package cache:

sudo dnf clean all
sudo dnf update

Installing Zabbix Components

Now that we have the Zabbix repository set up, we can install the Zabbix server, frontend, and agent components.

Run the following command to install Zabbix:

sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y

This command installs the Zabbix server with MySQL support, the web frontend, Apache configuration files, SQL scripts for database setup, and the Zabbix agent.

Configuring Database for Zabbix

Zabbix requires a database to store its configuration and collected data. We’ll use MariaDB for this purpose.

First, secure your MariaDB installation by running the following command and following the prompts:

sudo mysql_secure_installation

Next, log in to MariaDB as the root user:

sudo mysql -u root -p

Create a database and user for Zabbix by running the following SQL commands:

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';
FLUSH PRIVILEGES;
EXIT;

Replace ‘your_password‘ with a strong, unique password.

Now, import the initial schema and data into the Zabbix database:

sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Enter the password you set for the Zabbix user when prompted.

Configuring Zabbix Server

With the database set up, we need to configure the Zabbix server to use it. Edit the Zabbix server configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Find and modify the following lines, replacing ‘your_password’ with the password you set for the Zabbix database user:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=your_password

Save and close the file.

Configuring PHP for Zabbix Frontend

Zabbix frontend requires specific PHP settings. Edit the PHP configuration file:

sudo nano /etc/php.ini

Locate and modify the following settings:

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
date.timezone = Your/Timezone

Replace ‘Your/Timezone’ with your actual timezone (e.g., ‘America/New_York’). Save and close the file.

Configuring Web Server for Zabbix

Apache configuration for Zabbix is automatically installed, but we need to make a small adjustment. Edit the Zabbix Apache configuration file:

sudo nano /etc/httpd/conf.d/zabbix.conf

Uncomment the following line by removing the ‘#’ at the beginning:

php_value date.timezone Your/Timezone

Again, replace ‘Your/Timezone’ with your actual timezone. Save and close the file.

Starting and Enabling Zabbix Services

Now that we’ve configured all components, we can start and enable the Zabbix services:

sudo systemctl restart zabbix-server zabbix-agent httpd php-fpm
sudo systemctl enable zabbix-server zabbix-agent httpd php-fpm

These commands start the Zabbix server, agent, Apache web server, and PHP-FPM, and enable them to start automatically on system boot.

Configuring Firewall

To allow access to the Zabbix web interface and agent, we need to open the necessary ports in the firewall:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-port=10050/tcp --permanent
sudo firewall-cmd --add-port=10051/tcp --permanent
sudo firewall-cmd --reload

These commands open port 80 for HTTP, and ports 10050 and 10051 for Zabbix agent and server communication.

Completing Zabbix Web Installation

With all components installed and configured, we can now complete the Zabbix installation through the web interface. Open a web browser and navigate to:

http://your_server_ip/zabbix

Replace ‘your_server_ip‘ with your server’s actual IP address or domain name.

Follow the on-screen instructions to complete the installation:

  1. On the welcome screen, click “Next step”.
  2. Ensure all pre-requisites are met (all should be “OK”), then click “Next step”.
  3. Enter the database details you configured earlier, then click “Next step”.
  4. Enter a name for your Zabbix server, then click “Next step”.
  5. Review the installation summary, then click “Next step”.
  6. Click “Finish” to complete the installation.

You should now see the Zabbix login page. The default credentials are:

  • Username: Admin
  • Password: zabbix

Log in and immediately change the default password for security reasons.

Install Zabbix on Fedora 40

Basic Zabbix Configuration

Now that Zabbix is installed and running, you can start configuring it to monitor your systems. Here are some basic steps to get started:

  1. Add hosts: Go to Configuration > Hosts > Create host, and enter the details of the systems you want to monitor.
  2. Apply templates: Zabbix comes with pre-configured templates for various systems. Apply appropriate templates to your hosts for basic monitoring.
  3. Set up notifications: Configure email or other notification methods to alert you when issues are detected.

Remember to consult the official Zabbix documentation for detailed information on configuring and using Zabbix effectively.

Troubleshooting Common Issues

If you encounter issues during or after the installation, here are some common problems and their solutions:

  • Database connection errors: Double-check your database credentials in the Zabbix server configuration file.
  • Web interface not loading: Ensure Apache is running and the Zabbix configuration file is correctly set up.
  • Agent communication failures: Check firewall settings and ensure the agent is running on monitored hosts.

For more complex issues, consult the Zabbix forums or documentation for assistance.

Security Considerations

To enhance the security of your Zabbix installation:

  • Use strong, unique passwords for all accounts.
  • Regularly update Zabbix and all system components.
  • Consider using HTTPS for the web interface.
  • Implement network segmentation to isolate monitoring traffic.
  • Regularly audit user access and permissions.

Congratulations! You have successfully installed Zabbix. Thanks for using this tutorial for installing the Zabbix open-source monitoring software on your Fedora 40 system. For additional or useful information, we recommend you check the official Zabbix website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button