Zabbix is a powerful open-source monitoring tool designed to track the performance and availability of network devices, servers, and other IT infrastructure. In this guide, we’ll walk you through installing and configuring Zabbix Server and Client on Rocky Linux 9. Hosting your Zabbix monitoring system on a WindowsVPS ensures improved scalability and performance using a VPS server.

Step 1: Update Your VPS Server

Before installing Zabbix, ensure your VPS server is fully up to date by running the following commands:

sudo dnf update -y

By using a WindowsVPS, you ensure that Zabbix operates smoothly with dedicated resources such as CPU, memory, and storage, crucial for handling large-scale monitoring tasks.

Step 2: Install Apache, MariaDB, and PHP

Zabbix requires a web server, database, and PHP to function properly. Install the necessary components by running the following command:

sudo dnf install httpd mariadb-server php php-mysqlnd php-fpm -y

After installation, start and enable Apache and MariaDB to ensure they run at boot:


sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3: Secure MariaDB

It’s important to secure MariaDB before setting up Zabbix. Run the following command to configure basic security settings:

sudo mysql_secure_installation

Follow the prompts to set the root password and remove unnecessary defaults for security purposes.

Step 4: Add the Zabbix Repository

Zabbix provides official repositories for installation. Run the following command to add the Zabbix repository for Rocky Linux 9:


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

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

Now, install the Zabbix server, web frontend, and agent packages using the following command:

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

Step 6: Create a Database for Zabbix

Log in to MariaDB and create a database for Zabbix:

sudo mysql -u root -p

Run the following SQL commands to create the Zabbix database and user:


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;

Be sure to replace your_password with a secure password for the Zabbix user.

Step 7: Import the Initial Database Schema

Initialize the Zabbix database by importing the schema using the following command:

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

You will be prompted for the Zabbix user password that you set earlier.

Step 8: Configure Zabbix Server

Edit the Zabbix server configuration file to add your database details:

sudo nano /etc/zabbix/zabbix_server.conf

Update the following lines:


DBName=zabbix
DBUser=zabbix
DBPassword=your_password

Save the changes and exit the editor.

Step 9: Configure PHP for Zabbix

Next, edit the PHP configuration for Zabbix to set the correct timezone:

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

Set your desired timezone by adding the following line:

php_value[date.timezone] = Europe/London

Replace Europe/London with your appropriate timezone. Save and exit.

Step 10: Start Zabbix Server, Agent, and Related Services

Start the Zabbix server, agent, and web services and enable them to start on boot:


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

Step 11: Configure Firewall for Zabbix

If your firewall is enabled, you need to allow Zabbix traffic. Open the following ports:


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

Step 12: Complete Zabbix Installation via Web Interface

Open your browser and go to http://your-server-ip/zabbix to complete the installation through the web interface. Follow the on-screen instructions and enter the database credentials when prompted.

Once installation is complete, log in to the Zabbix frontend using the default credentials:

  • Username: Admin
  • Password: zabbix

Step 13: Install Zabbix Agent on Client Machines

To monitor additional machines, install the Zabbix agent on each client machine. Use the following commands on the client machines:


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

Edit the Zabbix agent configuration file:

sudo nano /etc/zabbix/zabbix_agentd.conf

Update the server address to point to your Zabbix server:


Server=your-zabbix-server-ip
ServerActive=your-zabbix-server-ip
Hostname=your-client-hostname

Start the Zabbix agent on the client machine:


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

Step 14: Optimize Your VPS Server for Zabbix

Running Zabbix on a WindowsVPS ensures your monitoring infrastructure has access to dedicated resources, enhancing performance and scalability. With a VPS server, you can monitor a large number of clients and devices, scaling as your monitoring needs grow. VPS solutions allow you to add resources such as CPU and memory on-demand, ensuring Zabbix runs smoothly under heavy loads.

Conclusion

By following this guide, you have successfully installed and configured Zabbix Server and Client on Rocky Linux 9. Zabbix is a robust monitoring solution that ensures your IT infrastructure remains healthy and efficient. Hosting your Zabbix setup on a WindowsVPS ensures optimal performance, scalability, and reliability for your monitoring system.

For more information about VPS hosting and optimizing your Zabbix installation, visit WindowsVPS today.

© 2024 WindowsVPS - All Rights Reserved

Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)