How to Install and Configure Zabbix on CentOS 8
On CentOS 8, we’ll install the Zabbix 5 server monitoring solution. Postgresql-12 will be the database management system, and the Nginx web server will be used.
Necessary packages for Zabbix Installation
Let’s get the Zabbix repository installed and the package management cache cleared.
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
dnf clean all
We can now install the required items after adding the repository.
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-agent
Installation of Postgresql-12
Clear the cache after installing the Postgresql-12 repository.
rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf clean all
Disable the pre-installed database management system module.
dnf -qy module disable postgresql
Install the Postgresql-12 packages after that.
dnf -y install postgresql12 postgresql12-server
It’s now time to create the database.
/usr/pgsql-12/bin/postgresql-12-setup initdb
We can now activate the service and have it start automatically when the system boots up.
systemctl enable --now postgresql-12
Configuration of the database
For Zabbix, create a new Postgresql user. When prompted, provide the password for it.
sudo -u postgres createuser --pwprompt zabbix
Then, to work with the server monitoring system, build a new database.
sudo -u postgres createdb -O zabbix zabbix
Let’s populate the Zabbix database with the initial schema and data. Type the password for the zabbix user we just created when prompted.
zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix
Uncomment the DBPassword line in the /etc/zabbix/zabbix server.conf file and enter the database password here.
DBPassword=zabbix
To connect Zabbix to the database, enter the /var/lib/pgsql/12/data/pg hba.conf file and look for the following lines:
# IPv4 local connections:
host all all 127.0.0.1/32 ident
Switch to a password-protected approach.
host all all 127.0.0.1/32 password
And then restart the database management system.
systemctl restart postgresql-12
Configuration of Nginx
Uncomment the listen and server name arguments in the /etc/nginx/conf.d/zabbix.conf file. In the last field, type your server’s domain name or if you only wish to reach it via an IP address.
server {
listen 80;
server_name _;
...
You must also comment out the entire server section in the /etc/nginx/nginx.conf file in the last scenario.
# server {
# listen 80 default_server;
# listen [::]:80 default_server;
# server_name _;
# root /usr/share/nginx/html;
...
Uncomment the php value[date.timezone] parameter in the /etc/php-fpm.d/zabbix.conf file and set your timezone.
php_value[date.timezone] = Asia/Karachi
Restart the preset programmes and set them to start automatically when the system boots up.
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
Configuring the Zabbix frontend
In a browser, type in the IP address of your server
On the second stage, make sure that all of the conditions are met.
In the third step, fill in the Database Host field with 127.0.0.1 and the database password in the corresponding column.
Continue to the end of the configuration process and leave the default options alone.
To access the administrator panel, use the login Admin and password zabbix.
Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!