CentOSやRHELのyumは、インターネット上のリポジトリからパッケージをダウンロードする設定になっている。インターネットに接続できないテス
ト環境などでは、DVDから読み込むこともできる。いちいちDVDメディアに焼かなくても、ISOイメージからインストールすることもできる。DVDメ
ディアからインストールするCentOS 6のコマンドは次の通り。
# yum --disablerepo=\* --enablerepo=c6-media install system-config-lvm
デフォルトで有効になっているサーバリポジトリを無効にして、メディアをリポジトリとする設定ファイルc6-mediaを有効にする。このコマンドは
/etc/yum.repos.d/CentOS-Media.repoに書いてある。この設定ファイルは、以下のパス名のどれかでDVDメディアがマウ
ントされていることを想定している。
/media/CentOS/
/media/cdrom/
/media/cdrecorder/
しかしホストOSにあるISOイメージをVMware Playerでマウントすると、DVD#1もDVD#2も/media/CentOS_6.2_Finalというパス名が自動的に割り当てられ、パッケージを読み込めない。
# yum --disablerepo=\* --enablerepo=c6-media install system-config-lvm
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* c6-media:
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml
Trying other mirror.
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
Trying other mirror.
file:///media/cdrom/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrom/repodata/repomd.xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: c6-media. Please verify its path and try again
そこで、/mediaの下にcdrom(もしくはCentOSやcdrecorder)という名前でシンボリックリンクを作る。
# cd /media
# ln -s CentOS_6.2_Final cdrom
# ls -l
total 4
lrwxrwxrwx. 1 root root 16 Jan 25 12:45 cdrom -> CentOS_6.2_Final
drwxr-xr-x. 6 XXXX XXXX 4096 Dec 17 09:03 CentOS_6.2_Final
これでyumが動くようになる。
# yum --disablerepo=\* --enablerepo=c6-media install system-config-lvm
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* c6-media:
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml
Trying other mirror.
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
Trying other mirror.
c6-media | 4.0 kB 00:00 ...
c6-media/primary_db | 3.5 MB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package system-config-lvm.noarch 0:1.1.12-9.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
system-config-lvm noarch 1.1.12-9.el6 c6-media 463 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 463 k
Installed size: 3.1 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : system-config-lvm-1.1.12-9.el6.noarch 1/1
Installed:
system-config-lvm.noarch 0:1.1.12-9.el6
Complete!
(2012/08/02追記)
インターネットから完全に切り離された環境で、DVDのみをインストールメディアとして使いたいときは、CentOS-Base.repoの各セクション([base]、[updates]など)に「enabled=0」を記述し、CentOS-Media.repoの「enabled=0」を「enabled=1」に書き換える。これでGUIのPackage Managerを使ってソフトウェアを追加できる。
最近のコメント