Установка Zabbix 7.0 LTS на CentOS Stream 9
Отредактирована 16.12.2024
- Выполнить сетевые настройки, чтобы сам host был доступен по ip адресу. Если конечно вы это не сделали при установке OS.
# lscpu | grep Architecture
Architecture: x86_64
2. Установите и сконфигурируйте Zabbix для выбранной платформы
# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
# dnf clean all
b. Установите Zabbix сервер, веб-интерфейс и агент
# dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
# dnf -y install mariadb-server mariadb
# systemctl start mariadb.service
# systemctl enable mariadb.service
# 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, you should just press enter here.
Enter current password for root (enter for none): нажать Enter на клавиатуре
OK, successfully used password, moving on ...
Settings the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password: vSd-58W-q#7
Re-enter new password: vSd-58W-q#7
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
... Success!
Disallow root login remotely? [Y/n] y
... Success!
Remove test database and access to it? [Y/n] y
... Success!
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!
- user - zabbix_nocip
- password - xp5-QC3-2n@
- database (имя базы данных) - zabbix_db
# mysql -u root -p
Enter password: vSd-58W-q#7
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 = utf8mb4 COLLATE = utf8mb4_bin;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> CREATE USER zabbix_nocip@localhost IDENTIFIED BY 'xp5-QC3-2n@';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix_db.* TO zabbix_nocip@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/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -u zabbix_nocip -p zabbix_db
Enter password: xp5-QC3-2n@
# mysql -u root -p
Enter password: vSd-58W-q#7
MariaDB [(none)]> SET GLOBAL log_bin_trust_function_creators = 0;
MariaDB [(none)]> QUIT;
# systemctl restart mariadb.service
d. Настройте базу данных для Zabbix сервера
### Option: DBName
# Database name.
#
# Mandatory: yes
# Default:
# DBName=
DBName=zabbix_db
### Option: DBUser
# Database user.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zabbix_nocip
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=xp5-QC3-2n@
server {
listen 80;
server_name 10.10.80.8;
# systemctl restart zabbix-server.service zabbix-agent.service nginx.service php-fpm.service
# systemctl enable zabbix-server.service zabbix-agent.service nginx.service php-fpm.service
# firewall-cmd --get-active-zones
public
interfaces: enp0s3
# firewall-cmd --list-all
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
# firewall-cmd --reload
success
# firewall-cmd --list-all
- Database name: zabbix_db
- User: zabbix_nocip
- Password: xp5-QC3-2n@
- Username: Admin
- Password: zabbix