0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RHEL8でisoイメージからレポジトリーを作成する

Posted at

目標

  • インターネットアクセスができない環境でRHEL8にyum(dnf)を使ってパッケージをインストールする

環境

  • RHEL8.5

準備するもの

  • RHEL8.5のメディアISOを事前に/tmp/isoにUpload

SUBSCRIPTION MANAGER リポジトリーの無効化

# cp -ip /etc/dnf/plugins/subscription-manager.conf /etc/dnf/plugins/subscription-manager.conf-org
# sed -i -e "s/enabled=1/enabled=0/" /etc/dnf/plugins/subscription-manager.conf

RHEL DVDレポジトリー作成

DVDをマウント
※OS再起動後も使用する場合は/etc/fstabにも登録する

# mount -o loop -t iso9660 /tmp/iso/rhel-8.5-x86_64-dvd.iso  /media/

レポジトリーファイル作成

# vi /etc/yum.repos.d/rhel8-dvd.repo

以下の内容をrhel8-dvd.repoに書く

[BaseOS]
name=RHEL8 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///media/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[AppStream]
name=RHEL8 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///media/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

レポジトリーのキャッシュをクリアー

# yum clean all 又は # dnf clean all
# yum repolist -v 又は # dnf repolist -v

yum(dnf) repolist repolist -vで以下の結果がでればOK

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

YUM version: 4.7.0
cachedir: /var/cache/dnf
Last metadata expiration check: 0:00:13 ago on Wed 02 Feb 2022 07:59:04 PM JST.
Repo-id            : AppStream
Repo-name          : RHEL 8 - AppStream
Repo-revision      : 1634110997
Repo-updated       : Wed 13 Oct 2021 04:43:19 PM JST
Repo-pkgs          : 6,220
Repo-available-pkgs: 5,282
Repo-size          : 8.2 G
Repo-baseurl       : file:///media/AppStream/
Repo-expire        : Never (last: Wed 02 Feb 2022 07:59:04 PM JST)
Repo-filename      : /etc/yum.repos.d/rhel8-dvd.repo

Repo-id            : BaseOS
Repo-name          : RHEL 8 - BaseOS
Repo-revision      : 1634111018
Repo-updated       : Wed 13 Oct 2021 04:43:39 PM JST
Repo-pkgs          : 1,708
Repo-available-pkgs: 1,706
Repo-size          : 1.2 G
Repo-baseurl       : file:///media/BaseOS/
Repo-expire        : Never (last: Wed 02 Feb 2022 07:59:03 PM JST)
Repo-filename      : /etc/yum.repos.d/rhel8-dvd.repo
Total packages: 7,928
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?