新安装了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. Fiddler_菜单栏介绍_02

    Fiddler界面 [Statistics]请求的性能数据分析 [Inspectors]查看数据内容 Inspectors是用于查看会话的内容,上半部分是请求的内容,下半部分是响应的内容: [Auto ...

  2. 安装VC6.0安装步骤及心得体会

    一.安装步骤: 1.打开网站https://pan.baidu.com/s/nxee/AD ,输入提取密码:wdhk. 2.登录微信账号,将软件下载到D盘. 3.鼠标右键点击VC6.0快捷方式,选择“ ...

  3. csrf jsonp

    网站b中包含向网站a发送的请求,那么网站b就会获得网站a的cookie,网站a登录了则网站b的cookie中会有网站a的sessionid,此时如果网站a对外提供需要sessionid的jsonp接口 ...

  4. 2019春第七周作业Compile Summarize

    这个作业属于那个课程 C语言程序设计II 这个作业要求在哪里 在这里 我在这个课程的目标是 能更加进一步的够熟练掌握指针的用法 这个作业在那个具体方面帮助我实现目标 指针对于基础题目的做法 参考文献与 ...

  5. vi命令删除

    3.删除 x :删除当前光标位置的字符 X    :删除当前光标位置前的字符 dd :删除当前行

  6. 【心得】-NO.114.面试.1 -【To HR And Interviewer】

    Style:Mac Series:Java Since:2018-09-10 End:2018-09-10 Total Hours:1 Degree Of Diffculty:5 Degree Of ...

  7. CJSON在项目中的应用

    无需编译,只需将 cJSON.c.cJSON.h 添加到项目中即可使用

  8. PHP----------线程安全和非线程安全的介绍

    1.Linux下的PHP,没有线程安全版和非线程安全版之分.从2000年10月20日发布的第一个Windows版的PHP3.0.17开始的都是线程安全的版本,直至5.2.1版本开始有Thread Sa ...

  9. PS跑马灯效果和更换图标

    最终效果     1.图片修改   跑马灯效果图 Head页面 使用的 IScript_HPDefaultHdr() in WEBLIB_PORTAL.PORTAL_HOMEPAGE 这个页面   一 ...

  10. [小程序] 微信小程序 picker 中range-key中必须带单引号

    原文地址:http://blog.csdn.net/u012329294/article/details/74906504 <view class="section"> ...