🎃

プロキシ環境下のUbuntu Server 20.04でMariaDBを入れるときに詰まった話

2021/04/08に公開

自分の記事を見ながら、学校のプロキシ環境下にあるサーバーにMariaDBを入れようとしたところ、aptのリポジトリ関連で詰まった話です。

curl -LsS …で止まる

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bashをしようとすると、ここで止まる…

[info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
[info] Adding trusted package signing keys...

とりあえず手動でdebパッケージを追加してみる

ここでオプションに--write-to-stdoutがあることに気づいたので回してみる。

# curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --write-to-stdout
[info] If run without --write-to-stdout, this script will create /etc/apt/preferences.d/mariadb-enterprise.pref to give packages from MariaDB repositories highest priority, in order to avoid conflicts with packages from OS and other repositories.
# MariaDB Server
# To use a different major version of the server, or to pin to a specific minor version, change URI below.
deb http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal main

deb http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal main/debug

# MariaDB MaxScale
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
deb https://dlm.mariadb.com/repo/maxscale/latest/ubuntu focal main

# MariaDB Tools
deb http://downloads.mariadb.com/Tools/ubuntu focal main
[info] If run without --skip-key-import/--write-to-stdout, this script will import package signing keys used by MariaDB

debの表記を見つけたので手動で追加する。

$ sudo nano /etc/apt/sources.list

----- sources.list
︙
deb http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal main

deb http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal main/debug
-----

パッケージを追加したのでアップデートする。

$ sudo apt update

Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-security InRelease
Get:1 https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease [6,264 B]
Err:1 https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1656F24C74CD1D8
Reading package lists... Done
W: GPG error: https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1656F24C74CD1D8
E: The repository 'http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

エラーを吐かれる。

プロキシ環境下でapt-key adbをする

上で見てるとキーが落ちてる。

︙
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1656F24C74CD1D8
︙

多分、curlのスクリプトの中のこれが正常に動いてないんだろう。

参考Qiitaを見ながらキーを追加する。

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-option http-proxy=http://proxy_address:proxy_port --recv-keys F1656F24C74CD1D8

gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key <signing-key@mariadb.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

いけるやんけ!

やっとインストール

$ sudo apt update
$ sudo apt install mariadb-server

できた…

$ mariadb --version
mariadb  Ver 15.1 Distrib 10.5.9-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Discussion