標籤: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源