Yum is a package management tool for installing, updating and removing rpm packages on RedHat-based systems. When you try to install a package withyum command, you may encounter
errors for various reasons. In this post, I will describe under what situationsyum errors can occur, and explain
how to fix yum errors.

Fix 404 errors

Symptom: When you try to install a package with yum,yum complains that the URLs for repositories are not found, and throws 404 errors, as shown below.

Loaded plugins: fastestmirror
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:09
extras | 3.5 kB 00:00
http://mirror.steadfast.net/centos/6.4/extras/x86_64/repodata/e0e507c76dc5e5aa66c1f32632b9dc0a9759d97031ab5a028562a7cb7be6e294-primary.sqlite.bz2:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404
Not Found"
Trying other mirror.
http://mirrors.seas.harvard.edu/centos/6.4/extras/x86_64/repodata/e0e507c76dc5e5aa66c1f32632b9dc0a9759d97031ab5a028562a7cb7be6e294-primary.sqlite.bz2:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404
Not Found"
Trying other mirror.

You can get these 404 errors when the metadata downloaded by yum has become obsolete.

To repair yum 404 errors, clean yum metadata as follows.

$ sudo yum clean metadata

Or you can clear the whole yum cache:

$ sudo yum clean all

Fix connection failure errors

Symptom: You get "network is unreachable" or "couldn't connect to host" errors while runningyum command.

Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist
http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to
2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base http://mirror.nexcess.net/CentOS/6.4/os/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrordenver.fdcservers.net/centos/6.4/os/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.cmich.edu/centos/6.4/os/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.

The error means that you cannot properly connect to repository servers for some reason. If you can still ping the servers without any problem, check if your system is behind a proxy. If you are runningyum behind a proxy, but have not specified the
proxy in the yum configuration, you will get connection failure errors like the above.

To configure a proxy in the yum configuration:

$ sudo vi /etc/yum.conf
[main]
proxy=http://proxy.com:8000

Fix metadata checksum errors

Symptom: You get "Metadata file does not match checksum" while runningyum command.

epel/pkgtags                                             | 466 kB     00:14
http://mirror.steadfast.net/epel/6/x86_64/repodata/pkgtags.sqlite.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.

You can get the metadata checksum errors when the metadata downloaded by yum has become outdated.

To repair yum checksum errors, clean yum metadata:

$ sudo yum clean metadata

Fix yum lock errors

Symptom: When you run yum on Fedora, you get the errors saying that "Another app is currently holding the yum lock."

Loaded plugins: langpacks, presto, refresh-packagekit
Existing lock /var/run/yum.pid: another copy is running as pid 1880.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 178 M RSS (586 MB VSZ)
Started: Tue Jul 9 09:43:17 2013 - 00:12 ago
State : Sleeping, pid: 1880

The culprit for this error is PackageKit which is responsible for auto updates on Fedora. ThePackageKit process gets automatically started upon boot, holding the
yum lock.

To fix the error, disable auto update checks on Fedora. In order to do so, click on "Software" on Fedora desktop to open software update preferences.

Then click on "Software Sources" menu like the following.

In the software update preferences, set "Never" for "Check for updates".

Once you reboot your desktop, you will no longer get yum lock errors.

