您的位置:首页 > 运维架构 > Linux

CentOS 配置本地yum

2012-10-03 20:56 309 查看

CentOS 配置本地yum

mount /dev/cdrom /media/cdrom/

vim /etc/yum.repos.d/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/cdrom/

gpgcheck=1

enabled=1

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

===================================================================================

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

如果不加上面那一句的话默认走的是网络源不是本地源,会出错!

测试:

yum clean all 清除缓存及旧的包

yum install -y httpd 测试是否能安装软件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CentOS