centos 配置yum 源

1.检查是否安装yum包。查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:
 
  
  rpm -qa |grep yum

 

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

 

 
3.下载新的yum包。使用Centos6.5的yum包
    1) 查看版本号和系统类别:
   cat /etc/redhat-release  

 我的是   Red Hat Enterprise Linux Server release 6.4 (Santiago)

        arch                                       ---x86_64
2)根据上一步,找到对应的yum包,然后下载。我的服务器对应的为(centos 7 可以访问http://mirror.centos.org/centos/7/os/x86_64/Packages ,去找对应的包):
      wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
     wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
     wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

 

依赖 包:
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

 

3) 安装:
      说明:四个一起安装 ,但我的机器上已预装的有 python,所以先强制安装 python-urlgrabber-3.9.1-11.el6.noarch.rpm
              
 rpm -ivh --force python-urlgrabber-3.9.1-11.el6.noarch.rpm

 

然后再安装 yum 的三个  
          
   rpm -ivh yum*.rpm

 

 
4)更换yum源,将原有源删除或备份到别的目下下:
        cd /etc/yum.repos.d/
        wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo

 

        vi CentOS6-Base-163.repo
        编辑文件,把文件里面的$releasever全部替换为版本号:6(注意,不是6.4! , centos 替换为7)最后保存!
4.清除原有缓存,重建缓存:
    clean all
    yum makecache
    
5.更新系统:   
    yum update  可以不更新。
 
centos7 yum 下载地址
 
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm

posted on 2018-12-12 21:16  gaizhongfeng  阅读(660)  评论(0编辑  收藏  举报