CentOS Stream 8
Sponsored Link

Zabbix 6.0 : Install2022/03/08

 
Install Zabbix 6.0 LTS which is an enterprise open source monitoring system.
[1]
[2]
[3]
[4] Install required PHP modules and Add Zabbix repository.
[root@dlp ~]#
dnf -y install php-mysqlnd php-gd php-xml php-bcmath php-ldap

[root@dlp ~]#
dnf -y install https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
[5] Install Zabbix Server. To monitor Zabbix Server itself, Install Zabbix Agent, too.
[root@dlp ~]#
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

[6] Create a database for Zabbix.
[root@dlp ~]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.5.9-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix; 
Query OK, 1 row affected (0.00 sec)

# replace any password for DB [password]
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit 
Bye

[root@dlp ~]#
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Enter password:  
# password of zabbix user on MariaDB you set above
[7] Configure and start Zabbix Server.
[root@dlp ~]#
vi /etc/zabbix/zabbix_server.conf
# line 94 : add

DBHost=localhost
# line 130 : add Zabbix DB password

DBPassword=password
[root@dlp ~]#
systemctl enable --now zabbix-server

[8] If SELinux is enabled, change policy like follows.
[root@dlp ~]#
setsebool -P zabbix_can_network on

[root@dlp ~]#
setsebool -P httpd_can_connect_zabbix on

[root@dlp ~]#
setsebool -P domain_can_mmap_files on

[root@dlp ~]#
setsebool -P daemons_enable_cluster_mode on

[root@dlp ~]#
vi zabbix_server.te
# create new

module zabbix_server 1.0;

require {
        type initctl_t;
        type devlog_t;
        type proc_kcore_t;
        type zabbix_t;
        type zabbix_agent_t;
        type rpm_exec_t;
        type rpm_var_lib_t;
        class fifo_file getattr;
        class sock_file getattr;
        class file { execute execute_no_trans map open getattr };
        class capability dac_override;
}

#============= zabbix_t ==============
allow zabbix_t self:capability dac_override;

#============= zabbix_agent_t ==============
allow zabbix_agent_t devlog_t:sock_file getattr;
allow zabbix_agent_t initctl_t:fifo_file getattr;
allow zabbix_agent_t proc_kcore_t:file getattr;
allow zabbix_agent_t rpm_var_lib_t:file open;
allow zabbix_agent_t rpm_exec_t:file { execute execute_no_trans map };

[root@dlp ~]#
checkmodule -m -M -o zabbix_server.mod zabbix_server.te

[root@dlp ~]#
semodule_package --outfile zabbix_server.pp --module zabbix_server.mod

[root@dlp ~]#
semodule -i zabbix_server.pp

[9] If Firewalld is running, allow Zabbix related ports.
[root@dlp ~]#
firewall-cmd --add-service={http,https}

success
[root@dlp ~]#
firewall-cmd --add-port={10051/tcp,10050/tcp}

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[10] Configure and start Zabbix Agent to monitor Zabbix Server itself.
[root@dlp ~]#
vi /etc/zabbix/zabbix_agentd.conf
# line 117 : specify Zabbix server

Server=
127.0.0.1
# line 164 : specify Zabbix server

ServerActive=
127.0.0.1
# line 175 : change to the own hostname

Hostname=
dlp.srv.world
[root@dlp ~]#
systemctl enable --now zabbix-agent

[11] Change httpd settings. That's OK to configure Zabbix Server.
[root@dlp ~]#
vi /etc/httpd/conf.d/zabbix.conf
# line 12 : add access permittion for Zabbix Web frontend if you need
# by default, All are allowed

#
Require all granted
Require ip 127.0.0.1 10.0.0.0/24
[root@dlp ~]#
systemctl restart httpd php-fpm

Matched Content