Установить MariaDB 10.4 на CentOS 8

Как я могу установить MariaDB 10.4 на компьютере с ОС CentOS 8 Linux? MariaDB – это многопользовательский многопоточный сервер баз данных SQL, разветвленный от системы управления реляционными базами данных MySQL. Он был разработан, чтобы быть быстрым, надежным и с более продвинутыми функциями, подходящими для агрессивных операций с базами данных.
Мы не будем обсуждать интересные функции системы баз данных MariaDB 10.4, вы можете проверить примечания к выпуску для подробного описания набора функций . Вот только простые шаги, необходимые для работы работающего сервера базы данных MariaDB 10.4 на компьютере с ОС CentOS 8 / RHEL 8 Linux.
Содержимое
Установите MariaDB 10.4 на CentOS 8
Это идеальные шаги, которые вы пройдете при установке MariaDB 10.4 на сервере CentOS 8
Шаг 1: Обновление системы
Если у вас нет критически важных служб, работающих в Production на сервере, обновите систему перед началом установки MariaDB 10.4 на CentOS 8 / RHEL 8.
1
|
sudo dnf -y upgrade
|
Шаг 2: Добавьте репозиторий MariaDB 10.4 в CentOS 8 / RHEL 8
Теперь нам нужно добавить репозиторий MariaDB yum для нашей архитектуры ЦП. В этом руководстве будет описано добавление репозитория для компьютера с процессором x86_64.
CentOS 8:
1
2
3
4
5
6
7
8
9
10
|
sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
# MariaDB 10.5 CentOS repository list - created 2020-10-23 16:48 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = http://mirror2.hs-esslingen.de/mariadb/yum/10.5/centos8-amd64
module_hotfixes=1
gpgkey=http://mirror2.hs-esslingen.de/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
|
Так же можно воспользоваться скриптом для автоматической установки репозитория.
1
|
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
|
Обратите внимание, что этот сценарий также настраивает репозиторий для MariaDB MaxScale и репозиторий для MariaDB Tools, который в настоящее время содержит только Percona XtraBackup и его зависимости.
Шаг 3: Установите репозиторий MariaDB 10.4 в CentOS 8
После добавления репозитория Yum вы можете сразу же приступить к установке репозитория MariaDB 10.4 в CentOS 8 / RHEL 8.
CentOS 8:
1
|
sudo dnf install MariaDB-server
|
При появлении запроса нажмите y, чтобы принять установку:
Более подробную информацию об установленном пакете можно запросить с помощью:
1
|
$ rpm -qi MariaDB-server
|
Запустите и включите сервис MariaDB
1
|
sudo systemctl enable --now mariadb
|
Статус должен отображаться как работающий:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.5.6 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Fri 2020-10-23 21:51:49 +05; 5s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 2758 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 2733 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recove>
Process: 2731 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 2743 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 16 (limit: 12335)
Memory: 73.2M
CGroup: /system.slice/mariadb.service
└─2743 /usr/sbin/mariadbd
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] InnoDB: 10.5.6 started; log sequence number 45051; tra>
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_>
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] Plugin 'FEEDBACK' is disabled.
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] InnoDB: Buffer pool(s) load completed at 201023 21:51:>
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] Server socket created on IP: '::'.
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] Reading of all Master_info entries succeeded
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] Added new Master_info '' to hash table
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: 2020-10-23 21:51:49 0 [Note] /usr/sbin/mariadbd: ready for connections.
окт 23 21:51:49 home.darksf.ru mariadbd[2743]: Version: '10.5.6-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB>
окт 23 21:51:49 home.darksf.ru systemd[1]: Started MariaDB 10.5.6 database server.
lines 1-27/27 (END)
|
Шаг 4: Безопасный сервер базы данных MariaDB
Теперь, когда MariaDB 10.4 установлен на CentOS 8, защитите его, запустив mysql_secure_installation.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
$ sudo 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):
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:
Re-enter new password:
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!
|
Проверить доступ к базе данных оболочки:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$ 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.6-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)]> SELECT version();
+----------------+
| version() |
+----------------+
| 10.5.6-MariaDB |
+----------------+
1 row in set (0.000 sec)
MariaDB [(none)]> QUIT
Bye
|