[root@zf-test-web01-4 ~]# yum install rng-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>

红色部分问题解决如下:

-bash-4.2# vi /etc/yum/pluginconf.d/fastestmirror.conf

[main]
enabled=0
verbose=0
always_print_best_host = true
socket_timeout=3
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook

把enabled=1改为enabled=0

再次执行yum安装,仍报错

[root@zf-test-web01-4 ~]# yum install -y rng-tools
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>

也就是蓝色部分,解决办法:

1. 查看centos7.2系统本身所安装的那些yum 软件包

[root@zf-test-web01-4 ~]# rpm -qa|grep yum
yum-plugin-fastestmirror-1.1.31-34.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-132.el7.centos.0.1.noarch

[root@zf-test-web01-4 ~]#

2. 卸载这些软件包

[root@zf-test-web01-4 ~]# rpm -e yum-plugin-fastestmirror-1.1.31-34.el7.noarch --nodeps
warning: /etc/yum/pluginconf.d/fastestmirror.conf saved as /etc/yum/pluginconf.d/fastestmirror.conf.rpmsave
[root@zf-test-web01-4 ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@zf-test-web01-4 ~]# rpm -e yum-3.4.3-132.el7.centos.0.1.noarch --nodeps
[root@zf-test-web01-4 ~]#

3. 进入centos镜像网站找到自己对应系统需要的yum包

查看系统的命令:

[root@zf-test-web01-4 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

查看系统的位数:

[root@zf-test-web01-4 ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped

http://vault.centos.org/

4. 下载这些yum包

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm

5. 安装下载的这些yum包

[root@zf-test-web01-4 ~]# rpm -ivh yum-*
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 33%]
   2:yum-plugin-fastestmirror-1.1.31-3################################# [ 67%]
   3:yum-3.4.3-132.el7.centos.0.1     ################################# [100%]
[root@zf-test-web01-4 ~]#

6. 更新centos系统的repo文件

http://mirrors.163.com/.help/centos.html

1)首先备份/etc/yum.repos.d/CentOS-Base.repo

[root@zf-test-web01-4 yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2)下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)

3)运行以下命令生成缓存

