티스토리 뷰

반응형

Install Zabbix 5 on Amazon Linux 2

We will install Zabbix 5 on Amazon Linux 2 using MySQL database as storage backend. We will also be configuring Apache httpd web server as reverse proxy to Zabbix server.

Before starting the installation of Zabbix 5 on Amazon Linux 2 ensure the system is updated,

yum -y update

Once updated perform a system reboot.

sudo systemctl reboot

 

Step 1: Add EPEL repository

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Step 2: Install and Configure MariaDB Database

tee /etc/yum.repos.d/mariadb.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Before you begin installaton update OS package cache index:

yum makecache

Install MariaDB Database server on Amazon Linux 2:

yum -y install MariaDB-server MariaDB-client

Enable and start mariadb with the below commands

systemctl enable mariadb
systemctl start mariadb

Secure MariaDB database server by setting a root user account password, removing anonymous users, disallowing root remote logins and removing test databases:

$mysql_secure_installation
Enter current password for root (enter for none): Just press Enter
Set root password? [Y/n] Y 
New password:  New-root-password
Re-enter new password: Re-enter New-root-password
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y 
Remove test database and access to it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 
Thanks for using MariaDB!

Connect to MariaDB and set up a database and a user

$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.5.8-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 CHARACTER SET utf8 COLLATE utf8_bin; 
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'DBStr0ngP@ssword'; 
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost'; 
FLUSH PRIVILEGES; 
EXIT
MariaDB [(none)]>


리모트 유저경우
CREATE USER 'zabbix'@'ip or hostname' IDENTIFIED BY 'password'; 
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'ip or hostname'; 

roozabbix 사용자를 192.168.0.* 대의 IP에서 접근이 가능하도록 권한을 부여
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.0.%' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
password 는 비밀번호를 설정하는 부분입니다. 만일 기존의 비밀번호를 그대로 사용하고 싶으시면, IDENTIFIED BY 'password 를 생략하세요.

Step 3: Install Httpd Web Serve

Run the following command to install httpd web server:

yum -y install httpd vim bash-completion
systemctl enable httpd
systemctl start httpd

Step 4: Install Zabbix server on Amazon Linux 2

yum -y install https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum -y install zabbix-server-mysql zabbix-agent zabbix-get

tee /etc/yum.repos.d/centos-scl.repo<<EOF
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=http://mirror.centos.org/centos/7/sclo/x86_64/sclo/
gpgcheck=0
enabled=1

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://mirror.centos.org/centos/7/sclo/x86_64/rh/
gpgcheck=0
enabled=1
EOF

Update yum repository list after adding the repository.

$yum makecache
Loaded plugins: langpacks, priorities, update-motd
amzn2-core                                                                                                                                 | 3.7 kB  00:00:00
amzn2extra-docker                                                                                                                          | 3.0 kB  00:00:00
amzn2extra-php7.4                                                                                                                          | 3.0 kB  00:00:00
centos-sclo-rh                                                                                                                             | 3.0 kB  00:00:00
centos-sclo-sclo                                                                                                                           | 3.0 kB  00:00:00
epel/x86_64/metalink                                                                                                                       |  17 kB  00:00:00
mariadb                                                                                                                                    | 2.9 kB  00:00:00
zabbix                                                                                                                                     | 2.9 kB  00:00:00
zabbix-frontend                                                                                                                            | 2.9 kB  00:00:00
zabbix-non-supported                                                                                                                       |  951 B  00:00:00
(1/6): centos-sclo-rh/primary_db                                                                                                           | 2.9 MB  00:00:00
(2/6): centos-sclo-rh/other_db                                                                                                             | 1.4 MB  00:00:00
(3/6): centos-sclo-rh/filelists_db                                                                                                         |  10 MB  00:00:01
(4/6): centos-sclo-sclo/primary_db                                                                                                         | 300 kB  00:00:00
(5/6): centos-sclo-sclo/other_db                                                                                                           | 185 kB  00:00:00
(6/6): centos-sclo-sclo/filelists_db                                                                                                       | 935 kB  00:00:00
Metadata Cache Created


sudo yum-config-manager --enable zabbix-frontend
sudo yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'DBStr0ngP@ssword' zabbix

sudo systemctl start zabbix-server zabbix-agent
sudo systemctl enable zabbix-server zabbix-agent

Step 5: Configure Zabbix Server on Amazon Linux 2

vim /etc/zabbix/zabbix_server.conf

DBHost=localhost 
DBName=zabbix 
DBUser=zabbix 
DBPassword=password

Set correct PHP timezone:

$vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Africa/Nairobi

sudo systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
sudo systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

Step 6: Initiate Zabbix 5 Web configuration

Open your web browser and access “http://(Zabbix server’s hostname or IP address)/zabbix/”  to initiate Zabbix server initial setup.

 

반응형

'monitoring' 카테고리의 다른 글

zabbix 3.0 server & client 설치 - CentOS 6  (0) 2017.07.06