Red Hat6设置使用CentOS的yum源

时间:2022-11-30 19:24:23

  环境查看

Red Hat6设置使用CentOS的yum源

  red hat系统使用自己默认的yum源未注册在使用yum安装软件的时候会出现以下错误提示

Red Hat6设置使用CentOS的yum源

  可以修改成centos的yum源

  卸载yum软件

rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
rpm -qa |grep yum (查询确认)

  下载软件包(redhat7同理在对应目录下载对应版本软件)

http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

  安装python包

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm

  安装python-urlgrabber报错

warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch

Red Hat6设置使用CentOS的yum源

  原因:系统包含老版本

Red Hat6设置使用CentOS的yum源

  卸载

rpm -e python-urlgrabber-3.9.1-9.el6.noarch

  再次安装成功

Red Hat6设置使用CentOS的yum源

  安装yum-metadata

rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

  安装yum

 rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

  PS:需要两个包一起安装否则报依赖错误

  

  更改yum源

  下载配置文件

http://mirrors.163.com/.help/CentOS6-Base-163.repo

  redhat7下载

http://mirrors.aliyun.com/repo/Centos-7.repo

  放置文件夹/etc/yum.repos.d

  替换内容(这里的red hat版本为6所以替换为6 redhat7就修改为7)

sed -i "s#\$releasever#6#g" CentOS6-Base-163.repo

  备份原有文件使用新文件替换

mv rhel-source.repo rhel-source.repo.bak
mv CentOS6-Base-163.repo rhel-source.repo

  清理缓存

 yum clean all

  将服务器软件包信息缓存至本地,提高搜索安装效率

yum makecache

  测试安装

Red Hat6设置使用CentOS的yum源

  测试安装

yum -y install lrzsz