CentOS Stream 8
Sponsored Link

Zabbix 5.0 : Install2021/06/02

 
Install Zabbix 5.0 LTS which is an enterprise open source monitoring system.
It's possible to monitor not only Linux but Windows, Solaris, IBM AIX and others.
[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/5.0/rhel/8/x86_64/zabbix-release-5.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-agent zabbix-get

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

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-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.

# create DB with utf8 charset
# with utf8mb4, error occurs because of maximum index size 3072 bytes
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; 
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)]> flush privileges; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit 
Bye

[root@dlp ~]#
cd /usr/share/doc/zabbix-server-mysql/

[root@dlp zabbix-server-mysql]#
gzip -d create.sql.gz

[root@dlp zabbix-server-mysql]#
mysql -u root -p zabbix < create.sql

Enter password:
[7] Configure and start Zabbix Server.
[root@dlp ~]#
vi /etc/zabbix/zabbix_server.conf
# line 92 : add

DBHost=localhost
# line 125 : 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} --permanent

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

success
[root@dlp ~]#
firewall-cmd --reload

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 158 : specify Zabbix server

ServerActive=
127.0.0.1
# line 169 : 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 ~]#
vi /etc/php-fpm.d/zabbix.conf
# last line : uncomment and change to your timezone

date.timezone =
Asia/Tokyo
[root@dlp ~]#
systemctl restart httpd php-fpm

Matched Content