How to fix yum errors on CentOS, RHEL or Fedora的更多相关文章

  1. [转载]Install Opera 12.16 Web Browser in CentOS/RHEL and Fedora

    FROM: http://tecadmin.net/install-opera-web-browser-in-centos-rhel-fedora/ Opera is an modern web br ...

  2. 【Linux】YUM Repositories for CentOS, RHEL & Fedora Systems

    这里是官方wiki:https://wiki.centos.org/AdditionalResources/Repositories 一.简介 YUM(Yellowdog Updater Modifi ...

  3. Install Tomcat 7 on CentOS, RHEL, or Fedora

    linux下的 Tomcat 安装: http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos

  4. 如何在CentOS/RHEL & Fedora上安装MongoDB 3.2

    MongoDB(名称取自"huMONGOus")是一个有着全面灵活的索引支持和丰富的查询的数据库.MongoDB通过GridFS提供强大的媒体存储.点击这里获取MongoDB的更多 ...

  5. 转: How to Install MongoDB 3.2 on CentOS/RHEL & Fedora (简单易懂)

    from:  http://tecadmin.net/install-mongodb-on-centos-rhel-and-fedora/ MongoDB (named from “huMONGOus ...

  6. PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum

    PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum PHP 5.4.16 has been released on PHP.net on 6th June 2013, ...

  7. [转载]PHP 5.6 on CentOS/RHEL 7.0 and 6.6 via Yum

    https://webtatic.com/packages/php56/ PHP 5.6.5 has been released on PHP.net on 22nd January 2014, an ...

  8. PHP 5.4 on CentOS/RHEL 7.0, 6.5 and 5.10 via Yum

    PHP 5.4.36 has been released on PHP.net on 18th December 2014, and is also available for CentOS/RHEL ...

  9. 通过yum升级CentOS/RHEL最小化安装

    1.如果你有安装CentOS / RHEL最小服务器安装,您可能有很多麻烦没有安装包 2.有一种方法来安装所有的包,需要一个基本的服务器,使用yum groupinstall命令 3.从最小的安装基本 ...

随机推荐

  1. POJ 1946 DP

    折腾了一晚上 明天再写.. 2016.5.17 23:59 -> -> #include <cstdio> #include <cstring> #include ...

  2. 【java基础】(3)Java继承内存分配

    继承的基本概念: (1)Java不支持多继承,也就是说子类至多只能有一个父类. (2)子类继承了其父类中不是私有的成员变量和成员方法,作为自己的成员变量和方法. (3)子类中定义的成员变量和父类中定义 ...

  3. C# 怎么把类文件如(XXX.cs)转为dll文件

    打开VS2012或2017 ,新建项目,选择  类库(.NET Framework),创建好一个项目 在建好的项目中添加需要转的类文件 然后将项目重新生成后,在项目的Debug下就可以找到对应的dll ...

  4. Java多线程-synchronized关键字

    进程:是一个正在执行中的程序.每一个进程执行都有一个执行顺序.该顺序是一个执行路径,或者叫一个控制单元. 线程:就是进程中的一个独立的控制单元.线程在控制着进程的执行. 一个进程中至少有一个线程 Ja ...

  5. jQuery学习笔记之插件开发(4)

    jQuery学习笔记之插件开发(4) github源码地址 插件:了让原有功能的增强. 1.插件的种类(3种):局部.全局.选择器插件 1.1封装对象方法的插件 这种类型的插件是把一些常用或者重复使用 ...

  6. Runtime的相关知识

    Runtime是近年来面试遇到的一个高频方向,也是我们平时开发中或多或少接触的一个领域,那么什么是runtime呢?它又可以用来做什么呢? 什么是Runtime?平时项目中有用过么? OC是一门动态性 ...

  7. .NET Core & EntityFrameworkCore

    前言 .NET Core 相比于 .NET Fromework 有跨平台.轻量化且开源的优势. 在使用 EntityFrameworkCore 的时候也遇到了很多问题,至于网络上的教程嘛...大部分都 ...

  8. struts与spring整合

    Spring与Struts框架整合 Spring,负责对象对象创建 Struts, 用Action处理请求 Spring与Struts框架整合, 关键点:让struts框架action对象的创建,交给 ...

  9. 【转载】JavaWeb之DBUtils QueryRunner类对数据表的增、删、查(8种结果集处理方式)、改操作

    一.使用QueryRunner类,实现对数据表的 insert delete update package com.shuhuadream.queryrunner; import java.sql.C ...

  10. Django—链接MySQL

    Djalgo基础配置方法 静态文件配置方法 1 所有的静态文件都放在 static 文件夹下,例如Bootstrap值类的第三方库,通常 static 文件下会创建 css image js 文件,用 ...