How to Set Up Zabbix 7 on Rocky Linux 8/9 or Red Hat Linux 8/9: A Comprehensive Guide

Learn how to set up Zabbix 7 on Rocky Linux 8/9 or Red Hat Linux 8/9 with this step-by-step comprehensive installation guide.

Zabbix 7 is the latest iteration of the powerful open-source monitoring platform designed to cater to the needs of modern IT operations. Whether you manage small-scale environments or enterprise-level infrastructures with thousands of hosts, Zabbix 7 brings a range of new features, enhanced scalability, and performance improvements to streamline your monitoring needs. For IT professionals implementing an on-premise monitoring solution, this guide provides step-by-step instructions to deploy Zabbix 7 on Rocky Linux 8/9 or Red Hat Linux 8/9, including configurations for high availability (HA) and disaster recovery (DR). With Zabbix 7, you can monitor 2,000-5,000 servers or even more while ensuring your setup is resilient and easy to maintain.

Set Up Zabbix 7


Why Choose Zabbix 7?

Key Features and Enhancements

  1. Improved Scalability: Zabbix 7 supports distributed monitoring with enhanced proxy management, making it easier to scale to thousands of monitored hosts.
  2. Enhanced Performance: Optimized backend processes and improved database handling ensure faster response times and reduced resource consumption.
  3. Ease of Operation: A more intuitive web interface, automated maintenance features, and better visualization tools simplify day-to-day operations.
  4. Native High Availability: Built-in support for HA eliminates the need for complex third-party setups, ensuring consistent uptime.
  5. Advanced Security: Enhanced encryption protocols and stricter authentication mechanisms provide better protection for your monitoring data.
  6. Support for Modern IT: Improved support for cloud-native environments, containers, and microservices ensures Zabbix remains relevant for modern infrastructure.

Benefits of Zabbix 7

  • Centralized Monitoring: Manage and monitor your entire IT infrastructure, including servers, network devices, applications, and cloud environments, from a single platform.
  • Cost-Effective: As an open-source solution, Zabbix eliminates licensing costs while offering enterprise-grade features.
  • Flexibility: Highly customizable with support for a wide range of templates, integrations, and scripting options.
  • Community and Support: Backed by a vibrant community and professional support options, Zabbix ensures you have help when needed.
See also  Configuring PHP-FPM for High Traffic Websites: Scaling Strategies

These enhancements and benefits make Zabbix 7 a superior choice compared to previous versions and other monitoring tools, especially for organizations prioritizing scalability, performance, and ease of operation.


Prerequisites

Before starting, ensure the following:

  1. Operating System: Rocky Linux 8/9 or Red Hat Linux 8/9 installed on your servers.
  2. Root Privileges: Root or sudo user access.
  3. Hardware Requirements:
    • Central Zabbix Server:
      • CPU: 8 cores (minimum) or 16 cores (recommended).
      • RAM: 32 GB (minimum) or 64 GB (recommended).
      • Disk Space: SSD with at least 500 GB (for database storage).
    • Database Server:
      • CPU: 16 cores (minimum) or 32 cores (recommended).
      • RAM: 64 GB (minimum) or 128 GB (recommended).
      • Disk Space: SSD with 1 TB or more.
    • Zabbix Proxies (optional for distributed monitoring):
      • CPU: 4 cores.
      • RAM: 8 GB.
      • Disk Space: 50 GB.
  4. Network Requirements:
    • Ensure connectivity between the Zabbix server, database, and agents.
    • Open required ports: 10050 (Zabbix Agent), 10051 (Zabbix Server).
  5. Database:
    • Use MySQL/MariaDB or PostgreSQL for the Zabbix database.
  6. Dependencies:
    • Apache or NGINX for the web interface.
    • PHP 7.4+.

Step 1: Update System Packages

Run the following commands to update your system:

sudo dnf update -y
sudo dnf upgrade -y

Reboot the system if necessary:

sudo reboot

Step 2: Configure Zabbix Repository

Add the Zabbix repository for your version of Rocky Linux or RHEL:

sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/8/x86_64/zabbix-release-7.0-1.el8.noarch.rpm
sudo dnf clean all

For Rocky Linux 9 or RHEL 9:

sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/9/x86_64/zabbix-release-7.0-1.el9.noarch.rpm
sudo dnf clean all

Step 3: Install Zabbix Server, Web Frontend, and Agent

Install the required components:

sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent

Step 4: Install and Configure Database

MariaDB Installation

Install MariaDB:

sudo dnf install mariadb-server -y

Enable and start the database service:

sudo systemctl enable mariadb
sudo systemctl start mariadb

