Centos配置本地yum源

來源:互聯網
上載者:User

標籤:linux   yum   centos   

由於在VMware虛擬機器上迷你安裝了不帶圖形介面的CentOS,在安裝VMware tools時報錯,提示要安裝perl,在無發連網的情況下,可以選擇用Centos安裝光碟片配置本地yum源進行安裝。


1、將安裝光碟片ISO檔案載入到光碟機中,將光碟機掛載到系統檔案目錄下:

mkdir -p /mnt/cdrom #建立掛載目錄mount /dev/cdrom /mnt/cdrom #掛載光碟片


2、修改yum源設定檔:

ls -l /etc/yum.repos.d/  #進入yum源設定檔目錄mv CentOS-Base.repo CentOS-Base.repose_bak #重新命名或刪除CentOS-Base.repo檔案mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo_bak #重新命名或刪除CentOS-Debuginfo.repo檔案vi CentOS-Media.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 the media repo, do this:##  yum --disablerepo=\* --enablerepo=c6-media [command][c6-media]              #庫名稱name=CentOS-$releasever - Media     #名稱描述baseurl=file:///mnt/cdrom/            #yum來源目錄,源地址gpgcheck=1                #檢查GPG-KEY,0為不檢查,1為檢查enabled=1               #是否用該yum源,0為禁用,1為使用gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  #gpgcheck=0時無需配置


3、測試yum是否配置成功

yum list


4、清除yum緩衝

yum clean all


當然,以上方法也可以先將光碟片內容複寫到本地檔案系統中,然後指定該目錄作為源地址。

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.