Zabbix is a powerful open-source software that enables efficient monitoring of various IT components such as networks, servers, virtual machines, and cloud services. It provides real-time metrics on network utilization, CPU load, disk space consumption, and more. By monitoring these metrics, system administrators can ensure the health and performance of their IT infrastructure, as well as detect any potential issues with hardware or software components. In this tutorial, we will guide you through the step-by-step process of installing Zabbix 6 on Debian 11, enabling you to leverage its monitoring capabilities for your IT environment.
Prerequisites
Before we begin, make sure you have the following prerequisites in place:
- A server running Debian 11.
- Root access to the server.
Add Zabbix Repository
The Zabbix package is not included in the default Debian 11 repository. To install Zabbix, we need to add the official Zabbix repository to our server. Follow the steps below to add the repository:
- Download the Zabbix 6 repository package using the following command:
wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-1+debian11_all.deb
- Once the package is downloaded, install it using the following command:
dpkg -i zabbix-release_6.0-1+debian11_all.deb
This will add the Zabbix repository to the APT package manager.
Install Zabbix 6 Server
Now that we have added the Zabbix repository, we can proceed with the installation of the Zabbix 6 server. Follow the steps below to install the server and its required components:
- Update the repository cache by running the following command:
apt-get update -y
- Once the repository is updated, install the Zabbix 6 server and other required components using the following command:
apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent -y
This command installs the Zabbix server, frontend, Apache configuration, SQL scripts, and agent on the server.
- After the installation is complete, open the PHP configuration file using the following command:
nano /etc/php/7.4/apache2/php.ini
- Locate the line that sets the timezone and modify it to your desired timezone. For example, to set the timezone to UTC, change the line to:
date.timezone = UTC
Save and close the file.
Install and Configure MariaDB Database
To store the Zabbix monitoring data, we need to install the MariaDB database server. Follow the steps below to install and configure the database:
- Install the MariaDB database server by running the following command:
apt-get install mariadb-server -y
- Once the installation is complete, secure the MariaDB installation and set the root password by running the following command:
mariadb-secure-installation
This command will guide you through a series of prompts to secure the installation and set the root password. Follow the prompts and answer the questions accordingly.
- Log in to the MariaDB shell using the following command:
mysql -u root -p
- Once you are logged in, create a database and user for Zabbix by running the following commands:
CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin; GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'password';
Replace ‘password’ with a secure password of your choice.
- Flush the privileges and exit from the MariaDB shell by running the following commands:
FLUSH PRIVILEGES; EXIT;
This will ensure that the privileges are updated and the changes take effect.
Configure Zabbix Server
Now that the database is set up, we need to configure the Zabbix server to use the database. Follow the steps below to configure the server:
- Open the Zabbix server configuration file using the following command:
nano /etc/zabbix/zabbix_server.conf
- Locate the following lines in the file:
DBName=zabbix DBUser=zabbix DBPassword=password
Replace ‘password’ with the password you set for the Zabbix user in the previous step.
- Save and close the file.
- Import the Zabbix data into the database by running the following command:
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix
Enter the password for the Zabbix user when prompted.
- Restart and enable all the necessary services by running the following command:
systemctl restart apache2 systemctl enable zabbix-server zabbix-agent apache2 systemctl restart zabbix-server zabbix-agent
- Verify the status of the Zabbix server by running the following command:
systemctl status zabbix-server
You should see the status of the Zabbix server, indicating that it is active and running.
- To check the status of the Zabbix agent, run the following command:
systemctl status zabbix-agent
This will display the status of the Zabbix agent, indicating that it is active and running.
- Finally, verify the status of the Apache server by running the following command:
systemctl status apache2
The output should indicate that the Apache server is active and running.
Access Zabbix 6 Web Interface
Now that the Zabbix server is installed and configured, you can access the Zabbix web interface to start monitoring your IT environment. Follow the steps below to access the web interface:
- Open your web browser and enter the following URL:
http://your-server-ip/zabbix
Replace ‘your-server-ip’ with the IP address or hostname of your server.
- You will be presented with the Zabbix language selection page. Choose your preferred language and click on the “Next step” button.
- The next page will perform a set of prerequisite checks. If all checks pass successfully, click on the “Next step” button.
- On the database connection page, enter the database information you configured earlier (database name, user, and password). Click on the “Next step” button.
- The next page allows you to configure additional settings such as the Zabbix server name, timezone, and theme. Make the desired configurations and click on the “Next step” button.
- Review the installation summary on the next page and ensure that everything is correctly set up. Click on the “Next step” button to start the installation.
- Once the installation is complete, you will see a page confirming the successful installation. Click on the “Finish” button to finalize the installation.
- You will now be redirected to the Zabbix login page. Enter the default username as “Admin” and the password as “zabbix”. Click on the “Sign in” button to log in.
- After logging in, you will be greeted with the Zabbix dashboard, where you can begin configuring and monitoring your IT environment.
Conclusion
Congratulations! You have successfully installed Zabbix 6 on Debian 11, allowing you to monitor your IT infrastructure with ease. By leveraging the power of Zabbix, you can ensure the health and performance of your networks, servers, virtual machines, and cloud services. Make sure to install the Zabbix agent on your remote servers to enable comprehensive monitoring from the Zabbix dashboard.
If you’re looking for reliable cloud hosting solutions to complement your Zabbix monitoring setup, consider Shape.host’s Cloud VPS services. With Shape.host, you can enjoy efficient, scalable, and secure cloud hosting tailored to your specific needs. Visit Shape.host today to explore their hosting options and take your IT infrastructure to new heights.