歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 6.5下本地yum源與網絡yum源的配置使用

CentOS 6.5下本地yum源與網絡yum源的配置使用

日期:2017/2/28 14:26:52   编辑:Linux教程

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/sr0

gpgcheck=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=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

Copyright © Linux教程網 All Rights Reserved