新安装了redhat7.安装后,登录系统,使用yum update 更新系统。提示:

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

无法更新。

redhat 默认自带的 yum 源需要注册,才能更新。我们想不花钱也可以更新,需要替换掉redhat的yum源。

1.检查是否安装yum包

查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

[root@syq yum.repos.d]# rpm -qa |grep yum
yum-3.4.3-118.el7.noarch
yum-utils-1.1.31-24.el7.noarch
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

2 删除redhat自带的yum包

卸载上面显示的所有yum包:

[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)

再用

[root@localhost ~]# rpm -qa |grep yum

[root@localhost ~]#

查看,无信息显示表示已经卸载完成。

3.下载新的yum包。使用Centos7的yum包

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm     ( rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps )

安装yum软件包

注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把yum-plugin-fastestmirror强制安装

rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm   rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps   rpm -Uvh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm --nodeps  rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm  rpm -ivh yum-utils-1.1.31-45.el7.noarch.rpm   rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm

4.更换yum源。使用阿里云的源

 第一步:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更改CentOS-Media.repo使其为不生效:

enabled=0
或者用163.com我是用的163.com的方法,

# 写 yum 配置文件

vim /etc/yum.repos.d/CentOS-Base.repo

*********************************************************************

#CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-$7 - Base - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/7/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$7 - Updates - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates

baseurl=http://mirrors.163.com/centos/7/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$7 - Extras - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/7/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$7 - Plus - 163.com

baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

*********************************************************************

yum clean all

 
第三步:修改CentOS-Base.repo文件中的$releasever全部替换为版本号7.

第四步:运行yum makecache生成缓存
yum clean all
yum makecache
yum update
注本文来源于https://www.cnblogs.com/syqlp/p/6555524.html 博主用的阿里云yum源 我用的是163.com

redhat7 配置使用centos的yum源的更多相关文章

  1. redhat6.5 配置使用centos的yum源

    新安装了redhat6.5安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Ma ...

  2. centos配置ADSL拨号 配置阿里云的yum源

    如果系统yum源有问题可以更改yum源配置阿里云的yum源1)下载repo文件 wget http://mirrors.aliyun.com/repo/Centos-7.repo(没有 wget命令可 ...

  3. CentOS使用yum源中自带的rpm包安装LAMP环境

    CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...

  4. Red Hat6设置使用CentOS的yum源

    环境查看 red hat系统使用自己默认的yum源未注册在使用yum安装软件的时候会出现以下错误提示 可以修改成centos的yum源 卸载yum软件 rpm -qa|grep yum|xargs r ...

  5. [转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源

    Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags  ...

  6. CentOS EPEL yum源

    CentOS EPEL yum源 用yum安装软件时,经常发现我们的yum源里面没有该软件,比如htop.网上查到的一个方案是需要自己去wget源码,然后configure,make,make ins ...

  7. 配置本机的yum源

    配置本机的yum源 环境:操作系统CentOS6.5 1.挂在安装光盘 [root@CentOS40 ~]# mkdir -p /mnt/cdrom[root@CentOS40 ~]# mount / ...

  8. CentOS更新yum源

    CentOS更新yum源 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2.下载 ...

  9. Centos更换yum源

    Centos更换yum源 步骤如下: 备份原始源 cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/ ...

随机推荐

  1. spark-sql自定义函数UDF和UDAF

    1 UDF对每个值进行处理: 2 UDAF对分组后的每个值处理(必须分组) SparkConf sparkConf = new SparkConf() .setMaster("local&q ...

  2. Centos修改时间为24小时制

    终端输入命令:tzselect 根据提示选择:5 --> 9-->1-->1-->okrm /etc/localtimeln -sf /usr/share/zoneinfo/A ...

  3. ElasticSearch - 信息聚合系列之聚合过滤

    摘要 聚合范围限定还有一个自然的扩展就是过滤.因为聚合是在查询结果范围内操作的,任何可以适用于查询的过滤器也可以应用在聚合上. 版本 elasticsearch版本: elasticsearch-2. ...

  4. Redis Keys的通用操作

    keys * 显示所有key 127.0.0.1:6379> keys * 1) "sort1" 2) "l2" 3) "set2" ...

  5. VUE项目注意点

    1.vue组件中img标签的src属性绑定数据: <img :src="img" alt="图片" /> //scriptdata() { img: ...

  6. Hello greenDAO(SQLite)

    一.配置Gradle Scripts: 1.1.build.gradle(Project:*****) buildscript { repositories { google() jcenter() ...

  7. Oracle删库跑路

    --10g R2 startup mount exclusive restrict; alter system enable restricted session; drop database; -- ...

  8. ZY

    2017*****1022:我是石翟夫:我的爱好是计算机: 我的码云个人主页是:https://gitee.com/S_DiF/events 我的第一个项目地址是:https://gitee.com/ ...

  9. IO多路复用之select,poll,epoll个人理解

    在看这三个东西之前,先从宏观的角度去看一下,他们的上一个范畴(阻塞IO和非阻塞IO和IO多路复用) 阻塞IO:套接口阻塞(connect的过程是阻塞的).套接口都是阻塞的. 应用程序进程-----re ...

  10. python迭代-如何在一个for语句中迭代多个可迭代对象

    如何在一个for语句中迭代多个可迭代对象 问题举例 (1)某班学生期末考试成绩,语文,数学,英语分别存储在3个列表中,同时迭代三个列表,计算每个学生的总分 (2)某年级有4个班,某次考试每班英语成绩分 ...