Home > Article > Operation and Maintenance > How to install and configure monitoring tools (such as Zabbix) on Linux
How to install and configure monitoring tools (such as Zabbix) on Linux
Overview:
Installing and configuring monitoring tools on Linux operating systems is an important step to ensure that servers and applications are running properly. This article will introduce how to install and configure a popular monitoring tool, Zabbix, on a Linux system. Zabbix is a powerful and flexible monitoring solution that helps administrators monitor server performance, network traffic, applications, and more.
Step 1: Install the necessary software packages
First, we need to install some necessary software packages in order to install and run Zabbix normally on the Linux system. Open a terminal and use the following commands to install the required packages.
sudo apt-get update sudo apt-get install apache2 mysql-server php php-mysql php-gd php-xml php-bcmath php-mbstring
Step 2: Create Zabbix database
Before installing Zabbix, we need to create a database to store monitoring data. Execute the following command to log in to MySQL.
sudo mysql -u root -p
After entering the password, you will enter the MySQL command line interface. Create a new database and user and grant permissions to the user.
CREATE DATABASE zabbix CHARACTER SET UTF8 COLLATE UTF8_BIN; CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Step 3: Download and Install Zabbix
Now we can start installing Zabbix. First, we need to download the latest Zabbix server software package from the Zabbix official website. Use the following command to download the package.
wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1%2Bbionic_all.deb
Next, we use the following command to install the package into the system.
sudo dpkg -i zabbix-release_4.4-1+bionic_all.deb sudo apt-get update sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
Step 4: Configure Zabbix Server
Zabbix Server stores monitoring data in the database created in the previous step. Open the Zabbix server configuration file and make necessary changes to it.
sudo nano /etc/zabbix/zabbix_server.conf
Find and edit the following lines.
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=password
Save and close the file.
Step 5: Import Zabbix database schema and data
In this step, we will import the Zabbix database schema and data. Log in to MySQL using the following command.
sudo mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql/create.sql.gz
Enter the password you set previously, and then execute the following command.
sudo zcat /usr/share/doc/zabbix-server-mysql/data.sql.gz | mysql -u zabbix -p zabbix
Step 6: Configure Zabbix front-end
Now, we need to do some configuration on Zabbix front-end. Open Apache's Zabbix configuration file.
sudo nano /etc/zabbix/apache.conf
Find the following lines and edit them.
php_value date.timezone Europe/Riga
Change the time zone to your own. Save and close the file.
Step 7: Start Zabbix service
Start Zabbix server and Zabbix agent through the following commands.
sudo systemctl start zabbix-server sudo systemctl enable zabbix-server sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent sudo systemctl restart apache2
Step 8: Access the Zabbix front-end
Enter the server’s IP address in the browser and add “/zabbix” to access the Zabbix front-end.
http://your_server_IP/zabbix
Use the default username "Admin" and password "zabbix" to log in.
Conclusion:
By following the steps above to install and configure Zabbix on your Linux operating system, you now have a powerful monitoring tool that can help you monitor the health of your servers and applications. You can further configure and customize Zabbix as needed. Start using Zabbix to monitor and optimize your system!
The above is the detailed content of How to install and configure monitoring tools (such as Zabbix) on Linux. For more information, please follow other related articles on the PHP Chinese website!