How to Install Zabbix on Ubuntu and Debian
Installing Zabbix on Ubuntu or Debian systems allows you to leverage powerful monitoring features to track system health, application performance, and network metrics. This guide will walk you through the steps to install and configure Zabbix on these distributions.
1. Update System Packages
Start by updating your system to ensure that all existing packages are up-to-date.
2. Install the Required Dependencies
Zabbix relies on certain software components, including a web server, PHP, and a database. For this setup, we’ll use Apache and MySQL.
Install Apache, MySQL, and PHP
3. Set Up the Database for Zabbix
Zabbix requires a database to store monitoring data. We’ll create a MySQL database and user specifically for Zabbix.
Step 1: Log into MySQL
Step 2: Create the Zabbix Database and User
Execute the following commands to create a database and user with permissions:
4. Install Zabbix Server, Frontend, and Agent
Add the Zabbix repository, then install the server, frontend, and agent packages.
Step 1: Add the Zabbix Repository
Step 2: Install Zabbix Server and Agent
5. Import the Initial Schema
The next step is to import the default schema to set up Zabbix’s database structure.
Enter the password for the zabbixuser database user when prompted.
6. Configure the Zabbix Server
Update the Zabbix server configuration file to connect it to the MySQL database.
Edit Zabbix Configuration
Update the following parameters with your database details:
Save and exit the file.
7. Configure PHP for Zabbix Frontend
Edit the PHP configuration file for Apache to meet Zabbix’s requirements.
Update the php_value date.timezone line with your time zone, for example:
Save and close the file.
8. Start and Enable Zabbix Server and Agent
Start the Zabbix server and agent, and enable them to start at boot.
9. Access the Zabbix Web Interface
With Zabbix installed and configured, you can now access the web interface.
- Open a web browser and navigate to http://your-server-ip/zabbix.
- Follow the installation wizard:
- On the “Welcome” page, click Next.
- Check for any missing PHP parameters and continue.
- Enter the database details you configured in zabbix_server.conf.
- Complete the setup and login using the default credentials:
- Username: Admin
- Password: zabbix
For security, change the default admin password after logging in.
10. Adding Hosts and Monitoring
Once logged in, you can start adding hosts (servers, network devices, etc.) and configuring monitoring:
- Go to Configuration > Hosts and click Create Host to add devices you want to monitor.
- Apply templates for standard monitoring items like CPU usage, memory usage, and network traffic.
- Configure triggers to receive alerts based on specific conditions (e.g., high CPU usage).
11. Setting Up Notifications (Optional)
Zabbix allows you to set up email, SMS, and webhook notifications for alerts. To configure this:
- Go to Administration > Media types.
- Select or add a notification method.
- Assign the media type to a user under Administration > Users.
Conclusion
Installing Zabbix on Ubuntu or Debian enables powerful, scalable monitoring for your infrastructure. With this setup, you’ll be able to monitor system health, configure alerts, and visualize data to maintain a stable and optimized environment.