Установка Zabbix на CentOS 7
Отредактирована 01.02.2023
- Создать виртуальную машину и установить на неё CentOS 7, плюс выполним базовые настройки;
- Выполнить сетевые настройки, чтобы сам host был доступен по ip адресу. Если конечно вы это не сделали при установке OS.
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
# yum install -y zabbix-server-mysql zabbix-agent
# yum install -y centos-release-scl
[zabbix-frontend]
...
enabled=1
...
# yum install -y zabbix-web-mysql-scl zabbix-nginx-conf-scl
# yum -y install mariadb-server mariadb
# systemctl restart mariadb
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): {нажимаем Enter}
Set root password? [Y/n] y
New password: xgP-aeR-Qlp-#fG
Re-enter new password: xgP-aeR-Qlp-#fG
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.
Remoov 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!
- user - zabbix
- password - xgP-aeR-Qlp-#fG
- database (имя базы данных) - zabbix_db
# mysql -uroot -p
Enter password: xgP-aeR-Qlp-#fG
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.68-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.01 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'xgP-aeR-Qlp-#fG';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix_db.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit;
Bye
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix_db
Enter password: xgP-aeR-Qlp-#fG
# mysql -uroot -p
Enter password: xgP-aeR-Qlp-#fG
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
# systemctl start mariadb.service
# systemctl enable mariadb.service
### Option: DBName
# Database name.
#
# Mandatory: yes
# Default:
# DBName=
DBName=zabbix_db
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=xgP-aeR-Qlp-#fG
server {
listen 80;
server_name 192.168.56.8;
listen.acl_users = apache,nginx
; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = Europe/Moscow
# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
# systemctl status firewalld
# systemctl restart firewalld
# firewall-cmd --get-active-zones
public
interfaces: eth0
# firewall-cmd --zone=public --list-services --permanent
dhcpv6-client ssh
# firewall-cmd --zone=public --add-service=http --permanent
# firewall-cmd --zone=public --permanent --add-port=10051/tcp
# firewall-cmd --zone=public --permanent --add-port=80/tcp
# firewall-cmd --zone=public --permanent --list-ports
10051/tcp 80/tcp
# systemctl restart firewalld
# firewall-cmd --zone=public --add-service=https --permanent
# firewall-cmd --zone=public --remove-service=https --permanent
# firewall-cmd --zone=public --permanent --remove-port=10051/tcp
- Database name: zabbix_db
- User: zabbix
- Password: xgP-aeR-Qlp-#fG
- Username: Admin
- Password: zabbix