Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing Zabbix 5.0 LTS on CentOS 7

Tech May 12 2

Environment Specifications

  • Operating System: CentOS 7.8
  • Database: MariaDB or MySQL 5.7+
  • Web Language: PHP 7.2+

Basic Hardware Requirements

Deployment Size Platform CPU / RAM Database Storage Monitored Hosts
Small CentOS Virtual Appliance MySQL InnoDB Up to 100
Medium CentOS 2 Cores / 2 GB MySQL InnoDB Up to 500
Large RHEL 4 Cores / 8 GB RAID10 MySQL/PostgreSQL 1000+
Very Large RHEL 8 Cores / 16 GB Fast RAID10 MySQL/PostgreSQL 10000+

System Preparation

To begin, disable SELinux and the system firewall, then reboot.

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
shutdown -r now

Adding the Package Repository

Add the Zabbix repository. To mitigate slow network speeds, use a mirror like Alibaba Cloudd.

rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Update the repository configuration file to use the mirror URL.

sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#g' /etc/yum.repos.d/zabbix.repo
yum clean all
yum makecache

Package Installation

Install the core Zabbix server and agent components.

yum install -y zabbix-server-mysql zabbix-agent

Since Zabbix 5.0 requires a newer PHP version, install the Software Collections (SCL) repository to access it.

yum install -y centos-release-scl

Enable the Zabbix frontend repository by editing /etc/yum.repos.d/zabbix.repo. Locate the [zabbix-frontend] section and change the enabled value from 0 to 1. Then, install the web frontend packages.

yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl

Install the MariaDB database server.

yum install -y mariadb-server

Database Configuration

Start the MariaDB service and enable it to launch on system boot.

systemctl start mariadb
systemctl enable mariadb

Secure the database installation by setting a root password. Follow the interactive prompts.

mysql_secure_installation

Log into the MySQL shell as the root user and create the Zabbix database and a dedicated user.

mysql -u root -p
CREATE DATABASE zbx_db CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zbx_user'@'localhost' IDENTIFIED BY 'YourSecurePassword123';
GRANT ALL PRIVILEGES ON zbx_db.* TO 'zbx_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Import the initial Zabbix database schema and data.

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzbx_user -pYourSecurePassword123 zbx_db

Service Configuration

Configure the Zabbix server to use the correct database password. Edit /etc/zabbix/zabbix_server.conf.

# Find and modify the DBPassword line
DBPassword=YourSecurePassword123

Set the correct PHP timezone for the web frontend. Edit /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf.

php_value[date.timezone] = Asia/Shanghai

Starting Services

Restart all necessary services and enable them to start automatically.

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

Web Interface Setup

The Zabbix web interface is now accessible via a browser at http://<your-server-ip>/zabbix. Follow the on-screen setup wizard.

  1. Verify that all pre-requisites are met on the initial check page.
  2. Enter the database connection details:
    • Database Type: MySQL
    • Database Host: localhost
    • Database Port: 3306
    • Database Name: zbx_db
    • User: zbx_user
    • Password: YourSecurePassword123
  3. Configure the server details (name, port).
  4. Review the installation summary and complete the setup.
  5. Log in to the Zabbix frontend using the default credentials:
    • Username: Admin
    • Password: zabbix

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.