Как установить MariaDB 10.4 на CentOS 8 / RHEL 8

Как установить PHP 7.2 на RHEL 8 / CentOS 8

 

Как я могу установить MariaDB 10.4 на компьютере с ОС CentOS 8 / RHEL 8 Linux? MariaDB — это многопользовательский многопоточный сервер баз данных SQL, разветвленный от системы управления реляционными базами данных MySQL. Он был разработан, чтобы быть быстрым, надежным и с более продвинутыми функциями, подходящими для агрессивных операций с базами данных.

Мы не будем обсуждать интересные функции системы баз данных MariaDB 10.4, вы можете проверить примечания к выпуску для подробного описания набора функций . Вот только простые шаги, необходимые для работы работающего сервера базы данных MariaDB 10.4 на компьютере с ОС CentOS 8 / RHEL 8 Linux.

Установите MariaDB 10.4 на CentOS 8 / RHEL 8

Это идеальные шаги, которые вы пройдете при установке MariaDB 10.4 на сервере CentOS 8 / RHEL 8 Linux.

Шаг 1: Обновление системы

Если у вас нет критически важных служб, работающих в Production на сервере, обновите систему перед началом установки MariaDB 10.4 на CentOS 8 / RHEL 8.

sudo dnf -y upgrade

Шаг 2: Добавьте репозиторий MariaDB 10.4 в CentOS 8 / RHEL 8

Теперь нам нужно добавить репозиторий MariaDB yum для нашей архитектуры ЦП. В этом руководстве будет описано добавление репозитория для компьютера с процессором x86_64.

CentOS 8:

sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF 
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

RHEL 8:

sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF 
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Шаг 3: Установите репозиторий MariaDB 10.4 в CentOS 8 / RHEL 8

После добавления репозитория Yum вы можете сразу же приступить к установке репозитория MariaDB 10.4 в CentOS 8 / RHEL 8.

CentOS 8:

sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream 
sudo systemctl enable --now mariadb

RHEL 8:

sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=rhel-8-for-x86_64-appstream-rpms 
sudo systemctl enable --now mariadb

При появлении запроса нажмите y, чтобы принять установку:

MariaDB                                    186 kB/s | 489 kB     00:02    
Last metadata expiration check: 0:00:01 ago on Sat 04 Jan 2020 08:37:41 PM EAT.
Dependencies resolved.
========================================================================================================================================================
 Package                               Arch                          Version                                       Repository                      Size
========================================================================================================================================================
Installing:
 MariaDB-client                        x86_64                        10.4.11-1.el8                                 mariadb                         12 M
 MariaDB-server                        x86_64                        10.4.11-1.el8                                 mariadb                         26 M
Installing dependencies:
 MariaDB-common                        x86_64                        10.4.11-1.el8                                 mariadb                         87 k
 galera-4                              x86_64                        26.4.3-1.rhel8.0.el8                          mariadb                         13 M

Transaction Summary
========================================================================================================================================================
Install  4 Packages

Total download size: 51 M
Installed size: 196 M
Is this ok [y/N]: y

Более подробную информацию об установленном пакете можно запросить с помощью:

$ rpm -qi MariaDB-server
Name        : MariaDB-server
Version     : 10.4.11
Release     : 1.el8
Architecture: x86_64
Install Date: Sat 04 Jan 2020 08:38:56 PM EAT
Group       : Applications/Databases
Size        : 129705129
License     : GPLv2
Signature   : DSA/SHA1, Wed 11 Dec 2019 02:08:56 AM EAT, Key ID cbcb082a1bb943db
Source RPM  : MariaDB-server-10.4.11-1.el8.src.rpm
Build Date  : Tue 10 Dec 2019 06:19:51 PM EAT
Build Host  : rhel8-amd64
Relocations : (not relocatable)
Vendor      : MariaDB Foundation
URL         : http://mariadb.org
Summary     : MariaDB: a very fast and robust SQL database server
Description :
MariaDB: a very fast and robust SQL database server

It is GPL v2 licensed, which means you can use the it free of charge under the
conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/).

MariaDB documentation can be found at https://mariadb.com/kb
MariaDB bug reports should be submitted through https://jira.mariadb.org

Запустите и включите сервис MariaDB

sudo systemctl enable --now mariadb

Статус должен отображаться как работающий:

 

$ systemctl status mariadb
● mariadb.service - MariaDB 10.4.11 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Sat 2020-01-04 20:40:50 EAT; 15s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 31317 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 11512)
   Memory: 73.4M
   CGroup: /system.slice/mariadb.service
           └─31317 /usr/sbin/mysqld

Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: 10.4.11 started; log sequence number 60972; transaction id 21
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] InnoDB: Buffer pool(s) load completed at 200104 20:40:50
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Plugin 'FEEDBACK' is disabled.
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Server socket created on IP: '::'.
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Reading of all Master_info entries succeeded
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] Added new Master_info '' to hash table
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: 2020-01-04 20:40:50 0 [Note] /usr/sbin/mysqld: ready for connections.
Jan 04 20:40:50 centos8.novalocal mysqld[31317]: Version: '10.4.11-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Jan 04 20:40:50 centos8.novalocal systemd[1]: Started MariaDB 10.4.11 database server.

Шаг 4: Безопасный сервер базы данных MariaDB

Теперь, когда MariaDB 10.4 установлен на CentOS 8 / RHEL 8, защитите его, запустив mysql_secure_installation.

$ 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!

Проверить доступ к базе данных оболочки:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.4.11-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.4.11-MariaDB |
+-----------------+
1 row in set (0.000 sec)

MariaDB [(none)]> QUIT
Bye

Хотите освоить MySQL, проверьте:

2 комментария

Оставить ответ

Ваш адрес email не будет опубликован. Обязательные поля помечены *

четырнадцать − 1 =