본문으로 바로가기

[RHEL8] Zabbix Server Install

category Monitoring 2021. 7. 5. 13:23
반응형

1. yum update and SELINUX config

dnf update -y

sudo sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

reboot

 

2. LAMP Stack Install (Linux Apache MySQL PHP) and Service Enable

dnf install -y httpd mariadb-server php php-cli php-common php-mbstring php-mysqlnd php-xml php-bcmath php-devel php-pear php-gd

systemctl enable httpd --now
systemctl enable mariadb --now

 

3. Create DB for Zabbix Server

mysql_secure_installation

Enter current password for root (enter for none):  # enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:                  # root
Re-enter new password:         # root
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!


[root@zabbix-server ~]#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.3.17-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_db CHARACTER SET utf8 collate utf8_bin;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> GRANT ALL ON zabbix_db.* TO 'zabbix_user'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit;
Bye

 

4. Configure Zabbix Repository

sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm

 

5. Install Zabbix Server

dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-apache-conf

systemctl enable zabbix-server zabbix-agent php-fpm --now

 

6. Configure Zabbix Server

cd /usr/share/doc/zabbix-server-mysql/
sudo zcat create.sql.gz | mysql -u zabbix_user -p zabbix_db
(zabbix_user password : root)


sudo vi /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix_db
DBUser=zabbix_user
DBPassword=root

vi /etc/php-fpm.d/zabbix.conf

php_value[date.timezone] = Asia/Seoul

systemctl restart zabbix-server zabbix-agent php-fpm httpd

 

7. Configure the Firewall Rules

sudo firewall-cmd --permanent --add-port=10050/tcp
sudo firewall-cmd --permanent --add-port=10051/tcp
sudo firewall-cmd --permanent --add-port=80/tcp

sudo firewall-cmd --reload

 

8. Zabbix Install via a browser

http://<zabbix-server IP>/zabbix

Username : Admin / PW : zabbix

Configuratin DB Connection tab
MYSQL
localhost
0
zabbix_db
zabbix_user
root

All "Next Step"
728x90