Secure the database installation:

sudo mysql_secure_installation

Create the Zabbix database and user:

CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;

Import the initial schema:

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix

Step 5: Configure Zabbix Server

Edit the Zabbix server configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Set the database details:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

Save and close the file.

See also  How to Check the PHP Version on Linux

Start and enable the Zabbix server and agent services:

sudo systemctl enable zabbix-server zabbix-agent
sudo systemctl start zabbix-server zabbix-agent

Step 6: Configure Web Frontend

Edit the PHP configuration for Zabbix:

sudo nano /etc/php-fpm.d/zabbix.conf

Update the timezone:

php_value[date.timezone] = Asia/Singapore

Restart Apache:

sudo systemctl enable httpd
sudo systemctl restart httpd

Access the Zabbix web interface by navigating to http://<your-server-ip>/zabbix.


Step 7: Set Up High Availability (HA)

Database Replication

Configure MySQL or MariaDB Galera Cluster for database HA. Ensure you have three database nodes for redundancy.

Load Balancer

Deploy a load balancer (e.g., HAProxy or NGINX) to distribute traffic across multiple Zabbix frontend instances.

Application Failover

Use Pacemaker and Corosync to manage Zabbix server failover.


Step 8: Set Up Disaster Recovery (DR)

Backup Strategy

  • Database Backups: Use mysqldump or Percona XtraBackup for daily backups.
  • Configuration Backups: Automate the backup of /etc/zabbix/ and the frontend configuration.

DR Site

Deploy a secondary Zabbix instance at the DR site. Use database replication and periodically sync configurations.


Step 9: Add Zabbix Agents

Install Zabbix agents on monitored servers:

sudo dnf install zabbix-agent

Update the configuration file:

sudo nano /etc/zabbix/zabbix_agentd.conf

Set the server and hostname:

Server=<Zabbix-server-IP>
Hostname=<Host-name>

Start and enable the agent service:

sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent

Step 10: Basic Performance Tuning

Zabbix Server Tuning

  1. Increase the number of pollers in the server configuration file (/etc/zabbix/zabbix_server.conf):
    StartPollers=50
    
  2. Optimize housekeeper settings to prevent database overload:
    HousekeepingFrequency=1
    MaxHousekeeperDelete=5000
    

Database Tuning

  1. Configure MySQL/MariaDB for high traffic:
    • Add the following to /etc/my.cnf:
      innodb_buffer_pool_size=16G
      innodb_log_file_size=1G
      max_connections=2000
      
  2. Optimize query cache:
    query_cache_size=0
    query_cache_type=0
    
  3. Enable slow query logging for analysis:
    slow_query_log=1
    long_query_time=2
    

Zabbix Proxy Tuning

  1. Increase the cache size to handle more data:
    CacheSize=256M
    
  2. Adjust the StartPollers value based on load:
    StartPollers=10
    
  3. Use ProxyOfflineBuffer for offline buffering:
    ProxyOfflineBuffer=72
    

Network Tuning

  1. Increase the maximum number of open files:
    ulimit -n 65535
    
  2. Optimize kernel parameters for TCP connections:
    • Add the following to /etc/sysctl.conf:
      net.core.somaxconn = 1024
      net.ipv4.tcp_tw_reuse = 1
      net.ipv4.ip_local_port_range = 1024 65535
      net.ipv4.tcp_max_syn_backlog = 8192
      net.ipv4.tcp_fin_timeout = 15
      
    • Apply the changes:
      sudo sysctl -p
      

Step 11: Monitor and Scale

Use Zabbix proxies to distribute the load for environments with 2,000-5,000 servers. Scale the database and frontend components as needed.

See also  How to Check the PHP Version on Linux

Conclusion

Deploying Zabbix 7 on Rocky Linux 8/9 or Red Hat Linux 8/9 is a powerful solution for monitoring large-scale IT infrastructures. With its improved scalability, performance enhancements, and ease of operation, Zabbix 7 is ideal for organizations managing thousands of servers. By implementing high availability and disaster recovery strategies, you ensure continuous monitoring even during failures or outages. Its flexibility, advanced features, and cost-effectiveness make it an indispensable tool for IT operations professionals.

Take advantage of Zabbix 7’s new capabilities to streamline your monitoring processes, reduce downtime, and gain deeper insights into your IT environment. With basic performance tuning for the server, database, and proxies, your setup will efficiently handle high traffic and ensure seamless monitoring for thousands of devices. Whether you’re monitoring physical servers, virtual machines, or cloud-based systems, Zabbix 7 offers the reliability and scalability to keep your operations running smoothly.


Leave a Comment