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. 查看linux的公网地址

    在搭建环境时,我们需要搭建公网IP地址,因此我们可以使用以下命令查看公网IP地址 curl ifconfig.me 同时我们可以通过以下命令查看公网地址 curl cip.cc

  2. [Alpha阶段]事后分析博客

    目录 Alpha阶段事后分析博客 设想和目标 计划 资源 变更管理 设计/实现 测试/发布 团队的角色,管理,合作 总结 讨论照片 Alpha阶段事后分析博客 作业要求:Alpha阶段事后分析 设想和 ...

  3. 菜鸟学python之程序初体验

    作业来源:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE1/homework/2684 1.字符串操作: 解析身份证号:生日.性别.出生地等. def id ...

  4. Node.js中的console.log()输出彩色字体

    转自:https://www.jianshu.com/p/cca3e72c3ba7 console.log('\033[42;30m DONE \033[40;32m Compiled success ...

  5. LR socket协议脚本

    socket协议分为TCP.UDP两种(区别与联系在此不做赘述),一种为长连接.一种为短连接.如果创建连接时在init中对应关闭连接在end中,则为长连接:如果创建关闭连接都是在action则为短连接 ...

  6. 如何在springboot项目中进行XSS过滤

    简单介绍 XSS : 跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS.恶意 ...

  7. java数组2

    package lastt; public class last { String name;int age; public last(String name,int age) { this.name ...

  8. IO模型、线程模型

    五种IO模型介绍和对比 https://juejin.im/post/5bd32b84f265da0ac962e7c9 Linux 的 IO 通信 以及 Reactor 线程模型浅析 https:// ...

  9. Shodan的http.favicon.hash语法详解与使用技巧

    在Shodan搜索中有一个关于网站icon图标的搜索语法,http.favicon.hash,我们可以使用这个语法来搜索出使用了同一icon图标的网站,不知道怎么用的朋友请参考我上一篇文章. 通过上一 ...

  10. Mongo集群Java连接时UnknownHostException错误

    今天在 Java 连接 Mongo 集群时报了一个超时的错误,但是在本地客户端连接单节点的时候却能连上,具体报的错误如下: Caused by: com.mongodb.MongoTimeoutExc ...