LoginSignup
1
0

More than 1 year has passed since last update.

CentOS7.9にMySQL8を入れる

Posted at

CentOS 7.9mysql-community-server を入れようとしたところ、いろいろ問題があり時間がかかったので作業内容を残しておきます。

  • 環境
# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
  • インストールしたmysqlのバージョン
# mysql -V
mysql  Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)

作業ログ

mysqlをインストールする

まずは普通にインストール

# yum localinstall http://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm
# yum install mysql-community-server

するとパッケージが足りないと言われました
足りないもの↓

libcrypto.so.1.1()(64bit)
libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
libcrypto.so.1.1(OPENSSL_1_1_1)(64bit)
libc.so.6(GLIBC_2.25)(64bit)
libc.so.6(GLIBC_2.28)(64bit)
libncurses.so.6()(64bit)
libssl.so.1.1()(64bit)
libssl.so.1.1(OPENSSL_1_1_0)(64bit)
libssl.so.1.1(OPENSSL_1_1_1)(64bit)
libstdc++.so.6(CXXABI_1.3.11)(64bit)
libstdc++.so.6(CXXABI_1.3.8)(64bit)
libstdc++.so.6(CXXABI_1.3.9)(64bit)
libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
libstdc++.so.6(GLIBCXX_3.4.22)(64bit)
libtinfo.so.6()(64bit)
libtirpc.so.3()(64bit)
libtirpc.so.3(TIRPC_0.3.0)(64bit)
libtirpc.so.3(TIRPC_0.3.3)(64bit)

足りないパッケージの追加

調べてみると、OpenSSLのバージョンが古いのが原因らしい(調査内容については後述)

# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

yum list | grep openssl11 をしてもパッケージが見つからなかったのでepelリポジトリを追加

# yum install epel-release

すると openssl11 が見つかったのでインストール

# yum list | grep openssl11
openssl11.x86_64                        1:1.1.1k-3.el7                 epel     
openssl11-devel.x86_64                  1:1.1.1k-3.el7                 epel     
openssl11-libs.x86_64                   1:1.1.1k-3.el7                 epel     
openssl11-static.x86_64                 1:1.1.1k-3.el7                 epel     
# yum install openssl11.x86_64

入りました

# openssl11 version
OpenSSL 1.1.1k  FIPS 25 Mar 2021 (Library: OpenSSL 1.1.1q  5 Jul 2022)

GPG-KEYの追加

ここで一旦mysqlリトライ
するとgpg-keyのエラーが発生

# yum install mysql-community-server
(中略)
Total                                                                                      11 MB/s |  74 MB  00:00:07     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022


GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022"

ファイルがないとのこと

# ls /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
ls: cannot access /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022: No such file or directory

GPG-KEYは期限が切れると無効化されるらしいので、新しいものを追加

# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

もう一度mysqlインストール

# yum install mysql-community-server
(中略)
Installed:
  mysql-community-server.x86_64 0:8.0.29-1.el7                                                                            

Dependency Installed:
  mysql-community-client.x86_64 0:8.0.29-1.el7            mysql-community-client-plugins.x86_64 0:8.0.29-1.el7           
  mysql-community-common.x86_64 0:8.0.29-1.el7            mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7           
  mysql-community-libs.x86_64 0:8.0.29-1.el7             

Complete!

これでインストールができました。

# systemctl status mysqld.service 
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html

学んだこと

最初に足りないと言われたパッケージ libcrypto.so.1.1()(64bit) を調べたところ、こちらのページが見つかりました。(後で調べなおしたためバージョンが新しくなっています)
https://rhel.pkgs.org/7/epel-x86_64/openssl11-libs-1.1.1k-4.el7.x86_64.rpm.html

こちらの Repository の欄が EPEL x86_64 となっていたため、epelリポジトリを登録してopenssl11をインストールするという手順にたどり着くことができました。

足りないパッケージがあった場合は https://pkgs.org/ で検索して自分の環境に合ったものを探す、ということが理解できたのは汎用性の高い学びだったと思います。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0