Red Hat Enterprise Linux
検証用コンテナ
セキュリティの緩和
https://qiita.com/nasuB7373/items/92166d7958044ab8d450
$ export DOCKER_CONTENT_TRUST=0
使うコンテナ
https://hub.docker.com/layers/redhat/ubi8/8.8/images/sha256-e6c589cf5f402a60a83a01653304d7a8dcdd47b93a395a797b5622a18904bd66
$ docker pull redhat/ubi8:8.8
$ docker run -it --name rhel88 redhat/ubi8:8.8
たてっぱの場合
$ docker start rhel88
$ docker exec -it rhel88 bash
----------------------------------------------------------------------------------------------------------------------------------------------------------------
RHEL8を触る機会があったので、いろいろメモを残しておく
https://www.redhat.com/ja
リポジトリ
RHELに導入するモジュールがまとめられたもの。パッケージ管理の役割を果たす。
以下はRHEL8であることを前提に、軽くまとめておく
BaseOS
systemdなど、サーバとして動作させるためのツールが主にまとまっているリポジトリ
ツールは安定性が確保されたバージョンのものが多い
AppStream(アプリケーションストリーム)
開発者向けのツールが主にまとめられているリポジトリ
それこそPHP, MariaDBなど
バージョンの指定ができるケースが多い
code:log
root@d0a40b60d4a5 /# dnf module list php
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.
This system is not registered with an entitlement server. You can use subscription-manager to register.
Last metadata expiration check: 0:00:05 ago on Sun Mar 9 12:27:36 2025.
Red Hat Universal Base Image 8 (RPMs) - AppStream
Name Stream Profiles Summary
php 7.2 d common d, devel, minimal PHP scripting language
php 7.3 common d, devel, minimal PHP scripting language
php 7.4 common d, devel, minimal PHP scripting language
php 8.0 common d, devel, minimal PHP scripting language
php 8.2 common d, devel, minimal PHP scripting language
AppStream配下で、PHPの導入バージョンが選べている
EPELとRemi
EPEL Extra Packages for Enterprise Linux
RHELの拡張リポジトリ
$ dnf install epel-release
もしくは、対応verを入れる
https://qiita.com/yamada-hakase/items/fdf9c276b9cae51b3633
Remi
そのまんま、Remiさんという方が管理している非公式のパッケージリポジトリ
公式が用意していないようなバージョンのものを落とすことができる
EPELに依存していることが多いので、EPELを事前に導入していないといけないことが多い
PHP関連に強い
code:sh
# EPEL
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# Remi
dnf install https://rpmfind.net/linux/remi/enterprise/8/remi/x86_64/remi-release-8.8-1.el8.remi.noarch.rpm
例えばRemiだけ導入しようとすると、EPELが必要だと怒られる
code:sh
dnf install https://rpmfind.net/linux/remi/enterprise/8/remi/x86_64/remi-release-8.8-1.el8.remi.noarch.rpm
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.
This system is not registered with an entitlement server. You can use subscription-manager to register.
Last metadata expiration check: 0:15:00 ago on Sun Mar 9 12:27:36 2025.
remi-release-8.8-1.el8.remi.noarch.rpm 17 kB/s | 32 kB 00:01
Error:
Problem: conflicting requests
- nothing provides epel-release = 8 needed by remi-release-8.8-1.el8.remi.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
# 入れてみる インテルCPU(アーキテクチャがx86_64のもの)の場合
## https://www.rpmfind.net/linux/rpm2html/search.php?query=remi-release
root@d0a40b60d4a5 /# uname -m
x86_64
## まずEPEL
https://qiita.com/yamada-hakase/items/fdf9c276b9cae51b3633
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
## Remi
dnf install https://www.rpmfind.net/linux/remi/enterprise/8/remi/x86_64/remi-release-8.8-1.el8.remi.noarch.rpm
## 改めて、PHPのパッケージを確認してみる
root@d0a40b60d4a5 /# dnf module list php
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.
This system is not registered with an entitlement server. You can use subscription-manager to register.
Remi's Modular repository for Enterprise Linux 8 - x86_64 242 B/s | 833 B 00:03
Remi's Modular repository for Enterprise Linux 8 - x86_64 3.0 MB/s | 3.1 kB 00:00
# 初めてリポジトリに繋ぐので、そのチェック
Importing GPG key 0x5F11735A:
Userid : "Remi's RPM repository <remi@remirepo.net>"
Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok y/N: y
Remi's Modular repository for Enterprise Linux 8 - x86_64 236 kB/s | 1.0 MB 00:04
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 411 B/s | 833 B 00:02
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 3.0 MB/s | 3.1 kB 00:00
Importing GPG key 0x5F11735A:
Userid : "Remi's RPM repository <remi@remirepo.net>"
Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok y/N: y
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 355 kB/s | 2.2 MB 00:06
Last metadata expiration check: 0:00:01 ago on Sun Mar 9 12:56:29 2025.
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common d, devel, minimal PHP scripting language
php remi-7.3 common d, devel, minimal PHP scripting language
php remi-7.4 common d, devel, minimal PHP scripting language
php remi-8.0 common d, devel, minimal PHP scripting language
php remi-8.1 common d, devel, minimal PHP scripting language
php remi-8.2 common d, devel, minimal PHP scripting language
php remi-8.3 common d, devel, minimal PHP scripting language
php remi-8.4 common d, devel, minimal PHP scripting language
Red Hat Universal Base Image 8 (RPMs) - AppStream
Name Stream Profiles Summary
php 7.2 d common d, devel, minimal PHP scripting language
php 7.3 common d, devel, minimal PHP scripting language
php 7.4 common d, devel, minimal PHP scripting language
php 8.0 common d, devel, minimal PHP scripting language
php 8.2 common d, devel, minimal PHP scripting language
Hint: default, enabled, xdisabled, installed
remi-系統のバージョンが選べるようになっている!
EUSExtended Update Support
https://access.redhat.com/ja/articles/3055941
RHELは基本的に有料のライセンスを購入することで使用できるOSだが、そのサブスクライバー向けのサービス
リリースされたアプリケーションなどのバグフィックス対応をしてくれるので、こちらから落とすと安心である
BaseOS, Appstreamなどで提供される。
code:sh
dnf module list php
# こんな感じでEUSで提供していることを明記してくれる
Red Hat Enterprise Linux 8 for x86_64 - AppStream - Extended Update Support from RHUI (RPMs)
Name Stream Profiles Summary
php 7.2 d eus common d, devel, minimal PHP scripting language
php 7.3 common d, devel, minimal PHP scripting language
php 7.4 common d, devel, minimal PHP scripting language
php 8.0 common d, devel, minimal
ただ上記表示の場合でPHP8.0以上を使用したいケースなどがあると、EUS版リポジトリには存在しないためRemiなどからインストールする必要が出てくる
モジュールストリーム
dnfに関連する、同じソフトウェアの異なるバージョンを使える仕組み
例えばdnf modle list phpとすると、色々なバージョンが出てくる
[d]とついているものが、デフォルトで有効なストリームであり、指定のない場合はそのバージョンが落とされる
また、別のバージョンを使ってる時はリセットしてから、enableなどで有効下する必要がある
コマンド
code:sh
# 導入するモジュールのチェック
dnf module list xxx
# 有効下されているモジュールストリームのリセットと有効化
dnf module reset xxx
dnf module enable xxx # dnf module enable php:remi-8.2 とか
# 導入
dnf install php # この流れの場合、enableとしたphp:remi-8.2が入る
# 導入したログを見る
dnf history
# 詳細 historyで表示されたIDを指定し、導入されたパッケージの一覧を確認できる
dnf history info 3
またコマンドではないが、導入時のログは下記で見れるので、メモし忘れた時は見る
$ less /var/log/dnf.log
その他
RHELに限った知識ではないが、色々
code:sh
# IP制限などが掛かっている時、サーバ内からcurlでチェックができる
curl -vk localhost:80