本文已参与 ⌈新人创作礼⌋ 活动,一起开启掘金创作之路
redhat5.1下搭建本地yum源报错处理方法
环境说明
[root@localhost yum]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.1 (Tikanga)
[root@localhost yum]#
[root@localhost yum]# mount /dev/cdrom /mnt(挂载ISO镜像)
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost yum]#
配置repo文件
[root@localhost ~]# cat /etc/yum.repos.d/abc.repo
[abc]
name=Red Hat Enterprise Linux 5
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0
[root@localhost ~]#
刷新yum源
[root@localhost ~]# yum clean all;yum makecache
执行yum 命令报错
[root@localhost yum]# yum update openssh Loading “installonlyn” plugin
Loading “rhnplugin” plugin Loading “security” plugin This system is
not registered with RHN. RHN support will be disabled. Setting up
Update Process Setting up repositories Reading repository metadata in
from local files Skipping security plugin, no data Resolving
Dependencies Skipping security plugin, no data
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for openssh to pack into transaction set. media://1409145026.642170%231/openssh-4.3p2-82.el5.x86_64.rpm: [Errno
4] IOError: Trying other
mirror. Error: failed to retrieve openssh-4.3p2-82.el5.x86_64.rpm from
abc error was [Errno 4] IOError:
报错处理方法:
[root@localhost ~]# ls -l /usr/lib/python2.4/site-packages/yum/yumRepo.py
-rw-r–r-- 1 root root 25285 May 27 08:21 /usr/lib/python2.4/site-packages/yum/yumRepo.py
[root@localhost ~]#
备份文件
cp -p yumRepo.py yumRepo.py.bak
编辑vi yumRepo.py文件,找到remote = url + ‘/’ + relative
根据ISO挂载路径修改如下即可:
remote = “/mnt/Server” + ‘/’ + relative
再次刷新yum源
[root@localhost ~]# yum clean all;yum makecache
执行yum 命令
[root@localhost ~]# yum update openssh
Loading “installonlyn” plugin Loading “rhnplugin” plugin Loading
“security” plugin This system is not registered with RHN. RHN support
will be disabled. Setting up Update Process Setting up repositories
Reading repository metadata in from local files Skipping security
plugin, no data Resolving Dependencies Skipping security plugin, no
data
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for openssh to pack into transaction set.
—> Package openssh.x86_64 0:4.3p2-82.el5 set to be updated
–> Running transaction check
–> Processing Dependency: openssh = 4.3p2-24.el5 for package: openssh-askpass
–> Processing Dependency: openssl >= 0.9.8e for package: openssh
–> Processing Dependency: openssh = 4.3p2-24.el5 for package: openssh-server
–> Processing Dependency: libfipscheck.so.1()(64bit) for package: openssh
–> Processing Dependency: openssh = 4.3p2-24.el5 for package: openssh-clients
–> Restarting Dependency Resolution with new changes.
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for fipscheck-lib to pack into transaction set.
—> Package fipscheck-lib.x86_64 0:1.2.0-1.el5 set to be updated
—> Downloading header for openssl to pack into transaction set.
—> Package openssl.x86_64 0:0.9.8e-27.el5_10.4 set to be updated
—> Downloading header for openssh-askpass to pack into transaction set.
—> Package openssh-askpass.x86_64 0:4.3p2-82.el5 set to be updated
—> Downloading header for openssh-clients to pack into transaction set.
—> Package openssh-clients.x86_64 0:4.3p2-82.el5 set to be updated
—> Downloading header for openssh-server to pack into transaction set.
—> Package openssh-server.x86_64 0:4.3p2-82.el5 set to be updated
–> Running transaction check
–> Processing Dependency: /usr/bin/fipscheck for package: fipscheck-lib
–> Restarting Dependency Resolution with new changes.
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for fipscheck to pack into transaction set.
—> Package fipscheck.x86_64 0:1.2.0-1.el5 set to be updated
–> Running transaction checkDependencies Resolved
============================================================================= Package Arch Version Repository
Size
============================================================================= Updating: openssh x86_64 4.3p2-82.el5 abc
291 k Installing for dependencies: fipscheck x86_64
1.2.0-1.el5 abc 13 k fipscheck-lib x86_64 1.2.0-1.el5 abc 6.7 k Updating for
dependencies: openssh-askpass x86_64 4.3p2-82.el5 abc
43 k openssh-clients x86_64 4.3p2-82.el5 abc
456 k openssh-server x86_64 4.3p2-82.el5 abc
280 k openssl x86_64 0.9.8e-27.el5_10.4 abc
1.5 MTransaction Summary
============================================================================= Install 2 Package(s) Update 5 Package(s)
Remove 0 Package(s)Total download size: 2.5 M Is this ok [y/N]: