先介紹下我的redhat 6.2的ISO 文件放在sdb5上。
因此我創建兩個目錄:
mkdir /tmp/file1
mkdir /tmp/file2
將sdb5上的redhat 6.2的ISO掛載到/tmp/file1上:
mount /dev/sdb5 /tmp/file1
redhat 6.2的ISO這時候還不能真接讀取,仍需要進一步掛載:
mount -o --loop /tmp/file1/rhel-server-6.2-x86_64-dvd.iso /tmp/file2
這時,redhat 6.2的ISO文件纔可用。
到/tmp/file2/Packages下,安裝順序安裝三個rpm包:
python-kerberos-1.1-6.2.el6.x86_64
yum-3.2.29-22.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
安裝好三個包以後,到/etc/yum.repos.d/下。將配置文件保存一份(備份)。
cp rhel-source.repo rhel-source.repo.bak (還有一份文件redhat.repo不是配置文件,因爲裏面是空的)
將redhat 6.2的ISO放到文件系統上。
mkdir /home/redhatISO
cp -rp /tmp/file2 /home/redhatISO
在配置文件中進行配置.
vim /etc/yum.repos.d/rhel-source.repo:
[rhel-source] #一個標識,可自己定義
name=Red Hat Enterprise Linux $releasever - $basearch - Source #一個名稱而已,可自已定義。
baseurl=file:///home/redhatISO/ #安裝源在本地的路徑。安裝包中本地何處取得。
enabled=1 #選項表示源的狀態,1表示開啓,0表示禁用
gpgcheck=1 #選項表示對源進行gpg的校驗,0爲不檢查,1爲檢查
gpgkey=file:///home/redhatISO/RPM-GPG-KEY-redhat-release #進行gpg校驗工具的路徑。應該與本地源路徑一致。
進行yum的試用:
[root@chen Packages]# yum install zsh
…………………………………………
======================================================================================
Package Arch Version Repository Size
======================================================================================
Installing:
zsh x86_64 4.3.10-4.1.el6 rhel-source 2.1 M
Total download size: 2.1 M
Installed size: 4.8 M
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-0.5.8-19.el6.x86_64 has missing requires of PackageKit-yum = ('0', '0.5.8', '19.el6')
PackageKit-0.5.8-19.el6.x86_64 has missing requires of PackageKit-yum-plugin = ('0', '0.5.8', '19.el6')
rhn-check-1.0.0-73.el6.noarch has missing requires of yum-rhn-plugin >= ('0', '0.9.1', '35')
Installed:
zsh.x86_64 0:4.3.10-4.1.el6
Complete!
[root@chen Packages]#