Learn how to install Zabbix Server on Rocky Linux 9 with our detailed step-by-step guide. Set up this powerful monitoring solution to keep track of your network, servers, and applications efficiently. #centlinux #linux #zabbix
Table of Contents
What is Zabbix?
Zabbix is an open-source software tool to monitor IT infrastructure such as networks, servers, virtual machines, and cloud services. Zabbix collects and displays basic metrics.
Zabbix is designed primarily as an IT infrastructure monitoring tool. New features are generally released every six months to major versions and every 1.5 years to LTS versions.
Released under the terms of GNU General Public License version 2, Zabbix is free software that does not require a license to use any of its features. Even though Zabbix is open-source software, it is a closed development software product, developed by Zabbix LLC based in Riga, Latvia.
Early in its history, Zabbix was described as simple to set up compared to other monitoring solutions. However, later it was considered by some to need a significant amount of manual configuration. As an open-source product however Zabbix focuses on the usage of existing tools and functionality as well as proprietary solutions to achieve a scalable monitoring solution. (Source: Wikipedia)
Zabbix Alternatives
Several alternatives to Zabbix offer robust monitoring solutions for network, server, and application management. Here are some popular Zabbix alternatives:
- Pros: Highly customizable, extensive plugin library, strong community support.
- Cons: Steeper learning curve, configuration can be complex.
- Pros: Excellent for time-series data, powerful querying language (PromQL), integrates well with Kubernetes.
- Cons: Requires additional tools for full-stack monitoring, steeper learning curve for complex queries.
- SolarWinds Network Performance Monitor (NPM)
- Pros: Comprehensive network monitoring, user-friendly interface, detailed reporting.
- Cons: Commercial product with associated costs, may be overkill for smaller networks.
- PRTG Network Monitor
- Pros: Easy to set up and use, all-in-one solution, includes alerts and reporting.
- Cons: Commercial product, limited free version.
- Pros: Flexible configuration, good for large environments, strong community and documentation.
- Cons: Initial setup can be complex, requires configuration management.
- Grafana with Prometheus
- Pros: Powerful visualization, excellent for monitoring time-series data, highly customizable.
- Cons: Requires separate setup and configuration, Prometheus knowledge needed.
- Pros: Auto-discovery of hosts and services, scalable, strong community version.
- Cons: Some features locked behind enterprise version, initial setup can be complex.
- Datadog
- Pros: Cloud-native, integrates with numerous services and applications, strong visualization and alerting.
- Cons: Commercial product, can become costly with scale.
- Sensu
- Pros: Scalable, supports monitoring as code, strong integration capabilities.
- Cons: Requires configuration and setup, commercial version for advanced features.
- Opsview
- Pros: Scalable, comprehensive features for enterprise environments, good integration with various technologies.
- Cons: Commercial product, can be costly for smaller setups.
Each of these alternatives has its own strengths and weaknesses, and the best choice depends on your specific requirements, such as the size of your environment, budget, and specific monitoring needs.
Recommended Online Training: Zabbix Server: Installing and Configuring from Scratch
Environment Specification:
We are using a minimal Rocky Linux 9 virtual machine with following specifications.
- CPU – 3.4 Ghz (2 cores)
- Memory – 2 GB
- Storage – 20 GB
- Operating System – Rocky Linux release 9.0 (Blue Onyx)
- Hostname – zabbix-01.centlinux.com
- IP Address – 192.168.116.131/24
Install Linux Software Updates
By using a ssh client, login to your Rocky Linux server as root user.
Set a FQDN (Fully Qualified Domain Name) for your network monitoring server by executing hostnamectl command.
# hostnamectl set-hostname zabbix-01.centlinux.com
Refresh your yum cache as follows.
# dnf makecache --refresh Rocky Linux 9 - BaseOS 335 kB/s | 1.7 MB 00:05 Rocky Linux 9 - AppStream 430 kB/s | 6.0 MB 00:14 Rocky Linux 9 - Extras 1.7 kB/s | 6.6 kB 00:03 Metadata cache created.
Execute the following dnf command to install Linux software updates.
# dnf update -y
If the above command installs software updates related to Linux Kernel, then you should reboot your operating system with latest Kernel.
# reboot
After successful reboot, check the versions of Linux operating system and Kernel.
# cat /etc/rocky-release Rocky Linux release 9.0 (Blue Onyx) # uname -r 5.14.0-70.22.1.el9_0.x86_64
Installing MariaDB Server
MariaDB 10.5 is available in standard yum repositories of Rocky Linux 9.0, which is supported by Zabbix 6.0.
Therefore, we are using MariaDB 10.5 in this server configuration guide. However, you can also install latest version of MariaDB Server.
# dnf install -y mariadb-server mariadb
Enable and start database Service.
# systemctl enable --now mariadb.service Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
Initialize database instance and set a password for super admin.
# mariadb-secure-installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] n ... skipping. You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Verify the database version as follows.
# mysql -V mysql Ver 15.1 Distrib 10.5.16-MariaDB, for Linux (x86_64) using EditLine wrapper
Install Zabbix Server on Rocky Linux 9
Zabbix official website provides the installation/configuration steps to install various available versions of Zabbix on your preferred platform.
You are only required to select your platform, Zabbix version, database and web server.
Although the version 6.2 of Zabbix is available, but we prefer to use a LTS (Long Term Support) version, therefore, we are installing Zabbix 6.0.
Use rpm command to install Zabbix 6.0 official yum repository.
# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm warning: /var/tmp/rpm-tmp.TnPIni: Header V4 RSA/SHA512 Signature, key ID 08efa7dd: NOKEY Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-6.0-4.el9 ################################# [100%]
Build yum cache for newly installed yum repositories.
# dnf makecache Rocky Linux 9 - BaseOS 323 kB/s | 1.7 MB 00:05 Rocky Linux 9 - AppStream 623 kB/s | 6.0 MB 00:09 Rocky Linux 9 - Extras 941 B/s | 6.6 kB 00:07 Zabbix Official Repository - x86_64 18 kB/s | 67 kB 00:03 Zabbix Official Repository (non-supported) - x8 353 B/s | 1.1 kB 00:03 Zabbix Official Repository (Agent2 Plugins) - x 393 B/s | 1.2 kB 00:03 Metadata cache created.
Install Zabbix server and relevant software packages by using dnf command.
# dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
Login to MariaDB by using mysql command and create a database to use as Zabbix back-end data store.
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 11 Server version: 10.5.16-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> create user zabbix@localhost identified by '123'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> quit; Bye
Zabbix software also shipped with a SQL script to create objects in it’s back-end data store.
You can use zcat command to unzip and forward the output to mysql command for immediate execution.
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix Enter password:
Edit Zabbix configuration file by using vim text editor.
# vi /etc/zabbix/zabbix_server.conf
Locate and set the following directive in this file.
DBPassword=123
Enable and start Zabbix server and agent along with Apache and PHP services.
# systemctl enable --now zabbix-server zabbix-agent httpd php-fpm Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service. Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /usr/lib/systemd/system/zabbix-agent.service. Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
Allow the http service in Linux Firewall.
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
Install Zabbix Dashboard
Open URL http://zabbix-01.centlinux.com/zabbix in a web browser.
It will show you the Zabbix Dashboard welcome page.
Select the default language and click on “Next Step” button.
The installer will perform prerequisite check and display the status of the check.
If you exactly follow the above steps then all the prerequisites will be ‘OK’.
Click on “Next Step” button.
Configure your database connection and press “Next Step” button.
Have a look at the Pre installation summary and click on “Next Step”.
Provide a name for your Network monitoring server click on “Next Step”.
Zabbix front-end installation has been completed. Press “Finish” button.
You have been redirected to Zabbix Web UI login. Login as default username/password i.e. Admin/zabbix.
After successful login, you will see the main dashboard of Zabbix frontend.
Final Thoughts
Congratulations on successfully learning how to install Zabbix server on Rocky Linux 9! With Zabbix up and running, you now have a robust monitoring solution to keep track of your network, servers, and applications. This setup will help you ensure optimal performance, quickly identify issues, and maintain a healthy IT infrastructure. Enjoy the benefits of proactive monitoring and efficient management. Happy monitoring! We recommend that you should read Zabbix 7 IT Infrastructure Monitoring Cookbook by Nathan Liefting and Brian van Baekel