Redhat 7自带的yum源需要付费注册,未注册情况下会报如下错误,且用yum repolist all检查源数目为0。这时候需要将RedHat 7自带的yum源 替换成CentOS 7免费源

解决方法一:

一,使用网易163开源镜像站  http://mirrors.163.com/
#,查看原有yum包
rpm -qa|gerp yum #,卸载yum包
rpm -qa|grep yum|xargs rpm -e --nodeps
rpm -qa|grep yum #,创建下载路径,下载centos7. yum包
mkdir /tmp/pkg && cd /tmp/pkg
wget http://mirrors.163.com/centos/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm wget http://mirrors.163.com/centos/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.163.com/centos/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm #,安装下载好的rpm包
rpm -ivh yum-*
rpm -qa|grep yum #,替换原有源
cd /etc/yum.repos.d/ && rm -rfv * #,下载163源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #,将下载好的文件中的 $releasever 全部修改为目标版本 7.5.
#为防止出错,以下为改好版本
[base]
name=CentOS-7.5. - Base - .com
#mirrorlist=http://mirrorlist.centos.org/?release=7.5.1804&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7.5.1804/os/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-7.5. - Updates - .com
#mirrorlist=http://mirrorlist.centos.org/?release=7.5.1804&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7.5.1804/updates/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-7.5. - Extras - .com
#mirrorlist=http://mirrorlist.centos.org/?release=7.5.1804&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7.5.1804/extras/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7.5. - Plus - .com
baseurl=http://mirrors.163.com/centos/7.5.1804/centosplus/$basearch/
gpgcheck=
enabled=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #,更新
yum clean all && yum makecache #,查看是否更新成功
yum repolist all

 方法二:思路一样,此处只提供重要命令

,删除自带yum包
rpm -aq|grep yum|xargs rpm -e --nodeps ,下载阿里云rpm包
wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm ,安装下载好的rpm包
rpm -ivh yum-* ,配置阿里云源文件
vim /etc/yum.repos.d/aliyun.repo [base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/os/$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/updates/$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7 [extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/extras//$basearch/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7 [centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/centosplus//$basearch/
gpgcheck=
enabled= ,更新
yum clean all && yum makecache

 补充:

阿里云 centos 的yum源
,切记先做好备份
,下载
CentOS
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

redhat7.5 替换yum源的更多相关文章

  1. Linux之RedHat7如何更换yum源

    目前,我们常见的系统大概就是Windows.Linux和Mac OS了.Windows系统应该是大部分人最早开始接触的系统,毕竟Windows系统使用起来相当方便,只需要点点鼠标,外加会简单的打字,一 ...

  2. redhat7.4切换yum源为免费源

    1.redhat是Linux系统中付费的企业版,虽然安装什么是免费的,但是需要注册. 如果你有注册码,暂请出门左拐(我没有注册码,所以我也不会注册,不用往下看了). Linux系统收费版:RedHat ...

  3. [Linux]Redhat7配置CentOS7 YUM源

    一.简介 安装Redhat7并配置了网卡之后,虽然可以直接ping www.baidu.com,但是执行yum install的命令时提示如下信息: [root@ansible ~]# yum ins ...

  4. linux替换yum源及配置本地源

    linux系统安装后自带的bash源由于在国外,安装软件包的时候会非常慢,最好替换一下yum源. ​关于yum源的简单介绍 ​           yum的主要功能是更方便地添加,删除和更新rpmba ...

  5. RedHat6.9下替换yum源

    因为RedHat的yum需要收费,且要注册后才能使用.因此想把Yum源更新为CentOS的.使用的RedHat版本为6.9,因此对应的CentOS版本也要为6.9 1. 检查并删除原有的yum源 rp ...

  6. redhat替换yum源时redhat.repo无法删除或禁用的问题

    rhel7.3系统,在替换自带的repo源时发现无论是将redhat.repo重命名还是删除,在执行yum命令后总是自动又生成redhat.repo得问题,导致替换的CentOS-Base.repo, ...

  7. redhat7.3安装yum源

    #检查rehat自带的yum源[root@localhost ~]# rpm -qa | grep yum -.el7.noarch -.el7.noarch -.el7.noarch -.el7.n ...

  8. redhat7.2配置yum源

      版权声明:声明:本博客欢迎转发,但请保留原作者信息!本站文章皆基于公开来源信息,仅代表作者个人观点 https://blog.csdn.net/wylfengyujiancheng/article ...

  9. Centos下替换yum源为阿里云源

    阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步:备份原镜像文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum ...

随机推荐

  1. spring ObjectFactory

    AspectJAwareAdvisorAutoProxyCreator implements PostProcessor postProcessorAfterInitialization(Object ...

  2. poj3666/CF714E/hdu5256/BZOJ1367(???) Making the Grade[线性DP+离散化]

    给个$n<=2000$长度数列,可以把每个数改为另一个数代价是两数之差的绝对值.求把它改为单调不增or不减序列最小代价. 话说这题其实是一个结论题..找到结论应该就很好做了呢. 手玩的时候就有感 ...

  3. IT项目开发流程

    项目开发流程: 一.需求分析:相关系统分析员向用户初步了解需求,然后用相关的工具软件列出要开发的系统的大功能模块,每个大功能模块有哪些小功能模块,对于有些需求比较明确相关的界面时,在这一步里面可以初步 ...

  4. TCP/IP网络编程系列之一(初级)

    概述 网络编程实际上就是编写程序使两台联网的计算机相互的交换数据.操作系统会提供名为“ 套接字 ”的部件.套接字是网络数据传输的软件设备,即使对网络数据传输原理不太熟悉也无关紧要.我们也能通过套接字完 ...

  5. js-点击+加关注变成已关注,已关注状态时,鼠标滑动上的状态时取消关注

    效果: HTML: <div class="rightBtn cur">+关注</div> CSS: .rightBtn{ width: 80px; hei ...

  6. getch和getchar的区别

    造冰箱的大熊猫@cnblogs 2018/11/30 1.getc() 头文件:stdio.h 函数声明:int getc ( FILE * stream ); 功能: - 返回流(stream)当前 ...

  7. css grid 随笔

    原文出自Arien的博客https://www.w3cplus.com/css3/line-base-placement-layout.html 首先定义一个网格 1.可以给父容器的display属性 ...

  8. G. Gangsters in Central City

    给出一棵$1$为根节点的含$n$个节点的树,叶子节点都是房屋,在一个集合里面添加房屋和移除房屋. 每一次添加和移除后,回答下面两个问题. 1.  使得已选房屋都不能从根节点到达,最少需要砍多少条边. ...

  9. sh_08_格式化字符串

    sh_08_格式化字符串 info_tuple = ("小明", 21, 1.85) # 格式化字符串后面的 `()` 本质上就是元组 print("%s 年龄是 %d ...

  10. Python3学习笔记(十一):函数参数详解

    一.位置参数 根据参数的位置来传递参数,调用函数时,传递的参数顺序和个数必须和定义时完全一致 # 定义函数 def man(name, age): print("My name is %s, ...