公司提供的CentOS VM中,/etc/yum.repos.d 下 只有一个build.repo,其中提供的yum 源只有公司内部的几个源,很多包在这些源中都找不到。于是要添加别的源,下面的帖子中介绍了如何在CentOS中添加中科大、搜狐和163的yum源:http://www.husw.net/blog/post/1386/。摘录如下:

本文章介绍的yum源支持的版本是CentOS 6系列,理论上支持RHEL6系列。
更新方法如下:
先进入yum源配置目录

cd /etc/yum.repos.d

备份系统自带的yum源

mv CentOS-Base.repo CentOS-Base.repo.save

下载其他更快的yum源
中科大的yum源:

wget http://centos.ustc.edu.cn/CentOS-Base.repo

163的yum源:

wget http://mirrors.163.com/.help/CentOS-Base-163.repo

sohu的yum源

wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

更新完yum源后,建议更新一下,使操作立即生效

yum makecache
[yasi]:
在执行最后一步,即

Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * addons: mirrors.163.com
 * base: mirror.metrocast.net
 * extras: mirror.beyondhosting.net
 * fasttrack: centos.vipernetworksystems.com
 * updates: centos.vipernetworksystems.com
http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml:
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
原因是,http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml和 http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml
确实不存在,可能被更新掉了。解决办法是,找到可用的URL替换之,或者把相应的.repo文件中的项整个注释掉。这里我采用后者。
例如,在CentOS-Base-163.repo中,注释掉整个addon项
#[addons]
#name=CentOS-$releasever - Addons - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#pgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
在CentOS-Base-sohu.repo中注释掉下面的内容
#[addons]
#name=CentOS-$releasever - Addons - sohu.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5CentOS-Base-sohu.repo
然后,再执行yum makecache。之后,yum就可以找到我要安装的包了,比如gdb, subversion, gcc-c++ 等。
注意:
有时用yum list xxx找不到某个包,可用尝试用yum search xxx
如,yum list vim 就报告 Error: No matching Packages to list。而 yum search vim 则返回:
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-minimal.x86_64 : A minimal version of the VIM editor

YUM更换源(1)--yum找不到安装包的更多相关文章

  1. YUM更换源--yum找不到安装包(转)

    公司提供的CentOS VM中,/etc/yum.repos.d 下 只有一个build.repo,其中提供的yum 源只有公司内部的几个源,很多包在这些源中都找不到.于是要添加别的源,下面的帖子中介 ...

  2. yum更换国内源 yum下载rpm包 源码包安装

    7.6 yum更换国内源 7.7 yum下载rpm包 7.8/7.9 源码包安装 yum更换国内源 cd  /etc/yum.repo.d/ 删除源 rm -f   dvd.repo rm -f  C ...

  3. Centos7使用yum安装程序软件时提示未找到安装包解决方法

    查找程序软件源,以sshd为例,假设sshd安装包无法找到,那么可以通过以下方法解决 yum provides sshd 然后我们就可以安装*.X86_64的程序软件源 例如yum install o ...

  4. yum,rpm等失效,使用系统安装包ISO文件降级程序恢复系统

    linux平台:REHL6.7 故障原因:由于不小心使用命令yum update nss误升级了工作平台中nss系列工具包导致系统中yum 和 rpm命令执行都报错. 由于yum rpm命令都不好用使 ...

  5. linux yum 下载至本地及使用本地缓存安装包

    由于网络安全的原因,服务器不允许上公网,有2种方案,解决这个问题 1.搭建yum服务器2.使用yum下载缓存进行封装,然后使用缓存安装 这里讲讲使用yum缓存封装 一.下载指定包及相关依赖 yum i ...

  6. centos7 下解决mysql-server找不到安装包问题

    第一步:安装从网上下载文件的wget命令 [root@master ~]# yum -y install wget 第二步:下载mysql的repo源 [root@master ~]# wget ht ...

  7. yum更换源配置

    今天安装mysql5.7的时候出现了点问题,最后更换yum源解决了,把这个记录一下 yum源配置(阿里云源) 1) 安装wget yum install -y wget 2) 备份/etc/yum.r ...

  8. 解决rhel相关系统下yum找不到安装包的解决方法

    最近重新安装了Linux,用的版本是CentOS 5.1.但老是出现很多包找不到的情况. [root@toughhou /]# yum install rlwrap Loaded plugins: f ...

  9. yum换源,rpm包下载,源码包安装

    一.yum更换源 yum自带源地址一般斗是国外的,可能下载速度略慢,我们可以自己换成国内的源,比如163等.比如配置163的yum源:1.先删除默认源文件dvd.repo # rm -f /etc/y ...

随机推荐

  1. jenkins tags

    List Subversion tags (and more) 参数设置 Tags filter ^((?!_ta_).)*$ 表示不含_ta_ Tags filtertrunk|(tags|bran ...

  2. 4D(DRG、DLG、DOM、DEM)数据 概念

    抱歉原文链接未知 Technorati 标签: DRG,DLG,DOM,DEM 以下有不同的说法,但是意思都很相近. 一. DOM (数字正射影像图):利用数字高程模型对扫描处理的数字化的航空相片.遥 ...

  3. 《云阅》一个仿网易云音乐UI,使用Gank.Io及豆瓣Api开发的开源项目

    CloudReader 一款基于网易云音乐UI,使用GankIo及豆瓣api开发的符合Google Material Desgin阅读类的开源项目.项目采取的是Retrofit + RxJava + ...

  4. VS2013编译FileZilla0.9.44

    2014年,FileZilla更新了一下,到了44版本了,貌似也是用VS2013的工程做的项目,所以下载了server的安装包,然后安装SourceCode即可(需要安装InterFace,是安装必选 ...

  5. 【嵌入式linux】(第三步):安装串口终端 (ubuntu安装minicom串口终端)

    1.前言 我使用的是USB转串口,芯片是PL2303,貌似ubuntu自带了PL2303的USB驱动,可以直接使用,其它的USB转串口的没试过. 2.minicom安装 在终端中输入 : sudo a ...

  6. css div inline 与 span 区别

    不是说用了display:lnline就变内联原素 和span有区别更奇怪的是ff里面执行就没区别 <span style="">xxx</span> &l ...

  7. html-关于IE浏览器兼容性的问题,还有浏览器一直加载的问题。

    今天9月11日,所谓兼容性问题就是,标签 写的不规范导致的,因为高版本的IE会自动补上没写的标签 document.write('<object classid="clsid:d27c ...

  8. 关于Ubuntu下apt的一些用法及和yum的比较

    Fedora和Red Hat有yum安装软件,Ubuntu有apt工具. apt简单的来说,就是给Ubuntu安装软件的一种命令方式. 一.apt的相关文件 /etc/apt/sources.list ...

  9. CentOS 安装Chrome

    yum install http://people.centos.org/hughesjr/chromium/6/x86_64/RPMS/chromium-31.0.1650.63-2.el6.x86 ...

  10. 进程间通信——FIFO(多个客户进程,一个服务进程)

    FIFO简介 FIFO就是Unix的一种复合POSIX标准的进程间通信机制.他又称为命名管道,跟管道的不同点是,每个FIFO都有一个路径名与之关联. FIFO虽然有路径名,但是他这中文件是在内核态(管 ...