第一步:先卸载原来的yum

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

直接卸载:

 rpm -qa|grep yum|xargs rpm -e --nodeps

第二步 下载 yum 替换包

mkdir yum && cd yum
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://repo.iotti.biz/CentOS/7/noarch/yum-plugin-fastestmirror-1.1.31-46.el7.lux.noarch.rpm 执行: rpm -ivh *.rpm 一次性执行依赖包,因为包之间会相互依赖。

第三步 新建配置 .repo 文件

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

然后执行yum makecache清除缓存,就可以看见列表刷新了。

参考:https://www.cnblogs.com/xiangxiushu/p/12712607.html

# Redhat7 安装 yum源的更多相关文章

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

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

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

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

  3. Redhat7 安装 yum(换成免费版) 安装gcc

    最近上Linux系统基础课程,要在虚拟机上编译运行程序,这时候就需要安装gcc,网上一搜,各种什么在线,离线安装,其中在线安装很方面,一个命令 yum install gcc 即可解决 可我这么输入后 ...

  4. RedHat7安装yum工具

    一                   RedHat7安装yum工具 1.1        查看yum是否可用 yum list yum repolist 1.2        卸载原yum rpm ...

  5. CentOS下安装yum源的流程和操作

    一般公司都用Linux来搭建服务器,Linux安装软件时能够用yum安装依赖包是一件非常简单而幸福的事情,因为你只需一个简单的安装命令yum install []即可安装相应的软件,yum工具会自动的 ...

  6. shell脚本实例-安装httpd,安装yum源

    1.安装httpd #!/usr/bin/bash getway=192.168.1.1 ping -c1 www.baidu.com &>/dev/null if [ $? -eq 0 ...

  7. RedHat7.4最小化安装yum源不可用问题解决

    本次安装的RedHat7.4是安装在Oracle VM VirtualBox5.2.8虚拟机上面的,本文不对安装虚拟机步骤做详细说明. 工具准备: Oracle VM VirtualBox5.2.8 ...

  8. redhat7.3安装yum源

    #检查rehat自带的yum源[root@localhost ~]# rpm -qa | grep yum -.el7.noarch -.el7.noarch -.el7.noarch -.el7.n ...

  9. (0.2.4)Mysql安装——yum源安装

    转自:https://www.cnblogs.com/jimboi/p/6405560.html Centos6.8通过yum安装mysql5.7 1.下载好对应版本的yum源文件 2.安装用来配置m ...

随机推荐

  1. Lab: Web shell upload via Content-Type restriction bypass

    首先上传一个正常头像. 之后,上传木马文件,并抓包 POST /my-account/avatar HTTP/1.1 Host: ac4f1f7d1eaa6cd2c0d80622001b00f9.we ...

  2. Solution -「ABC 213G」Connectivity 2

    \(\mathcal{Description}\)   Link.   给定简单无向图 \(G=(V,E)\),点的编号从 \(1\) 到 \(|V|=n\).对于 \(k=2..n\),求 \(H= ...

  3. 我们一起来学Shell - shell的循环控制

    文章目录 Shell 循环之 for 语句 Shell 循环之 while 语句 Shell 循环之 until 语句 Shell 循环控制 break指令 continue 指令 exit 指令 s ...

  4. 『无为则无心』Python基础 — 44、对文件和文件夹的操作

    目录 1.os模块介绍 2.查看os模块相关文档 3.os模块常用方法 (1)文件重命名 (2)删除文件 (3)创建文件夹 (4)删除文件夹 (5)获取当前目录 (6)改变默认目录 (7)获取目录列表 ...

  5. 日行一算(Consecutive Integer-连续整数)

    题目 题目描述 2005年的百度之星初赛有这么一道题,一个正整数有可能可以被表示为 m(m>1) 个连续正整数之和,如: 15=1+2+3+4+5 15=4+5+6 15=7+8 但现在你的任务 ...

  6. Mybatis获取自增主键的两种方式

    <insert id="saveOne" parameterType="com.buwei.entity.User" > INSERT into u ...

  7. 别再用 Redis List 实现消息队列了,Stream 专为队列而生

    上回说到使用 Redis 的 List 实现消息队列有很多局限性,比如: 没有良好的 ACK 机制: 没有 ConsumerGroup 消费组概念: 消息堆积. List 是线性结构,想要查询指定数据 ...

  8. Android编译优化系列-kapt篇

    作者:字节跳动终端技术---王龙海 封光 兰军健 一.背景 本文是编译优化系列文章之 kapt 优化篇,后续还会有 build cache, kotlin, dex 优化等文章,敬请期待.本文由Cli ...

  9. 【C#IO 操作】字符流(StreamWriter、StreamReader)

    StreamWaiter类和StreamReader类的用法 事实上, StreamReader为了性能的考虑, 在自己的内部内置并维护了一个byte buffer. 如果在声明StreamReade ...

  10. (一) operator、explicit与implicit 操作符重载

                               原文地址:  Click Here 操作符重载必须用public static 应为操作符是用来操作实例的. operator operator ...