Rehat Enterprise Linux 5:配置本地yum源
Rehat Enterprise Linux 5:配置本地yum源,测试正常。
配置本地yum源
本地源首选使用DVD安装盘
1.挂载镜像
mount -t iso9660 /dev/cdrom /media/
命令将镜像挂载到/media/文件夹下。
2 编辑仓库设置
编辑/etc/yum.repos.d/rhel-debuginfo.repo,删掉原来的内容,添加如下内容:
[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///media/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///media/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=file:///media/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///media/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releas
3 修改yum代码
修改/usr/lib/Python2.4/site-packages/yum/yumRepo.py
找到
remote = url + '/' + relative
这行,修改为remote = '/media/Server' + '/' + relative
4.导入GPG key
#rpm --import /etc/pki/rpm-gpg/RPM*
不导入的话,在yum install包时会有下面的提示:
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
Importing GPG key 0x37017186 "Red Hat, Inc. (release key) <[email protected]>"
这是由于yum安装了旧版本的GPG keys造成的
做完上面的设置后就可以通过本地资源进行yum安装所需的包了.
推荐阅读: