1、卸载原有的yum

 [app@localhost ~]$ su - root
Password:
Last login: Wed Apr :: CST on pts/
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
total
-rw-r--r--. root root Apr : redhat.repo
[root@localhost yum.repos.d]# tail redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated. Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
#
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
repolist:
[root@localhost yum.repos.d]# rpm -qa | grep yum
yum-utils-1.1.-.el7.noarch
yum-metadata-parser-1.1.-.el7.x86_64
yum-3.4.-.el7.noarch
PackageKit-yum-1.1.-.el7.x86_64
yum-rhn-plugin-2.0.-.el7.noarch
yum-langpacks-0.4.-.el7.noarch
[root@localhost yum.repos.d]# rpm -qa|grep yum|xargs rpm -e --nodeps

2、联网下载yum

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-50.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/PackageKit-yum-1.1.10-1.el7.centos.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/PackageKit-1.1.10-1.el7.centos.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/PackageKit-glib-1.1.10-1.el7.centos.x86_64.rpm

3、安装yum

[root@localhost yum]# rpm -ivh yum-*
warning: yum-3.4.-.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [%]
Updating / installing...
:yum-metadata-parser-1.1.-.el7 ################################# [ %]
:yum-plugin-fastestmirror-1.1.-################################# [ %]
:yum-3.4.-.el7.centos ################################# [ %]
:yum-langpacks-0.4.-.el7 ################################# [ %]
:yum-rhn-plugin-2.0.-.el7 ################################# [ %]
:yum-utils-1.1.-.el7 ################################# [%]
[root@localhost yum]#

4、获取阿里云repo

[root@localhost yum]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
total
-rw-r--r--. root root Apr : redhat.repo
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
---- ::-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 27.221.93.99, 27.221.93.94, 27.221.56.136, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|27.221.93.99|:... connected.
HTTP request sent, awaiting response... OK
Length: (.5K) [application/octet-stream]
Saving to: ‘Centos-.repo’ %[==================================================================================================>] , --.-K/s in 0s -- :: (8.27 MB/s) - ‘Centos-.repo’ saved [/] [root@localhost yum.repos.d]# ls
Centos-.repo redhat.repo
[root@localhost yum.repos.d]#

5、替换repo里的版本号

[root@localhost yum.repos.d]#  sed -i 's/$releasever/7/g' /etc/yum.repos.d/Centos-.repo
[root@localhost yum.repos.d]#

6、清理,重建缓存,查看repolist

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB ::
extras | 3.4 kB ::
updates | 3.4 kB ::
(/): base/x86_64/group_gz | kB ::
(/): extras/x86_64/prestodelta | kB ::
(/): base/x86_64/other_db | 2.6 MB ::
(/): extras/x86_64/primary_db | kB ::
(/): extras/x86_64/filelists_db | kB ::
(/): base/x86_64/filelists_db | 7.1 MB ::
(/): updates/x86_64/prestodelta | kB ::
(/): updates/x86_64/other_db | kB ::
(/): updates/x86_64/filelists_db | 3.0 MB ::
updates/x86_64/primary_db FAILED ========- ] 1.2 MB/s | MB :: ETA
http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/repodata/77e1064f4695d093417e973b314fbb8199458df1af4428ee452be30159ee5598-primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
(/): updates/x86_64/primary_db | 3.4 MB ::
base/x86_64/primary_db FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/6614b3605d961a4aaec45d74ac4e5e713e517debb3ee454a1c91097955780697-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused"
Trying other mirror.
extras/x86_64/other_db FAILED ======================= ] kB/s | MB :: ETA
http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/repodata/e3fc99b365562ee4f9dbd898f8acbbad55e2a5e5cf787dab83017026971ccbc9-other.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused"
Trying other mirror.
(/): extras/x86_64/other_db | kB ::
(/): base/x86_64/primary_db | 6.0 MB ::
Metadata Cache Created
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/x86_64 CentOS- - Base - mirrors.aliyun.com ,
extras/x86_64 CentOS- - Extras - mirrors.aliyun.com
updates/x86_64 CentOS- - Updates - mirrors.aliyun.com ,
repolist: ,
[root@localhost yum.repos.d]#

