Zabbix is a powerful open-source monitoring solution that helps you keep track of your network, servers, and applications. In this guide, we will walk you through the process of installing Zabbix on a Linux server. By the end, you’ll have a robust monitoring system to ensure the health and performance of your IT infrastructure.
Before we start, make sure you have the following prerequisites in place:
Ensure your system is up-to-date by running the following commands:
sudo apt update
sudo apt upgrade
Zabbix requires a web server, a database server, and PHP. Install the required packages with the following command:
sudo apt install apache2 mysql-server php php-mysql php-gd php-xml php-bcmath php-mbstring
During the MySQL installation, set a secure password for the root user.
Log in to the MySQL server:
sudo mysql -u root -p
Create a new database and user for Zabbix:
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
Exit the MySQL shell:
exit
Download the latest Zabbix release from the official website or use the following commands to download version 5.0 (replace with the latest version):
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+ubuntu20.04_all.deb
sudo dpkg -i zabbix-release_5.0-1+ubuntu20.04_all.deb
sudo apt update
Install Zabbix Server, Frontend, and Agent:
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent
Edit the Zabbix server configuration file:
sudo nano /etc/zabbix/zabbix_server.conf
Set the following parameters:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=your_password
Save and exit the editor.
Use the Zabbix database schema provided to create the necessary tables:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | sudo mysql -uzabbix -p zabbix
Edit the Zabbix PHP configuration file:
sudo nano /etc/zabbix/apache.conf
Locate the PHP settings section and set the correct timezone:
php_value date.timezone Europe/Riga
Save and exit the editor.
Start the Zabbix services and enable them to start on boot:
sudo systemctl start zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2
Open your web browser and navigate to http://your_server_ip/zabbix
. The default login credentials are:
Congratulations! You have successfully installed Zabbix. Begin monitoring your infrastructure by adding hosts and configuring triggers.
This guide provides a basic setup; for a production environment, consider additional security measures and optimizations based on your specific requirements.