[root@zf-test-web01-4 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@zf-test-web01-4 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base                                                             | 3.6 kB  00:00:00     
extras                                                           | 3.4 kB  00:00:00     
updates                                                          | 3.4 kB  00:00:00     
(1/12): base/7/x86_64/group_gz                                   | 156 kB  00:00:00     
(2/12): base/7/x86_64/filelists_db                               | 6.7 MB  00:00:01     
(3/12): extras/7/x86_64/prestodelta                              |  71 kB  00:00:00     
(4/12): extras/7/x86_64/primary_db                               | 145 kB  00:00:00     
(5/12): extras/7/x86_64/filelists_db                             | 528 kB  00:00:00     
(6/12): extras/7/x86_64/other_db                                 |  97 kB  00:00:00     
(7/12): updates/7/x86_64/prestodelta                             | 589 kB  00:00:00     
(8/12): base/7/x86_64/primary_db                                 | 5.7 MB  00:00:01     
(9/12): base/7/x86_64/other_db                                   | 2.5 MB  00:00:00     
(10/12): updates/7/x86_64/primary_db                             | 4.5 MB  00:00:00     
(11/12): updates/7/x86_64/other_db                               | 490 kB  00:00:00     
(12/12): updates/7/x86_64/filelists_db                           | 2.7 MB  00:00:01     
Determining fastest mirrors
Metadata Cache Created

7. 重新运用yum安装软件

---------------------
作者:shaoqiufeng
来源:CSDN
原文:https://blog.csdn.net/shaoqiufeng/article/details/78785806?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!

centos7.2重新安装yum的更多相关文章

  1. Centos7重新安装yum

    Centos7重新安装yum rpm -qa|grep yum 然后用下面的命令删除出现的xxx包: rpm -e --nodeps xxx 下载 python-urlgrabber-3.10-8.e ...

  2. centos7下使用yum安装mysql

    CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1. 下载mysql的repo源 wget http://repo.mysql.com/m ...

  3. CentOS7下使用YUM安装mariadb10

    1:由于centos7 默认使用yum安装MySQL的话就会安装mariadb,只是安装的版本停留在mariadb5.x,版本比较低.如果我们需要安装mariadb10这里就需要删除mariadb-l ...

  4. centos7下使用yum安装pip

    centos7下使用yum安装pip 首先安装epel扩展源: yum -y install epel-release 更新完成之后,就可安装pip: yum -y install python-pi ...

  5. <亲测>CentOS7中使用yum安装Nginx的方法

    CentOS7中使用yum安装Nginx的方法   最近无意间发现Nginx官方提供了Yum源.因此写个文章记录下. 1.添加源 默认情况Centos7中无Nginx的源,最近发现Nginx官网提供了 ...

  6. 在CentOS7中利用yum命令安装mysql

    在CentOS7中利用yum命令安装mysql 原创 2016年08月31日 10:42:33 标签: mysql / centos 4832 一.说明 我们是在VMware虚拟机上安装的mysql, ...

  7. CentOS7创建本地YUM源的三种方法

    这篇文章主要介绍了CentOS7创建本地YUM源的三种方法,本文讲解了使用CentOS光盘作为本地yum源.如何为CentOS创建公共镜像.创建完全自定义的本地源等内容,需要的朋友可以参考下     ...

  8. centos7.2环境yum方式快速搭建lnmp环境nginx+mariadb+php-fpm

    centos7.2环境yum方式安装nginx+mariadb+php-fpm 1.安装lnmp环境 安装epel源 yum install -y epel-release 安装 MySQL + PH ...

  9. centos7中使用yum安装tomcat以及它的启动、停止、重启

    centos7中使用yum安装tomcat 介绍 Apache Tomcat是用于提供Java应用程序的Web服务器和servlet容器. Tomcat是Apache Software Foundat ...

随机推荐

  1. maven里面pom文件的各标签介绍

    由于maven在工作中经常使用,但是平时要记的知识点有点多,偶尔回头来看一些东西难免忘记,特此整理一篇笔记,方便大家搜索查询,也方便自己以后查询! 后续碰见其他的标签也会进行更新! maven的pom ...

  2. sentinel-dashboard安装、运行(ubuntu)

    下载页面https://github.com/alibaba/Sentinel/releases wget -P /opt/downloads https://github.com/alibaba/S ...

  3. Number Sequence kmp

    Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], .... ...

  4. tp5的路由

    路由模式:普通.强制和混合 普通模式: //配置文件关闭路由,完全使用默认的PATH_INFO方式URL 'url_route_on' => false, 关闭路由后的普通模式任然可以通过操作方 ...

  5. h5 rem js自动适配

    (function (doc, win) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? ...

  6. 更新pip和setuptools

    python -m pip install -U pip setuptools

  7. 牛客练习赛35-背单词-线性DP

    背单词 思路 :dp[ i ]  [ 0 ]表示 第i 位放的元音  dp[ i ]  [ 1 ]表示 第i 位放的辅音 ,cnt [ i ]含义是 长度为 i 的方案数. 转移  :dp[ i ]  ...

  8. padding和margin设置成百分比

    Margin和Padding是我们在网页设计经常使用到的CSS样式,他们分别是间距和填充,一个作用于盒子外面,一个作用于盒子里面,默认的情况下,这些属性的值都会被计算在盒子的面积里面,在网页开发中的流 ...

  9. 2189 ACM 母函数 素数

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=2189 思路:先找出150以内的 素数,然后再用母函数或01背包计算 复习母函数的代码:https://ww ...

  10. 单片机软件proteus的汉化步骤

    整体思想:把汉化包里的文件替换软件的英文的软件 右键打开文件安装的位置,找到Translations文件夹,打开它等待被替换. 打开这个找到Translations文件夹,把下面的文件全部复制替换上面 ...