添加多个yum源并自动选择最快的源
来源:互联网 发布:java工程师工作流程 编辑:程序博客网 时间:2024/05/18 13:26
2013/5/26 系统centos6.4final
有时候如果我们的网络是在大陆,而yum使用的源的镜像服务器在台湾的话,这样会拖慢yum下载和更新软件的速度,这时候可以通过添加国内的yum server镜像来提高yum下载和更新软件的速度。下面介绍几个常用的大陆开源镜像,速度都很不错。
网易 mirrors.163.com
搜狐 mirrors.sohu.com
中科大 mirrors.ustc.edu.cn
添加多个yum源的方法
方法一:快速导入
首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
- CentOS5
- CentOS6
运行yum makecache生成缓存
方法二: 手动修改文件
1、进入源目录:
cd /etc/yum.repos.d
2、添加多个源文件,如:shlug.repo,ustc.repo,两个源的内容如下:
(可以创建独立的repo文件,也可以把以下的内容加到/etc/yum.repos.d/CentOS-Base.repo 后面)
[shlug.repo]
#mirrors-shlug-org.repo
#
# rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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=mirrors-shlug-org--CentOS-$releasever - Base
baseurl=http://mirrors.shlug.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[update]
name=mirrors-shlug-org--CentOS-$releasever - Updates
baseurl=http://mirrors.shlug.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons] 网站上的源目录没有addon,故注释掉
#baseurl=http://mirrors.shlug.org/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=mirrors-shlug-org--CentOS-$releasever - Extras
baseurl=http://mirrors.shlug.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=mirrors-shlug-org--CentOS-$releasever - Plus
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=mirrors-shlug-org--CentOS-$releasever - Contrib
baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
[ustc.repo]
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons] 网站上的源目录没有addon,故注释掉
#name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
3、导入KEY
rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
4、安装自动源选择插件--自动选择最快的源
yum install yum-fastestmirror -y
5、如何确认正在使用的是哪个源?
cd /var/cache/yum
cat timedhosts.txt
- 添加多个yum源并自动选择最快的源
- yum 自动选择最快的软件源
- ubuntu 自动选择最快源脚本
- synaptic选择最快的源
- Fedora8添加yum最快升级源 Fedora 8常用软件
- 【配置最快的yum源】为fedora19/20配置最快的yum源
- yum源的选择
- Ubuntu命令行下选择最快的源
- 自建centos的yum源并实现添加软件
- 让Fedora查找最快的源 yum install yum-fastestmirror yum-presto
- 自动选择最快服务器
- debian自动寻找最快的软件源
- 国内速度最快的centos5.5 yum源
- Fedora 9 添加yum并进行源更新
- Fedora 9 添加yum并进行源更新
- 在RedHat 6.2中安装yum并添加163源
- linux修改系统的yum源为阿里云并添加epel源
- 光驱作为yum源并开机自动挂载光驱
- 中国IT市场未来五年复合增长率为8.6%
- C#调用Quartz实例代码
- 用户空间与内核空间的接口:proc文件系统
- poj 1014 Dividing-动态规划
- 一、oracle 高水位线详解
- 添加多个yum源并自动选择最快的源
- 用户空间与内核空间的接口:sysfs
- 如何在局域网查看IP与MAC地址
- windows xp的搜索不能搜索文件里面的内容?
- ztree树 复杂增删
- 变体VARIANT
- 第十三周项目五——点类及其派生类圆类的应用
- C语言宏中"#"和"##"的用法
- C++模板元编程 入门简介