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

公司提供的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]:

在执行最后一步,即yum makecache的时候,遇到错误:

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 程序安装所需开发包(以下为标准的rpm包名称)
yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel
zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel
freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel mysql-devel net-snmp-devel
curl-devel perl-DBI

时间: 2024-07-31 14:24:28

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

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

公司提供的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

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

yum更换国内源因为CentOS里自带的源是国外的源,而我们的服务器一般在国内,用国内的服务器去访问国外的服务器,我们都知道会很慢,所以我们就把系统里的源更换成国内的源,比较常用的有163网易的源,阿里云的源等首先把以前的源文件删掉·然后我们使用wget下载一个repo包.wget http://mirrors.163.com/.help/CentOS7-Base-163.repo·如果没有安装wget,本地源也已经被删除了,我们可以使用curl -O来更换源curl -O http://mir

5周第2次课 yum更换国内源 yum下载rpm包 源码包安装

1. yum 更换国内源 系统内置的源很多时候都是官方的,大部分在国外,使用起来不是很快,也很难下载,这时候最好使用国内的源,如163 1.1 删除系统中自带的 yum源配置文件 mv CentOS-Base.repo CentOS-Base.repo.bak 1.2 下载网易 yum 源的配置文件 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 或者curl -O http://mirrors.163.com/.help/Cent

安装与现在软件的方法:更换yum仓库源、yum下载rpm包、源码包安装

更换yum仓库源 安装扩展源epel yum下载rpm包 源码包安装 原文地址:http://blog.51cto.com/13515599/2059165

yum更换源,安装源码包

更换yum源下载base文件 wget命令没有使用curl 下载文件centos base 163.repo安装扩展源安装包epel配置文件下会多两个epel开头的文件yum list|grep epel 查看会多包使用yum 下载rpm包yum install zsh --downloadonly 仅仅下载不安装查看下载包位置指定下载目录重新安装源码安装下载源码包安装源码包可以用./configure --help 查看帮助判断上条命令是否执行正确 0是完成 1是没有完成make 编译文件ma

yum更换国内源 yum下载rpm包

yum更换国内源因为CentOS里自带的源是国外的源,而我们的服务器一般在国内,用国内的服务器去访问国外的服务器,我们都知道会很慢,所以我们就把系统里的源更换成国内的源,比较常用的有163网易的源,阿里云的源等首先把以前的源文件删掉·然后我们使用wget下载一个repo包.wget http://mirrors.163.com/.help/CentOS7-Base-163.repo·如果没有安装wget,本地源也已经被删除了,我们可以使用curl -O来更换源curl -O http://mir

centos 7 配置yum本地源及yum命令使用

我们在介绍yum本地源的时候 先给大家谈谈RPM安装. RPM(Redhat Package Manager)解决源码包安装的众多依赖关系,,旨在校验安装卸载查询升级等管理软件操作. 安装:rpm -ivh filename.rpm 升级:rpm -Uvh filename.rpm 卸载:rpm -e filename.rpm 查询软件的描述信息:rpm -qpi filename 列出软件的文件信息:rpm -qpl filename.rpm 查询文件数据哪个RPM: rpm -qf file

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

由于网络安全的原因,服务器不允许上公网,有2种方案,解决这个问题 1.搭建yum服务器2.使用yum下载缓存进行封装,然后使用缓存安装 这里讲讲使用yum缓存封装 一.下载指定包及相关依赖 yum install --downloadonly packetName 二.查看下载的缓存文件,默认存/var/cache/yum ll /var/cache/yum 三.yum使用缓存安装指定包 yum -C install packetName

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

第一步:安装从网上下载文件的wget命令 [[email protected] ~]# yum -y install wget 第二步:下载mysql的repo源 [[email protected] ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 第三步:安装mysql-community-release-el7-5.noarch.rpm包 [[email protected] ~]# rpm -i