CentOS配置网易163,修改yum源为国内源

CentOS 修改yum源为国内源

我们安装完成CentOS系统,默认都是系统自带的yum源,国内用户用yum安装软件的时候,是比较慢的,为了提高效率,一般我们会配置国内的yum源。

CentOS 修改yum源为国内源

修改yum源的方法有两种,很多朋友喜欢修改yum.repos.d这个文件进行更改,deepvps感觉这个方法不是太好,以下这个方法就方便多了。

在CentOS系统中,可以直接通过yum来安装组件,但系统默认的yum源速度往往不尽人意,都连接海外的,为了在国内达到快速安装的目的,就要需要修改yum源,可以使用

这2个国内源。

执行以下命令就可以了

cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
wget


wget

运行yum makecache生成缓存

搞定。

国内比较好的yum源有网易yum源、搜狐yum源等,现在介绍下怎么配置网易163yum源:

更改centos yum 成中国镜像加快yum速度

163的开源镜像地址
不同版本见

sohu的开源镜像地址
不同版本见

中国科技大学
不同版本见)

如果使用上面YUM源的话,最好把里面的mirrorlist注释掉,否则系统会启动fastesmirror插件自动检查的,并不一定会使用这个yum源的.

我用的是中国科技大学的速度不错。

法一:直接下载源文件

CentOS USTC mirror 这个镜像不错,大家更新可用这个

#yum -y install wget
#cd /etc/yum.repos.d
#mv CentOS-Base.repo CentOS-Base.repo.save
#wget

注意:如果为第一次安装的新系统的话,则需要先安装wget这个下载软件,不然没有办法下载CentOS-Base.repo这个文件的。

法二:手动创建源文件

更改yum镜像站点为中国站点地址,推荐)

#cd /etc/yum.repos.d/

#mv CentOS-Base.repo CentOS-Base.repo.bak

#vi CentOS-Base.repo

修改/etc/yum.repos.d/CentOS-Base.repo如下:

官方链接【CentOS镜像使用帮助】:

Centos镜像使用帮助

收录架构为:i386,x86_64,SRPMS

收录架构

  • i386
  • x86_64

收录版本为:5.x和6.x系列

收录版本

  • 5
  • 6

更新时间:每5小时更新一次

使用说明

首先备份CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载对应版本的CentOS-Base.repo, 放入/etc/yum.repos.d/

这是CentOS 5的:

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.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5#released updates [updates]name=CentOS-$releasever - Updates - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-$releasever - Addons - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/addons/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addonsgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

这是CentOS 6的:

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.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updates - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cnbaseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

运行yum makecache生成缓存

修改yum源为国内源 CentOS 修改yum源为国内源
修改yum源的方法有两种,很多朋友喜欢修改yum.repos.d这个文件进行更改,deepvps感觉这个方法…

1、首先备份/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo 
/etc/yum.repos.d/CentOS-Base.repo.$(date+%F)_backup

2、根据CentOS不同版本选择下载对应的repo文件,放到/etc/yum.repos.d/ 目录

cd /etc/yum.repos.d/

# CentOS 5.x

wget

# CentOS 6.x

wget

3、最后,执行yum makecache生成缓存

yum makecache

OK, 简单3步操作即可配置完成。

CentOS6.3配置yum源 
http://www.linuxidc.com/Linux/2012-10/72750.htm

CentOS 6.4使用本地yum源
http://www.linuxidc.com/Linux/2013-12/93805.htm

RedHat Linux
本地yum源的配置
http://www.linuxidc.com/Linux/2013-08/88217.htm

RedHat 6.2 Linux修改yum源免费使用CentOS源
http://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源
http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置
http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件说明
http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安装yum(图文)
http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安装及清理
http://www.linuxidc.com/Linux/2013-07/87163.htm

CentOS 6.4上搭建yum本地源
http://www.linuxidc.com/Linux/2014-07/104533.htm

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-07/104562.htm

图片 1