Оглавление
Устанавливаем Zabbix 7.0-2 на Ubuntu 22.04 с MySQL 8.0.39
Дано:
Ubuntu 22.04
Скачиваем и устанавливаем Zabbix
cd /tmp/
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu22.04_all.deb
dpkg -i zabbix-release_7.0-2+ubuntu22.04_all.deb
apt update
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Установка и настройка MySQL для Zabbix
apt install -y mysql-server
systemctl enable --now mysql
mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No:
Skipping password set for root as authentication with auth_socket is used by default.
If you would like to use password authentication instead, this can be done with the “ALTER_USER” command.
See https://dev.mysql.com/doc/refman/8.0/en/alter-user.html#alter-user-password-management for more information.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No:
Skipping password set for root as authentication with auth_socket is used by default.
If you would like to use password authentication instead, this can be done with the “ALTER_USER” command.
See https://dev.mysql.com/doc/refman/8.0/en/alter-user.html#alter-user-password-management for more information.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
mysql -uroot -p -e "create database zabbixdb character set utf8mb4 collate utf8mb4_bin;"
mysql -u root -p -e "create user 'zabbixuser'@'localhost' identified by 'Str0ngDBP@ssw%rd';"
mysql -u root -p -e "grant all privileges on zabbixdb.* to zabbixuser@localhost;"
mysql -u root -p -e "SET GLOBAL log_bin_trust_function_creators = 1;"
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbixuser -p'Str0ngDBP@ssw%rd' zabbixdb
Настройка файла конфигурации Zabbix сервера
nano /etc/zabbix/zabbix_server.conf
Меняем параметры на наши:
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=Str0ngDBP@ssw%rd
DBUser=zabbixuser
DBPassword=Str0ngDBP@ssw%rd
Перезапускаем службы и добавляем их в автозагрузку:
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
Установка русского языка в Zabbix
locale -a
locale-gen ru_RU
locale-gen ru_RU.UTF-8
dpkg-reconfigure locales
service apache2 restart
Первоначальная настройка Zabbix
Открываем браузер:
http://zabbix_server_ip/zabbix
Проходим еще раз первоначальную настройку, указываем параметры подключения к БД:
Логин пароль по умолчанию для первого входа в Zabbix
Admin
zabbix
Ссылки
https://bestmonitoringtools.com/how-to-install-zabbix-server-on-ubuntu/