美文网首页
Redhat更换centOS的yum源

Redhat更换centOS的yum源

作者: 冒险小A | 来源:发表于2018-08-06 22:16 被阅读0次

    本来觉得Redhat和centOS没什么区别,玩了好久才发现yum居然不能用!Redhat给了我一记重锤啊!
    记录一下Redhat更换yum源的经历吧

    1. 卸载自带yum
      rpm -qa|grep yum|xargs rpm -e --nodeps
    2. 下载新yum for centOS
      下载地址为http://mirrors.163.com/centos/7/os/x86_64/Packages/
      下载包如下
      网易的镜像可能会更新,以最新为标准(名字基本不会换)
    3. 联合安装
      [root@localhost centOSyum]# rpm -ivh --force rpm-4.11.3-32.el7.x86_64.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm python-urlgrabber-3.10-8.el7.noarch.rpm yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
    4. 配置文件
      下载centOS7的镜像配置文件,地址:http://mirrors.163.com/.help/CentOS7-Base-163.repo
      移动到/etc/yum.repos.d文件夹下
      mv CentOS7-Base-163.repo /etc/yum.repos.d
    5. 修改配置文件内容
      在vi/vim下 一般模式 按冒号 粘贴:1,$s/$releasever/7/g
    6. 清除原缓存,安装新缓存,更新yum
      yum clean all
      yum makecache
      yum update
      测试yum状态:
      yum repolist all
      如果状态那里有禁用,就修改刚刚传的CentOS7-Base-163.repo文件
      改为enabled=1即可

    相关文章

      网友评论

          本文标题:Redhat更换centOS的yum源

          本文链接:https://www.haomeiwen.com/subject/ijrnvftx.html