インストールメディアをyumリポジトリとして登録・使用する
タイトルの通り。
1. 動作確認環境
- Oracle VM VirtualBox 4.3.28
- Redhat Enterprise Linux 7.0
2. 事前準備
3. yumリポジトリ設定
まず、RHELインストールメディアを読み取り専用で/mediaにマウントする。
[root@localhost ~]# mount -r /dev/sr0 /media
[root@localhost ~]# vi /etc/yum.repos.d/rheldvd.repo [rhel-iso] name=Red Hat Enterprise Linux 7.0 ISO media baseurl=file:///media enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
上記ファイルの設定内容は以下の通り。
- "[...]"はリポジトリ識別子(任意の文字列)
- "name"はリポジトリ名(任意の文字列)
- "baseurl"はリポジトリベースディレクトリ。"
/repodata/repomd.xml"が存在しない場合、エラーとなる。 - "enabled"はリポジトリの有効(1)/無効(0)設定。
- "gpgcheck"はGPGを使用した署名確認の有効(1)/無効(0)設定。
- "gpgkey"はGPG公開鍵ファイルパス。
後は、yumコマンドで各種パッケージをインストールする。
[root@localhost ~]# yum search vim 読み込んだプラグイン:product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel-iso | 4.1 kB 00:00 (1/2): rhel-iso/group_gz | 134 kB 00:00 (2/2): rhel-iso/primary_db | 3.4 MB 00:00 =============================== N/S matched: vim =============================== vim-X11.x86_64 : The VIM version of the vi editor for the X Window System vim-common.x86_64 : The common files needed by any version of the VIM editor vim-enhanced.x86_64 : A version of the VIM editor which includes recent : enhancements vim-filesystem.x86_64 : VIM filesystem layout vim-minimal.x86_64 : A minimal version of the VIM editor Name and summary matches only, use "search all" for everything.
インストール完了後はISOメディアをアンマウントして、リポジトリを無効化しておく。
[root@localhost ~]# umount /media [root@localhost ~]# vi /etc/yum.repos.d/rheldvd.repo [rhel-iso] name=Red Hat Enterprise Linux 7.0 ISO baseurl=file:///media enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [root@localhost ~]# yum clean all