CentOS配置本地YUM源


CentOS配置本地YUM源

--以CentOS-6.4为例

1.放入Centos的镜像光盘或找到镜像文件,然后挂载到系统中

mount /dev/cdrom /mnt/cdrom #/mnt/cdrom目录要先创建好

2.cd /etc/yum.repos.d/ #进入/etc/yum.repos.d/目录

3.mkdir bak

并将CentOS-Base.repo 和 CentOS-Debuginfo.repo 移动到到bak目录下去,这样就可以绕过网络进行本地YUM源安装

4.编辑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	#本地光盘挂载路径
gpgcheck=0	#检查GPG-KEY,0为不检查,1为检查
enabled=1	#启用YUM源,0为不启用,1为启用

4.配置完成后执行

yum clean all #清除yum源缓存

yum update #更新yum源

更新完成后就可以通过本地YUM源来安装相应服务了。

5.测试:

yum install gcc-c++ #查看是否成功

\

 

相关内容

    暂无相关文章