CentOS系统使用yum命令报错问题及解决

 更新时间:2024年12月28日 09:32:28   作者:程序员阿明  
文章主要讲述了在CentOS系统中使用yum命令时遇到的错误,并提供了个人解决方法,希望对大家有所帮助,并鼓励大家支持脚本之家

CentOS系统使用yum命令报错

找到文件

/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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
#[contrib]
#name=CentOS-$releasever - Contrib - mirrors.aliyun.com
#failovermethod=priority
#baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
#        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
#        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
#gpgcheck=1
#enabled=0
#gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • Linux之性能监测命令解读

    Linux之性能监测命令解读

    这篇文章主要介绍了Linux之性能监测命令,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2023-06-06
  • Linux中如何查看文件的创建时间详解

    Linux中如何查看文件的创建时间详解

    这篇文章主要给大家介绍了关于Linux中如何查看文件的创建时间的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用Linux具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
    2019-12-12
  • 让Apache支持Rewrite静态页面重写的方法

    让Apache支持Rewrite静态页面重写的方法

    Apache下Rewrite静态页面重写的方法,需要的朋友可以参考下。
    2010-07-07
  • Ubuntu18.04安装Pycharm教程的实现

    Ubuntu18.04安装Pycharm教程的实现

    这篇文章主要介绍了Ubuntu18.04安装Pycharm教程的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-09-09
  • CentOS Linux系统搭建Android开发环境详细介绍

    CentOS Linux系统搭建Android开发环境详细介绍

    这篇文章主要介绍了CentOS Linux系统搭建Android开发环境详细介绍的相关资料,需要的朋友可以参考下
    2016-11-11
  • 解决Linux删除文件空间仍然不释放问题

    解决Linux删除文件空间仍然不释放问题

    本文记录了Linux服务器在移动文件过程中出现磁盘空间不足的问题,找到占用磁盘最多的目录或非必要的日志文件删除后,空间仍然不释放,经查证,是因为文件仍然被线程占用,故提出了通过echo清空文件内容或者使用sudolsof+L1找到并清理占用文件的线程的解决方案
    2024-10-10
  • apache中的Worker 和 Prefork 之间的区别解析

    apache中的Worker 和 Prefork 之间的区别解析

    Apache中的Worker和Prefork两种工作模式在内存使用、稳定性以及兼容性等方面存在区别,本文介绍apache中的Worker 和 Prefork 之间的区别,感兴趣的朋友跟随小编一起看看吧
    2024-11-11
  • linux之硬链接和软链接解读

    linux之硬链接和软链接解读

    这篇文章主要介绍了linux之硬链接和软链接的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2024-08-08
  • linux获取进程执行时间方法示例

    linux获取进程执行时间方法示例

    linux获取进程执行时间有两种方法可以获取,第一种是用time命令,time 进程。第二种是通过在程序中进行记录,首先利用sysconf函数获取时钟滴答数,再用times获取tms结构,详细看下面的示例代码
    2013-12-12
  • Linux下通过sed命令对kv方式的配置文件进行修改

    Linux下通过sed命令对kv方式的配置文件进行修改

    sed是unix下的面向字符流的编辑器,即stream editor, 它是面向行的,以行为单位进行处理,同时,sed是非交互式的,一旦执行便要处理完整个文件。这篇文章主要介绍了Linux下通过sed命令对kv方式的配置文件进行修改,需要的朋友可以参考下
    2018-11-11

最新评论