2.在虛擬機器上用iso製作yum源,及問題repomd.xml找不到解決
今天在學自動化安裝時遇到要安轉system-config-kickstart,自己做一下yum源,但遇到Errno 5] OSError: [Errno 2] No such file or directory: '/mnt/cdrom/LinuxSrc/repodata/repomd.xml',下面我把我的過程貼出來。
1.要在虛擬機器上讀取光碟iso映象
在VMware虛擬機器選單中點選VM->settings 彈出選單
點選CD/DVD
勾選右邊Connected和connect at power on
選擇Use ISO image file 選擇你安裝使用的iso的位置
點選ok按鈕,這時候虛擬機器就能讀取你的iso了
2.掛載光碟
為光碟建立一個掛載位置 mkdir /mnt/cdrom
將光碟掛載 mount -o loop /dev/cdrom /mnt/cdrom
3.設定以後開機自動掛載
編輯/etc/fstab
vi /etc/fstab
在最後新增一行:
/dev/cdrom /mnt/cdrom iso9660 defauts,loop 0 0
4.配置yum源
進入yum源目錄cd /etc/yum.repos/
ls 將看到一些已經存在的源,選一個複製重新命名為iso.repo,保留iso.repo將其他源備份並刪除[iso]
[iso]
name=RH5.8
baseurl=file:///mnt/cdrom<span style="font-family:Courier New;">/</span>
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
failovermethod=priority
enabled=1
gpgcheck=0</span>
儲存退出5.清除原來的yum,並更新
yum clean all 清理一下yum源
yum update 更新
這裡會出現以下內容
Loaded plugins: katello, product-id, security, subscription-manager Updating certificate-based repositories. Unable to read consumer identity file:///mnt/cdrom/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/mnt/cdrom/repodata/repomd.xml' Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: iso. Please verify its path and try again
6.解決repomd.xml找不到問題
我自己使用centos5.5學習的過程中並沒有出現以上內容,後來查資料發現,讀取源的時候redhat5.8會在Server。將iso.repo更改為以下內容
[iso]
name=RH5.8
baseurl=file:///mnt/cdrom/Server
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
failovermethod=priority
enabled=1
gpgcheck=0
yum clean all
yum update
這時候就能成功執行了!