CentOS 7
Sponsored Link

Zabbix 4.2 : Install2019/06/07

 
Install Zabbix 4.2 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 some other required packages and Zabbix repository.
# install from Remi

[root@dlp ~]#
yum --enablerepo=remi-safe -y install php72-php php72-php-mysqlnd php72-php-gd php72-php-xml php72-php-bcmath php72-php-ldap

[root@dlp ~]#
yum -y install http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
[root@dlp ~]#
systemctl restart httpd

[5] Install Zabbix server.
[root@dlp ~]#
yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent

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

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.2.8-MariaDB MariaDB Server

Copyright (c) 2000, 2017, 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)
MariaDB [(none)]>
grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on zabbix.* to zabbix@'%' 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-4.2.3]#
gzip -d create.sql.gz

[root@dlp zabbix-server-mysql-4.2.3]#
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 DB password for Zabbix

DBPassword=password
# Zabbix server starts after database server like follows

# but if you installed mariadb102-mariadb.service from

# CentOS Software Collections like this tutorial, it needs to add it like follows

[root@dlp ~]#
systemctl cat zabbix-server.service

# /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
.....
.....
[root@dlp ~]#
systemctl edit zabbix-server.service
# create new to add

[Unit]
After=rh-mariadb102-mariadb.service
[root@dlp ~]#
systemctl start zabbix-server

[root@dlp ~]#
systemctl enable zabbix-server

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

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

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

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

module zabbix_server 1.0;

require {
        type zabbix_var_run_t;
        type zabbix_t;
        class sock_file { create unlink };
        class unix_stream_socket connectto;
}

#============= zabbix_t ==============
allow zabbix_t self:unix_stream_socket connectto;
allow zabbix_t zabbix_var_run_t:sock_file { create unlink };

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

checkmodule: loading policy configuration from zabbix_server.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 17) to zabbix_server.mod
[root@dlp ~(keystone)]#
semodule_package --outfile zabbix_server.pp --module zabbix_server.mod

[root@dlp ~(keystone)]#
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 98: specify Zabbix server

Server=
127.0.0.1
# line 139: specify Zabbix server

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

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

[root@dlp ~]#
systemctl enable zabbix-agent

[11] Change httpd settings like follows.
[root@dlp ~]#
vi /etc/httpd/conf.d/zabbix.conf
# line 10: 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
    # comment out
    #<IfModule mod_php5.c>
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value max_input_vars 10000
        php_value always_populate_raw_post_data -1
        # line 20: uncomment and change timezone setting
        php_value date.timezone Asia/Tokyo
    # comment out
    #</IfModule>

[root@dlp ~]#
systemctl restart httpd

Matched Content