1、本地yum源搭建linux
[root@localhost ~]# cd /etc/yum.repos.d/ yum源配置文件放置目錄vim
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak 先將網絡yum源 配置文件改名(讓其失效)centos
[root@localhost yum.repos.d]# vim CentOS-Media.repo 編輯本地yum源文件網絡
[c6-media]url
name=CentOS-$releasever - Media 本地yum源名稱(可隨意修改)spa
baseurl=file:///media/cdrom 光盤掛載目錄/mnt/sr0htm
gpgcheck=1 get
enabled=1 使用此yum源(等於0爲不啓用)it
gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6 本地yum源密鑰io
執行 yum list 檢測是否可用
1、網絡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
3、注意事項:
使用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