快速更换一个国内的yum源

回复 收藏
1.删除/etc/yum.repos.d目录所有的repo文件

2.下载CentOS-Base-163.repo, 放入/etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS-Base-163.repo -O /etc/yum.repos.d/CentOS-Base-163.repo
//说明,如果163的镜像失效,可以尝试更换为搜狐的镜像  http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

3. rm -rf /var/cache/yum/*
运行yum makecache生成缓存

4.yum search softwarename 查找软件

5.yum list softwarename 列出已装软件

6.yum install softwarename 安装软件

7.yun remove softwarename 卸载软件

____________________________________

CentOS-Base-163.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 - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[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
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
2010-12-16 10:52 举报
已邀请:
0

阿铭 管理员

赞同来自:

不错,总结的到位
0

阿铭 管理员

赞同来自:

是不是redhat 也可以这样搞?
0

雷老师 管理员

赞同来自:

快速安装本地yum源的方法:
http://www.lishiming.net/thread-424-1-1.html
0

maomao5987370

赞同来自:

恩,更换163源地址成功
0

Coohx - 小运维

赞同来自:

源失效了

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: