1、挂载系统安装光盘
# mount /dev/cdrom /mnt/cdrom/ ##如果无/mnt/cdrom 手动创建即可,或者挂在到别的路径
2、配置本地yum源
# cd /etc/yum.repos.d/
# ls
会看到四个repo 文件
CentOS-Base.repo 是yum 网络源的配置文件
CentOS-Media.repo 是yum 本地源的配置文件
修改CentOS-Media.repo
# cat CentOS-Media.repo
# CentOS-Media.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-5. 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=c5-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///mnt/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
在baseurl 中修改第2个路径为/mnt/cdrom(即为光盘挂载点)
3、禁用默认的yum 网络源
将yum 网络源配置文件改名为CentOS-Base.repo.bak,否则会先在网络源中寻找适合的包,改名之后直接从本地源读取。
原文地址:http://chentianwang.blog.51cto.com/9250930/1736694