redhat7初始化yum源的更多相关文章

  1. Redhat7配置yum源(本地源和网络源)

    Redhat7配置yum源(本地源和网络源)   目录 一:配置本地yum源 二:配置网络yum源 YUM(Yellow dog Updater Modified): yum是基于RPM包构建的软件更 ...

  2. Redhat7 安装 yum源(亲测有效)

    由于之前安装Redhat7 想安装vsftpd  使用yum   install vsftpd 报错: This system is not registered to Red Hat Subscri ...

  3. redhat初始化yum源,使用阿里云yum源

    本篇文章介绍redhat7使用国内阿里云yum安装源的方法,源地址使用的https://mirrors.aliyun.com/对应使用Centos7下的安装源. 在学习<Linux就该这么学&g ...

  4. RedHat7 配置yum源

    今天需要搭建一个测试环境,没办法只能找了个Linux服务器,但是之前的其他同事弄过是其他系统的,不是centos的,所以只能自己搞. 合计直接百度,怎么安装docker,结果一直报错,下载失败之类的 ...

  5. # Redhat7 安装 yum源

    第一步:先卸载原来的yum rpm -qa |grep yum 查看原来是否安装 yum-3.4.3-118.el7.noarch yum-utils-1.1.31-24.el7.noarch yum ...

  6. [Linux]Redhat7配置CentOS7 YUM源

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

  7. Linux之RedHat7如何更换yum源

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

  8. RedHat7.0 网络源的配置

    RedHat7.0 yum源的配置 写这篇随笔的目的 为了记录自己的操作,能够为以后的再次配置提供参考 因为网上的教程都有些年代了,为了方便其他同学方便配置 提高下自己的写作水平 参考资料 RedHa ...

  9. redhat7 配置使用centos的yum源

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

随机推荐

  1. selenium3(java)之屏幕截图操作

    selenium提供了截图的功能,分别是接口是TakesScreenshot和类RemoteWebDriver.该功能是在运行测试用例的过程中,需要验证某个元素的状态或者显示的数值时,可以将屏幕截取下 ...

  2. RabbitMQ之安装

    RabbitMQ是一个消息代理.它的核心原理非常简单:接收和发送消息.你可以把它想像成一个邮局:你把信件放入邮箱,邮递员就会把信件投递到你的收件人处.在这个比喻中,RabbitMQ就扮演着邮箱.邮局以 ...

  3. linux 下安装 php kafka 扩展

    我们使用官方推荐 php kafka 扩展 phpkafka,由于该扩展是基于 librdkafka 开发,所以我们首先需要安装 librdkafka 下载地址:http://kafka.apache ...

  4. 能ping通虚拟机中的Ubuntu,使用XShell连不上

    1.在宿主机上telnet 虚拟机ip  22如果显示端口无法接通,说明你的/etc/init.d/sshd 是stop或者是异常的. 2.如果没有sshd服务,使用" sudo apt-g ...

  5. Java中的String,StringBuilder,StringBuffer

    String被final修饰,不可变,每次更改其实是重新创建了一个对象.StringBuilder,StringBuffer是可变的. StringBuffer是线程安全的,StringBuilder ...

  6. 多线程threading

    threading用于提供线程相关的操作,线程是应用程序中工作的最小单元.python当前版本的多线程库没有实现优先级.线程组,线程也不能被停止.暂停.恢复.中断. 1.     threading模 ...

  7. 洛谷P3469[POI2008]BLO-Blockade

    题目 割点模板题. 可以将图中的所有点分成两部分,一部分是去掉之后不影响图的连通性的点,一部分是去掉之后影响连通性的点,称其为割点. 然后分两种情况讨论,如果该点不是割点,则最终结果直接加上2*(n- ...

  8. nexus5 root

    LG nexus5 安装新的lineage 14.1系统卡刷 supersuV2.82失败,开机卡动画界面. 改回刷入2016年11月下的cm 13 的包,三清后卡刷supersuV2.82,成功.

  9. linux查看主板型号、CPU、显卡、硬盘等信息

    系统 uname -a # 查看内核/操作系统/CPU信息 head -n 1 /etc/issue # 查看操作系统版本 cat /proc/cpuinfo # 查看CPU信息 hostname # ...

  10. functools模块中partial的使用

    一.简介 functools.partial(func,* args,**关键字) 返回一个新的部分对象,当被调用时,其行为类似于使用位置参数args 和关键字参数关键字调用的func.如果为调用提供 ...