Configuring Zabbix step by step involves multiple stages, including installation, database setup, frontend configuration, and adding hosts. Below is a detailed guide:
Step 1: Install Required Packages
Before installing Zabbix, ensure your system is updated:
bashsudo apt update && sudo apt upgrade -y # For Debian/Ubuntu
sudo yum update -y # For RHEL/CentOS
Install required dependencies:
bashsudo apt install apache2 php php-mysql mariadb-server -y # Debian/Ubuntu
sudo yum install httpd php php-mysql mariadb-server -y # RHEL/CentOS
Step 2: Install Zabbix Server, Frontend, and Agent
For Debian/Ubuntu:
bashwget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb
sudo apt update
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y
For RHEL/CentOS:
bashrpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/$(rpm -E %{rhel})/x86_64/zabbix-release-6.0-1.el$(rpm -E %{rhel}).noarch.rpm
yum clean all
yum install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent -y
Step 3: Configure the Database
Start MariaDB
bashsudo systemctl start mariadb
sudo systemctl enable mariadb
Secure the Database
Run the following command to set a root password and remove unnecessary settings:
bashsudo mysql_secure_installation
Create the Zabbix Database
bashmysql -u root -p
Inside MySQL, run:
sqlCREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Import the Default Schema
bashzcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix
Step 4: Configure Zabbix Server
Edit the Zabbix configuration file:
bashsudo nano /etc/zabbix/zabbix_server.conf
Set the database credentials:
iniDBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword
Save and exit (CTRL+X
, then Y
and Enter
).
Restart and enable the Zabbix service:
bashsudo systemctl restart zabbix-server zabbix-agent
sudo systemctl enable zabbix-server zabbix-agent
Step 5: Configure Apache for Zabbix Frontend
Edit PHP settings:
bashsudo nano /etc/zabbix/apache.conf
Modify the timezone:
nginxCopyEditphp_value date.timezone Europe/London # Change to your timezone
Save and exit.
Restart Apache:
bashsudo systemctl restart apache2 # Debian/Ubuntu
sudo systemctl restart httpd # RHEL/CentOS
Step 6: Access Zabbix Web Interface
- Open a browser and navigate to: arduinoCopyEdit
http://<your-server-ip>/zabbix
- Follow the setup wizard:
- Check prerequisites.
- Enter database details.
- Configure the frontend.
- Confirm settings.
- Log in using: makefileCopyEdit
Username: Admin Password: zabbix
Step 7: Add a Host for Monitoring
- Go to Configuration → Hosts.
- Click Create Host.
- Enter the hostname and IP address of the monitored machine.
- Assign the appropriate Zabbix Agent template.
- Click Add.
Step 8: Install Zabbix Agent on Client Machines
For Debian/Ubuntu Clients
bashwget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb
sudo apt update
sudo apt install zabbix-agent -y
For RHEL/CentOS Clients
bashrpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/$(rpm -E %{rhel})/x86_64/zabbix-release-6.0-1.el$(rpm -E %{rhel}).noarch.rpm
yum clean all
yum install zabbix-agent -y
Configure Zabbix Agent
Edit the configuration file:
bashsudo nano /etc/zabbix/zabbix_agentd.conf
Set:
iniCopyEditServer=<Zabbix_Server_IP>
Restart the agent:
bashsudo systemctl restart zabbix-agent
sudo systemctl enable zabbix-agent
Step 9: Enable Auto Discovery (Optional)
- Go to Configuration → Discovery.
- Click Create Discovery Rule.
- Define:
- IP Range (e.g., 192.168.1.0/24)
- Check Type (Zabbix agent, SNMP, etc.)
- Add actions to automatically add hosts.
Step 10: Configure Email Alerts
- Go to Administration → Media Types.
- Select Email and configure SMTP.
- Add actions under Configuration → Actions to send alerts.
Step 11: Optimize Performance
- Tune database settings in
/etc/mysql/mariadb.conf.d/50-server.cnf
(or/etc/my.cnf
for RHEL). - Set up a proxy for distributed monitoring.
- Use Preprocessing Rules to reduce data storage.
Step 12: Monitor & Maintain
- Regularly check logs: bashCopyEdit
tail -f /var/log/zabbix/zabbix_server.log
- Update Zabbix: bashCopyEdit
sudo apt update && sudo apt upgrade -y # Debian/Ubuntu sudo yum update -y # RHEL/CentOS
- Backup Zabbix Database: bashCopyEdit
mysqldump -u root -p zabbix > /backup/zabbix_backup.sql