一、本地yum源搭建
[root@localhost ~]# cd /etc/yum.repos.d/ yum源配置文件放置目录
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak 先将网络yum源 配置文件更名(让其失效)
[root@localhost yum.repos.d]# vim CentOS-Media.repo 编辑本地yum源文件
[c6-media]
name=CentOS-$releasever - Media 本地yum源名称(可随意修改)
baseurl=file:///media/cdrom 光盘挂载目录/mnt/sr0
gpgcheck=1
enabled=1 使用此yum源(等于0为不启用)
gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6 本地yum源密钥
执行 yum list 检测是否可用
一、网络yum源搭建
网络yum源(前提是必须能连上互联网,此处使用的yum源是中国科技大学的地址如下:
中国科技大学:http://centos.ustc.edu.cn/centos/)
[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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
三、注意事项:
使用yum时最好只能让一个yum源生效,因为系统默认优先使用网络yum源。
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