How to Install and Configure Zabbix 6.4 on Ubuntu 24.04
Introduction
Zabbix is a powerful, enterprise-class monitoring solution that provides real-time monitoring of servers, virtual machines, network devices, and cloud services. In this guide, we'll walk through the complete process of installing Zabbix 6.4 on Ubuntu 24.04 LTS, including the setup of all necessary components and initial configuration.
Prerequisites
Before we begin, ensure you have:
- A server running Ubuntu 24.04 LTS with root or sudo privileges
- Minimum 2GB RAM and 2 CPU cores
- At least 20GB of free disk space
- A stable internet connection
- Basic knowledge of Linux command line
Setting Up the LAMP Stack
First, we'll install and configure Apache, MySQL, and PHP, which form the foundation for Zabbix.
1. Update your system packages:
sudo apt update
sudo apt upgrade -y
2. Install Apache web server:
sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
3. Install MySQL server:
sudo apt install mysql-server -y
sudo systemctl enable mysql
sudo systemctl start mysql
4. Secure your MySQL installation:
sudo mysql_secure_installation
During this process, you'll be prompted to:
- Set up the validate password plugin
- Create a root password
- Remove anonymous users
- Disallow root login remotely
- Remove test database
- Reload privilege tables
5. Install PHP and required modules:
sudo apt install php php-mysql php-gd php-bcmath php-mbstring php-xml php-ldap php-json -y
Installing Zabbix Server
Now let's install the Zabbix server components.
1. Add the Zabbix repository:
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu24.04_all.deb
sudo apt update
2. Install Zabbix server, frontend, and agent:
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y
Configuring the Database
Let's set up the database for Zabbix.
1. Create a database and user:
sudo mysql -u root -p
2. Enter the following MySQL commands:
CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;
3. Import the initial schema and data:
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix
Configuring Zabbix Server
Now we'll configure the Zabbix server components.
1. Edit the Zabbix server configuration:
sudo nano /etc/zabbix/zabbix_server.conf
2. Update the following parameters:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=your_secure_password
3. Restart and enable Zabbix services:
sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent
Completing Web Interface Setup
Access the Zabbix web interface to complete the installation:
1. Open your web browser and navigate to:
http://your_server_ip/zabbix
2. Follow the setup wizard:
- Check prerequisites (all should be OK)
- Configure DB connection
- Configure Zabbix server details
- Review the summary
- Complete the installation
3. Log in with the default credentials:
- Username: Admin
- Password: zabbix
Best Practices & Optimization Tips
- Regularly update Zabbix and system packages
- Use strong passwords for both database and web interface
- Configure SSL/TLS for secure web access
- Implement regular database maintenance procedures
- Monitor Zabbix's own performance metrics
- Set up email notifications for critical alerts
- Configure proper log rotation
Troubleshooting Section
Common issues and their solutions:
1. Zabbix server fails to start:
sudo systemctl status zabbix-server
Check logs for specific errors:
sudo tail -f /var/log/zabbix/zabbix_server.log
2. Database connection issues:
- Verify database credentials in zabbix_server.conf
- Ensure MySQL is running:
sudo systemctl status mysql
- Check MySQL connectivity:
mysql -u zabbix -p -h localhost
3. PHP timezone warnings:
Edit PHP configuration:
sudo nano /etc/php/8.x/apache2/php.ini
Set your timezone:
date.timezone = Your/Timezone
Conclusion
You now have a fully functional Zabbix 6.4 monitoring system running on Ubuntu 24.04. Start by adding hosts to monitor, creating triggers, and configuring notifications according to your needs. Remember to regularly check for updates and maintain your monitoring system for optimal performance.
For more advanced configurations and detailed documentation, visit the official Zabbix documentation. Regular backups of both the database and configuration files will ensure you can quickly recover from any issues that may arise.