MariaDB 11.4 をインストールした

AlmaLinux9

AlmaLinux9にMariaDBの11.4をインストールしました

MariaDBリポジトリの追加

通常のdnfインストールですと、10.5が入ってしまうのでリポジトリを追加します
手順はMariaDBの公式サイトを参照しました

yum / dnfを使用したMariaDBのインストール-MariaDBナレッジベース

リポジトリファイルを作成します
baseurlでバージョンを指定する箇所がありますが、今回11.4をインストールしたいので11.4を指定しました
別のバージョンの場合は適宜変更してください

# vi /etc/yum.repos.d/mariadb.repo

[mariadb]
name = MariaDB
baseurl = https://rpm.mariadb.org/11.4/rhel/$releasever/$basearch
gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

システムリポジトリを更新します

# dnf update

MariaDBインストール

リポジトリ追加後にdnfインストールしようとすると下記のようにバージョンが11.4でインストールできます

インストールするパッケージ名はMariaDB-serverです
※ 小文字でmariadb-serverでも同じパッケージがインストールされましたが、公式サイトによると大文字のMとDBにしたパッケージ名でインストールしたほうが良さそうなのでそのようにしました

# dnf install MariaDB-server
依存関係が解決しました。
==================================================================================================
 パッケージ                   Arch          バージョン                  リポジトリー        サイズ
==================================================================================================
インストール:
 MariaDB-server               x86_64        11.4.2-1.el9                mariadb-main         19 M
依存関係のインストール:
 MariaDB-client               x86_64        11.4.2-1.el9                mariadb-main        9.4 M
 MariaDB-common               x86_64        11.4.2-1.el9                mariadb-main         88 k
 MariaDB-shared               x86_64        11.4.2-1.el9                mariadb-main        133 k
 boost-program-options        x86_64        1.75.0-8.el9                appstream           106 k
 galera-4                     x86_64        26.4.18-1.el9               mariadb-main        1.4 M
 liburing                     x86_64        2.5-1.el9                   appstream            38 k
 perl-DBI                     x86_64        1.643-9.el9                 appstream           700 k
 perl-Math-BigInt             noarch        1:1.9998.18-460.el9         appstream           188 k
 perl-Math-Complex            noarch        1.59-481.el9                appstream            45 k
 perl-Sys-Hostname            x86_64        1.23-481.el9                appstream            16 k
 socat                        x86_64        1.7.4.1-5.el9               appstream           300 k
弱い依存関係のインストール:
 MariaDB-client-compat        noarch        11.4.2-1.el9                mariadb-main         11 k
 MariaDB-server-compat        noarch        11.4.2-1.el9                mariadb-main        9.0 k
 pv                           x86_64        1.6.20-1.el9                epel                 65 k

トランザクションの概要
==================================================================================================
インストール  15 パッケージ

ダウンロードサイズの合計: 31 M
インストール後のサイズ: 241 M
これでよろしいですか? [y/N]:

MariaDB初期設定①

サーバーの設定ファイルを編集し、文字コードの変更を設定します
※ mariadb10.5の時は「/etc/my.cnf.d/mariadb-server.cnf」でしたが11.4ではファイル名が「/etc/my.cnf.d/server.cnf」に変わってますのでご注意ください

# vi /etc/my.cnf.d/server.cnf

[mysqld]
character-set-server = utf8mb4

クライアントの設定ファイルも文字コードを変更しておきます

# vi /etc/my.cnf.d/client.cnf

[client]
default-character-set=utf8mb4

MariaDB起動

# systemctl start mariadb
# systemctl enable mariadb

MariaDB初期設定②

初期設定②はウィザードで設定していきます
MariaDB 10.5では「mysql_secure_installation」コマンドで初期設定を実施していましたが、MariaDB 11.4ではコマンドが見つかりませんでしたとエラーが表示されました
調べたところ、「mariadb-secure-installation」に変更されたようなのでこちらを実行します

※ 何度かMariaDBインストール&アンインストールして検証していたので、一部ウィザードで表示される内容が異なる可能性があります。ご了承ください

# mariadb-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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): ← 空エンター
OK, successfully used password, moving on...

Setting 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] ← 空エンター
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] ← 空エンター
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] ← 空エンター
 ... 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] ← 空エンター
 ... 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] ← 空エンター
 - 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] ← 空エンター
 ... 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!

MariaDBログイン確認

一応MariaDBにログインしてみます

# mysql -u root -p
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Enter password: ← rootパスワード入力
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 29
Server version: 11.4.2-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)]>

プロンプト(MariaDB [(none)]>)が表示されればログインできています

参考

本文中に記載した以外に参考にさせていただいたサイトです

RockyLinuxとAlmaLinuxにMariaDBをインストールする方法 (tecmint.com)
CentOS 7 に MariaDB Community Server 最新版をインストール | MariaDB
https://zenn.dev/masa20210102/articles/3928bcff0a963b
データベースサーバー構築(MariaDB) – AlmaLinuxで自宅サーバー構築 (centossrv.com)

コメント

タイトルとURLをコピーしました