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. VSCode python 遇到的问题:vscode can't open file '<unprintable file name>': [Errno 2] No such file or directory

    代码很简单,就两行: import pandas as pd import netCDF4 as nc dataset = nc.Dataset('20150101.nc') 环境:在VSCode中左 ...

  2. nginx安装,启动亲测有效

    一:安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel 二:安装PCRE,让 N ...

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

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

  4. jQuery的deferred对象实战应用(附:Exchar动态多条数据展示并在topic展示详细数据)

    解决三个后台请求都成功后先比较数据再处理数据的需求 今天碰到了一个问题,我需要创建一个图表,但是需要请求三个接口才能比较出指标数据,于是就看到了deferred对象 理论的补充在这里:http://w ...

  5. 【Linux】Linux主要目录以及说明

    主要目录以及说明: /:根目录,位于Linux文件系统目录结构的顶层,一般根目录下只存放目录,不要存放文件,/etc./bin./dev./lib./sbin应该和根目录放置在一个分区中. /bin, ...

  6. 「洛谷5300」「GXOI/GZOI2019」与或和【单调栈+二进制转化】

    题目链接 [洛谷传送门] 题解 按位处理. 把每一位对应的图都处理出来 然后单调栈处理一下就好了. \(and\)操作处理全\(1\). \(or\)操作处理全\(0\). 代码 #include & ...

  7. 牛客网 272B Xor Path(树上操作)

    题目链接:Xor Path 题意:每个顶点的点权为Ai,任意两点路径上点权异或和为Path(i,j),求所有Path(i,j)和. 题解:考虑每个顶点被用到的次数,分以下三种情况: 1.本身和其他顶点 ...

  8. EL表达式+JSTL

    一. EL表达式 1.1 什么是EL EL是JSP表达式语言,全称是Expression Language,提供了JSP中简化表达式的方法. 1.2 如何学习EL 没有EL的时候 怎么写 用EL表达式 ...

  9. django-crontab实现定时任务

    django-crontab实现服务端的定时任务 安装 pip install django-crontab 在Django项目中使用 settings.py INSTALLED_APPS = ( ' ...

  10. 20175209 《Arrays和String单元测试》

    20175209 <Arrays和String单元测试> 题目 在IDEA中以TDD的方式对String类和Arrays类进行学习,测试相关方法的正常,错误和边界情况 String类 ch ...