首页 / 操作系统 / Linux / CentOS 6.5下本地yum源与网络yum源的配置使用
CentOS 6.5下本地yum源与网络yum源的配置使用一、本地yum源
1、系统默认已经安装了可使用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:///mnt/sr0 光盘挂载目录/mnt/sr0gpgcheck=1 enabled=1 使用此yum源(等于0为不启用)gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6 本地yum源密钥
二、网络yum源(前提是必须能连上互联网,此处使用的yum源是中国科技大学的地址如下:中国科技大学:http://centos.ustc.edu.cn/centos/)[root@localhost yum.repos.d]# mv CentOS-Base.bak CentOS-Base.repo 如果之前没更名就不用操作此步骤[root@localhost yum.repos.d]# vim CentOS-Base.repo 编辑网络yum源文件 [base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osbaseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=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=updatesbaseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=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=extrasbaseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=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=centosplusbaseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=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=contribbaseurl=http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
三、注意事项:使用yum时最好只能让一个yum源生效,因为系统默认优先使用网络yum源。CentOS6.3配置yum源 http://www.linuxidc.com/Linux/2012-10/72750.htmCentOS 6.4使用本地yum源 http://www.linuxidc.com/Linux/2013-12/93805.htmRedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htmRedHat 6.2 Linux修改yum源免费使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htmRedhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htmyum的配置文件说明 http://www.linuxidc.com/Linux/2013-04/83298.htmRedHat 6.1下安装yum(图文) http://www.linuxidc.com/Linux/2013-06/86535.htmYUM 安装及清理 http://www.linuxidc.com/Linux/2013-07/87163.htmCentOS 6.4上搭建yum本地源 http://www.linuxidc.com/Linux/2014-07/104533.htm更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14本文永久更新链接地址