This article describes the steps to install Zabbix 4.4 on CentOS 7.
Zabbix is an open source (OSS) integrated monitoring software developed for centralized monitoring of server monitoring, network monitoring, etc., and has established a de facto standard position as monitoring software.
Zabbix has the monitoring, failure detection and notification functions required for integrated monitoring. Since it supports Zabbix agent and SNMP for many platforms, it is possible to monitor the entire system with one Zabbix.
Zabbix web interface is written in PHP and runs as a web application on Apache. All monitoring settings and information display can be easily done from a web browser.
--Host OS: Windows10 --Guest OS: CentOS7 (CentOS Linux release 7.6.1810 (Core)) --How to build a virtual machine: VirtualBox, Vagrant --Web server: Apache2.4
Build the CentOS 7 environment in advance. There is no problem with the minimum package for the OS to be installed.
The built CentOS 7 will be ready for internet connection, yum commands, and communication with other guest OS machines. In addition, the following Zabbix environment construction is done with root privileges.
SSH connection to CentOS environment built with Vagrant from the command prompt of Windows.
command prompt
D:\hoge>vagrant ssh zabbix
Last login: Tue Oct 20 16:40:47 2020 from 10.0.2.2
[vagrant@zabbix ~]$ su -
Password:
Last login: Tue Oct 20 16:43:52 UTC 2020 on pts/0
[root@zabbix ~]#
First, update the OS to the latest state with the yum update
command.
CentOS7
[root@zabbix ~]# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
~~~ Omitted ~~~
tuned.noarch 0:2.11.0-8.el7 tzdata.noarch 0:2020a-1.el7
util-linux.x86_64 0:2.23.2-63.el7 vim-minimal.x86_64 2:7.4.629-6.el7
xfsprogs.x86_64 0:4.5.0-20.el7 yum.noarch 0:3.4.3-167.el7.centos
yum-plugin-fastestmirror.noarch 0:1.1.31-54.el7_8 yum-utils.noarch 0:1.1.31-54.el7_8
Complete!
When the OS update is complete, restart the OS and SSH into CentOS 7.
command prompt
[root@zabbix ~]# reboot
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
D:\hoge>vagrant ssh zabbix
Last login: Tue Oct 20 16:40:47 2020 from 10.0.2.2
[vagrant@zabbix ~]$ su -
Password:
Last login: Tue Oct 20 16:43:52 UTC 2020 on pts/0
[root@zabbix ~]#
Install the software (Apache, PHP, MariaDB) required to run Zabbix with the following command.
CentOS7
[root@zabbix ~]# yum -y install httpd-devel php php-devel php-pdo php-mysqlnd php-mbstring php-mcrypt php-gd php-pear php-pecl-apc-devel zlib-devel mariadb-devel mariadb-server
Check the version of the web server (Apache).
CentOS7
[root@zabbix ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Check the PHP version.
CentOS7
[root@zabbix ~]# php -v
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Check the MariaDB version.
CentOS7
[root@zabbix ~]# mysql -V
mysql Ver 15.1 Distrib 5.5.65-MariaDB, for Linux (x86_64) using readline 5.1
This time install Zabbix version 4.4. You can check the latest version of Zabbix server from the official repository below. https://repo.zabbix.com/zabbix/
Install version 4.4 from Zabbix official repository.
CentOS7
[root@zabbix ~]# yum -y install https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
Execute the following command to install Zabbix Server related packages.
CentOS7
yum install zabbix-web-mysql zabbix-web-japanese zabbix-server-mysql
Check Zabbix server version. You have successfully installed version 4.4.
CentOS7
[root@zabbix ~]# zabbix_server -V
zabbix_server (Zabbix) 4.4.10
Revision 4db30afc70 29 June 2020, compilation time: Jun 29 2020 11:55:57
Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013
Running with OpenSSL 1.0.1e-fips 11 Feb 2013
Execute the following command to install Zabbix Agent. (Zabbix-agent is software that is originally installed on the monitored server)
CentOS7
[root@zabbix ~]# yum -y install zabbix-agent
Check the version of Zabbix agent. You have successfully installed version 4.4.
CentOS7
[root@zabbix ~]# zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 4.4.10
Revision 4db30afc70 29 June 2020, compilation time: Jun 29 2020 11:56:26
Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013
Running with OpenSSL 1.0.1e-fips 11 Feb 2013
Start MariaDB and log in.
CentOS7
[root@zabbix ~]# systemctl start mariadb
[root@zabbix ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@zabbix ~]# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-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 database "zabbix" and user "zabbix" used by zabbix-server.
Replace the new-password part with an arbitrary password and execute the command.
MariaDB
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'new-password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('new-password') WHERE User='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit;
Bye
Then execute the following command to import the initialization SQL into zabbix database.
CentOS
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-4.4.10/
[root@zabbix zabbix-server-mysql-4.4.10]# zcat create.sql.gz | mysql -u zabbix -p zabbix
Enter password:
[root@zabbix zabbix-server-mysql-4.4.10]#
Enter the password of the zabbix user created earlier in the Zabbix server configuration file zabbix_server.conf
.
Replace the new-password part with an arbitrary password and execute the command.
CentOS7
# vi /etc/zabbix/zabbix_server.conf
---
# DBPassword=
↓
DBPassword=new-password
Set the time zone to "Asia / Tokyo (Japan / Tokyo)" in the Apache configuration file zabbix.conf
so that it will be displayed in Japan time on Zabbix browser.
CentOS7
# vi /etc/httpd/conf.d/zabbix.conf
---
# php_value date.timezone Europe/Riga
↓
php_value date.timezone Asia/Tokyo
Run Apache startup and autostart settings.
CentOS7
[root@zabbix ~]# systemctl start httpd
[root@zabbix ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Execute zabbix-server startup and autostart settings.
CentOS7
[root@zabbix ~]# systemctl start zabbix-server
[root@zabbix ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
After starting the firewall, allow communication to http (80 / TCP) so that Zabbix web interface can be displayed.
CentOS7
[root@zabbix ~]# systemctl start firewalld
[root@zabbix ~]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
[root@zabbix ~]# firewall-cmd --add-service=http --zone=public --permanent
success
[root@zabbix ~]# firewall-cmd --reload
success
[root@zabbix ~]#
After that, work on the Web browser.
Access the URL of Zabbix management screen. Enter the IP address of CentOS 7 in the IP address part. http://[IPアドレス]/zabbix/
When the following screen is displayed, click "Next Step" to proceed.
Enter the password you decided when setting MariaDB in "Password" on the screen below.
The following login screen will be displayed as you proceed in sequence. You can log in with the following initial settings. -Username: Admin ・ Password: zabbix
If the following screen (Zabbix dashboard) is displayed, login is successful.
that's all.
Introduction to IT Infrastructure Monitoring-Zabbix Installation- "Basic knowledge of IT infrastructure required in the cloud era" (5) https://knowledge.sakura.ad.jp/12446/
Recommended Posts