新安装了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. JAVA RPC(二)序列化协议杂谈

    序列化和反序列化作为Java里一个较为基础的知识点,大家心里也有那么几句要说的,但我相信很多小伙伴掌握的也就是那么几句而已,如果再深究问一下Java如何实现序列化和反序列化的,就可能不知所措了!遥记当 ...

  2. composer相关使用

    #composer安装 curl -sS https://getcomposer.org/installer | php #如果该命令执行不了,通过其他方式下载install文件后再执行“php in ...

  3. VS2017 SVN插件-AnkhSVN

    AnkhSVN 该插件可以直接在vs017扩展和工具里安装,安装完成即可使用 默认VS自带的源码管理工具是GIT 如果已经使用需要手动切换到SVN:工具==>选项菜单中设置 SVN使用方法: 1 ...

  4. windows red5相关

    red5部署 前段时间把red5服务器搭建好了,现在记录下是如何搭建的.1,下载对应版本的red5https://github.com/Red5/red5-server/releases2,如果没有安 ...

  5. spring注解:反射与配置

    上图运行结果按下图配置文件中的配置,进行的spring扫描加载.无论是componentScan方式,还是xml配置方式,如果one是实现了一个接口的类,如one_Interface,那么在程序中用o ...

  6. TCP/IP 免费ARP

    免费ARP Gratuitous ARP也称为免费ARP.Gratui ARP不同于一般的ARP请求,它并非期待得到IP对应的MAC地址,而是当主机启动的时候,将发送一个Gratuitous arp请 ...

  7. Mysql事务隔离级别学习

    这篇文章主要谈谈Mysql事务隔离级别的区别,以及自己的一些感受. 自己一直以来没搞懂“可重复读”和可提交读“两者之间的区别,通过此次的实践,清楚了两者之间的区别.废话不说,先上图看看这几个事务隔离级 ...

  8. 远程Gitlab新建的分支在IDEA里不显示

    cmd命令打开dos命令窗口,进入项目文件所在目录 (**TIPS:在资源管理器的地址栏里直接输入cmd,就会打开命令窗口,并且此时命令窗口显示的路径就是当前路径)git branch -a:可以查看 ...

  9. Error:java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [web_dao,web_service] are excluded from annotation processing

    早上学习maven环境搭建时遇到的这个问题 下面这个错误的大概意思是:模块之间的互相依赖 Error:java: Annotation processing is not supported for ...

  10. CentOS 7 安装samba服务

    STEP 1. 安装 #安装 [root@study ~]yum install smaba [root@study ~]systemctl start smb nmb STEP 2. 建立共享目录以 ...