Centos配置本地yum源

來源:互聯網
上載者:User

標籤:yum

Centos配置本地yum源

1、將系統鏡像安裝的光碟機中

2、掛載鏡像

第一步:cd /media

第二步:在meida目錄下mkdir cdrom

第三步:mount /dev/cdrom/media/cdrom

3、cd /etc/yum.repos.d

  該目錄下有以下4個檔案

CentOS-Debuginfo.repo         

CentOS-fasttrack.repo              

CentOS-Media.repo                // 本地源設定檔

CentOS-Base.repo                  // 網路源設定檔

CentOS-Vault.repo                 


CentOS-Media.repo檔案內容如下:

# CentOS-Media.repo

#

#  This repo can be used with mounted DVD media,verify the mount point for

#  CentOS-6. You can use this repo and yum to install items directly off the

#  DVD ISO that we release.

#

# To use this repo,put in your DVD and use it with the other repos too:

#  yum --enablerepo=c6-media [command]

# or for ONLY themedia repo, do this:

#

#  yum --disablerepo=\* --enablerepo=c6-media[command]

[c6-media]                                        //是用於區別各個不同的repository,必須有一個獨一無二的名稱

name=CentOS-$releasever– Media  //對repository 的描述,支援像$releasever $basearch這樣的變數

//baseurl 是伺服器設定中最重要的部分,只有設定正確,才能從上面擷取軟體,url 支援的協議有 http:// ftp:// file:// 三種。baseurl 後可以跟多個url,你可以自己改為速度比較快的鏡像站,但baseurl 只能有一個

baseurl=file:///media/CentOS/

               file:///media/cdrom/           //本地光碟片掛載點,配置本地yum源,

               file:///media/cdrecorder/

gpgcheck=1

enabled=0                                         //enabled設定為1時,才能啟用為本地yum源

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


4、若要配置本地yum源,則需要將網路源設定檔禁用,將yum 網路源設定檔改名為CentOS-Base.repo.bak,否則會先在網路源中尋找適合的包,改名之後直接從本地源讀取,而且同時修改CentOS-Media.repo中的baseurl中的本地掛載點以及將enabled參數設定為1

 

   

Centos配置本地yum源

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.