Installing Zabbix 6.0 on Ubuntu, CentOS, and Debian
15:04, 04.11.2022
Zabbix is a free status tracking system for various computer network services, servers, and network equipment. The creator of this product is Alexei Vladyshev, and Zabbix LLC is currently engaged in its development. Data storage within this system is possible on the basis of MySQL, PostgreSQL, SQLite, or Oracle Database. Later in the article, we will tell you more about Zabbix, as well as provide a detailed guide on installation and configuration.
What is the Zabbix system and what is it for?
This monitoring system allows you to monitor the status in three directions:
- Simple checks — checks the availability and responses of standard services, such as SMTP or HTTP. At the same time, it is not necessary to install any additional software on the monitored host.
- Zabbix agent — installed on any UNIX-like or Windows hosts, collects information about the CPU load, network usage, disk space, etc.
- External check — execution of external programs, monitoring via SNMP is also supported.
At the same time, this system has a lot of different features, starting with centralized monitoring of logs, and ending with the ability to create network maps. Its basic and most significant functions include:
- monitoring the load on the server hardware;
- monitoring the activity of the server drive (HDD, SSD or NVMe);
- pinging nodes in the network in order to check availability;
- collecting data about RAM – to specifically understand how many free resources are available;
- tracking network activity.
Zabbix is good because it has an awe-inspiring arsenal of various tools and metrics that allow you to evaluate both the workload of the kernel, the waiting time for resources (CPU iowait time), and even the volume of the swap system (Total swap space). This is a universal system that allows you to analyze the status and performance of server equipment and network devices.
Installing Zabbix Agent in Ubuntu, Debian
Zabbix is distributed for free, so you can safely go to the official website of the developer and download the installer with the most up-to-date version of the software for your OS. It is not necessary to do this, since you can also get Zabbix from official repositories. Next, we will tell you how to install the agent on Ubuntu and Debian.
So, first of all, download the deb package with the version we are interested in from the official repository:
For Ubuntu: wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb For Debian: wget https://repo.zabbix.com/zabbix/5.5/debian/pool/main/z/zabbix-release/zabbix-release_5.5-1+debian11.tar.gz
Next, install the deb package:
On Ubuntu: sudo dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb On Debian: dpkg -i zabbix-release_5.5-1+debian11.tar.gz
After executing one of these commands, you will see a message about the completion of unpacking the software. Update the repositories:
sudo apt update
Now we can install Zabbix on Ubuntu:
For version 6.0 LTS: sudo apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent For version 5.4 and higher: apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent For version 5.0 and 5.2: apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent
Of course, it is best to install 6.0 LTS, since it is the latest and has several new features that are not available in previous versions. There is also Zabbix 6.2, but it has a shorter support cycle – until January 2023. At the same time, Zabbix 6.0 LTS will be supported until February 2027.
The guide for Debian 11 is exactly the same as on Ubuntu 20.04, so go ahead.
Installing Zabbix Server in CentOS
We do about the same thing. Adding a repository:
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Install Zabbix server and add MySQL support:
yum install zabbix-server-mysql zabbix-web-mysql zabbix-get
And that's it, you can proceed to the setup.
General Zabbix Server Settings
First of all, we log in to the MySQL database by entering the root password:
mysql -u root -p
And then we create a database for Zabbix:
create database name;
Only instead of "name", we enter something of our own. Then we proceed to creating a database user:
create user 'zabbix_user'@'localhost' identified BY 'zabbix_ password';
Here, accordingly, the command also needs to be adapted by entering its own data instead of 'zabbix_user' and 'zabbix_parole'.
The next step is to add privileges for the new user:
grant all privileges on zabbix_name.* to zabbix_user@localhost;
And apply the new rights:
flush privileges;
After that, you can safely close the DB console:
quit;
Next, import the Zabbix database:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -zabbix_user -p zabbix_name
We confirm the action by entering the root password from the new database we set a little earlier.
Now go directly to the configuration file, which is located in the directory:
nano /etc/zabbix/zabbix_server.conf
Here we set the parameters set earlier:
DBName=zabbix_name DBUser=zabbix_user DBPassword=zabbix_parole
Then save and close the file. This completes the database setup for the Zabbix server.
How to set up PHP for Zabbix
This is done in three steps:
Open the Apache configuration file in edit mode, located at the path /etc/apache2/conf.d/zabbix. The file contains PHP settings, they are already set, you just need to uncomment the following line and add your time zone: php_value date.timezone Europe/Kyiv.
Save and close the config.
This completes the PHP setup for Zabbix. Additionally, here you can change a number of other parameters, such as the script execution time, the maximum amount of RAM for each script, the size of files allowed for uploading to the server, etc. It is unnecessary to do this, by default, the specified parameters will work in most cases.
Configuring the Zabbix 6.0 Web Interface
The Zabbix web interface allows you to configure reports and monitor the health of servers. To configure it, you need to go to the browser and enter the IP address of the server in the address bar. Next, you need to choose a language that is convenient for you – English, Russian, Polish, or some other. By default, Zabbix is set with English. Then you should make sure that on the "Checking prerequisites" page there is an "OK" next to each line.
Next, enter the parameters for connecting to the Zabbix database. You only need to enter a password, because all other fields will be filled in without your participation and do not require editing. Just in case, check before clicking "Next".
At the next stage, you will have to specify the network node and the port number, you do not need to fill in the Name field. Click "Next" again, select the time zone and the theme of the web interface. It remains only to check all the parameters entered earlier for the correctness and click on "Finish". This is where the configuration of the Zabbix 6.0 web interface ends, it’s pretty much simple, as you can see.