In this article, we will show you how to install and configure Zabbix 6.0 with PostgreSQL 13 on a Rocky Linux 8 in five minutes.
Before we start
For the purposes of this example, we will first switch SELinux mode to Permissive.
setenforce 0
PostgreSQL installation
At first, we will add the PostgreSQL package repositories and disable the default (system) repositories.
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
Next, can start installing PostgreSQL, in this case it will be PostgreSQL 13.
dnf install -y postgresql13-server
Now all that’s left is to initialize the database and set up automatic service startup.
/usr/pgsql-14/bin/postgresql-13-setup initdb
systemctl enable postgresql-13 --now
Installation of Zabbix server and its components
Let’s move on to installing the Zabbix server and its components.
We will start by adding official Zabbix repositories and clear the installation cache.
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
dnf clean all
Next, we will install all necessary Zabbix components.
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-agent zabbix-web-service
Database initialization
In the next step, we will create a user for Zabbix in the database and we will be prompted to enter a password.
cd /tmp
sudo -u postgres createuser --pwprompt zabbix
We will create a database and import the default schema and data. We will be asked to enter the password again.
Use the password from the previous step.
Attention! In newer older versions of Zabbix, this path is different, that is /usr/share/zabbix-sql-scripts/
!
sudo -u postgres createdb -O zabbix zabbix
zcat /usr/share/doc/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix
Firewall rules
Let us create all firewall rules needed for the Zabbix server to run.
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --reload
TimescaleDB installation
Now let’s get down to installing TimescaleDB.
Let’s start by adding a package repository.
tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/$(rpm -E %{rhel})/\$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOL
Next, we will install TimescaleDB.
dnf -y install timescaledb-2-postgresql-13-2.3.1 timescaledb-2-loader-postgresql-13-2.3.1
Now open the PostgreSQL configuration file
nano /var/lib/pgsql/13/data/postgresql.conf
and find the following line:
# shared_preload_libraries = ''
Add this line below, so that PostgreSQL automatically loads the TimescaleDB extension:
shared_preload_libraries = 'timescaledb'
Save the file and restart the database server.
systemctl restart postgresql-13.service
All that remains is to create and activate TimescaleDB extension.
Attention! In newer versions of Zabbix, this path is different, and that is /usr/share/zabbix-sql-scripts/
!
echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix
cat /usr/share/doc/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix
Zabbix server configuration
We will start by opening the Zabbix server configuration file.
nano /etc/zabbix/zabbix_server.conf
Next, we will adjust the individual parameters as follows:
DBPassword=<heslo_do_databaze>
StartReportWriters=1
WebServiceURL=http://localhost:10053/report
HANodeName=initMAX
After that, we will install Czech and Slovak language packs:
dnf install glibc-langpack-cs.x86_64 glibc-langpack-sk.x86_64
Finally, we restart all related services and set them to start automatically:
systemctl restart zabbix-server zabbix-web-service zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-web-service zabbix-agent httpd php-fpm
In order to verify that the Zabbix server has started properly, we can also check its log file:
less /var/log/zabbix/zabbix_server.log
Zabbix frontend configuration
In browser window, open the URL on which Zabbix is running and you will see installation wizard. For example http://192.168.0.50/zabbix
.
Clicking on the Next step button, will move us to the page with minimum requirements check
Everything is fine, so we can click Next step and move to the next page with the database connection settings.
On this page, we only fill in the Password field, because nothing else needs to be changed, and than we click on Next step button.
Here we fill in the basic settings, i.e. server name and time zone, and click Next step to continue to the configuration summary.
We gonna check the entered values and click Next step to complete the installation.
Click Finish to go to the login screen.
Now we can log in and start using Zabbix 6.0. (Admin/zabbix).
After logging in, the new Zabbix 6.0 is waiting for you.
Configuration of Zabbix reporting
In this chapter, we are gonna setup Zabbix reporting.
To use the reporting functions, we must first install Google Chrome, so let’s do that.
First, we download the installation package and install it.
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
dnf localinstall google-chrome-stable_current_x86_64.rpm
Next, it is necessary to adjust the “Frontend URL
” parameter in the configuration of the Zabbix frontend to the currently valid value, this setting can be found in the following path in the menu:
Administration -> General -> Other
You can see an example of these settings in the image below.
Give us a Like, share us, or follow us 😍
So you don’t miss anything: