给你的Red Hat Linux 5 搭建本地yum源

Red Hat的yum 工具给软件安装带来了极大的方便,节省了寻找依赖软件的时间。这里主叫介绍了一下在Red Hat Linux 5.x中搭建本地的yum源。方法介绍如下:

1) 挂在Redhat linux 5.X光盘:
如果光驱是自动加载的,就不用mount了,直接拷贝文件即可
# mkdir /usr/local/osfiles
# cp -r /media/RHEL_5*/* /usr/local/osfiles
 
如果光驱不是自动加载的,则操作如下
# mount /dev/cdrom  /mnt
# mkdir /usr/local/osfiles
# cp -r /mnt/* /usr/local/osfiles

2) 编辑/etc/yum.conf   增加下面的内容即可

[cdrom]
name=cdrom
baseurl=file:///usr/local/osfiles/Server
enabled=1
gpgcheck=1

可能遇到的问题:
1. 如果在安装软件时出现:类似 Public key for ****.rpm is not installed 的错误。则用root用户执行如下操作:
# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

2. 如果出现了后面的错误(can not find RHNS CA file),可以通过如下方式解决:
# cp /usr/share/rhn/RHNS-CA-CERT /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
# yum clean all

错误信息:
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
  File “/usr/bin/yum”, line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File “/usr/share/yum-cli/yummain.py”, line 229, in user_main
    errcode = main(args)
  File “/usr/share/yum-cli/yummain.py”, line 84, in main
    base.getOptionsConfig(args)
  File “/usr/share/yum-cli/cli.py”, line 184, in getOptionsConfig
    enabled_plugins=self.optparser._splitArg(opts.enableplugins))
  File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 205, in _getConfig
    self.plugins.run(‘init’)
  File “/usr/lib/python2.4/site-packages/yum/plugins.py”, line 176, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File “/usr/lib/yum-plugins/rhnplugin.py”, line 110, in init_hook
    login_info = up2dateAuth.getLoginInfo()
  File “/usr/share/rhn/up2date_client/up2dateAuth.py”, line 217, in getLoginInfo
    login()
  File “/usr/share/rhn/up2date_client/up2dateAuth.py”, line 168, in login
    server = rhnserver.RhnServer()
  File “/usr/share/rhn/up2date_client/rhnserver.py”, line 149, in __init__
    self._server = rpcServer.getServer()
  File “/usr/share/rhn/up2date_client/rpcServer.py”, line 168, in getServer
    raise up2dateErrors.SSLCertificateFileNotFound(msg)
up2date_client.up2dateErrors.SSLCertificateFileNotFound: ERROR: can not find RHNS CA file: /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT

发表评论

电子邮件地址不会被公开。 必填项已用*标注

机器人检查 *