前言: yum源只需要CentOS-6.5-x86_64-bin-DVD1.iso中的Packages和repodata 而Packages文件夹过大(3.6G)故想缩减Packages文件夹,使其只含需要安装包和相应依赖初始化yum源shell==> yum_init.sh
#!/bin/bash注:/app/iso 是准备好的Packages和repodata还有yum配置文件CentOS-Media.repo内容如下:CentOS-Media.repo
cp -rf /app/iso/repodata /app_res/iyum/
cp -rf /app/iso/Packages /app_res/iyum/
mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.bak
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
mv /etc/yum.repos.d/CentOS-Vault.repo /etc/yum.repos.d/CentOS-Vault.repo.bak
mv /etc/yum.repos.d/CentOS-Debuginfo.repo /etc/yum.repos.d/CentOS-Debuginfo.repo.bak
cp -rf /app/iso/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo
chmod 755 /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo执行yum clean all如不了解所安装的组件依赖可先试着install报错输出信息中有所需依赖包,找齐即可成功装载yum install gcc
#
# 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:///app_res/iyum/
gpgcheck=0
enabled=1
结:本文Packages内容:(全在CentOS-6.5-x86_64-bin-DVD1.iso中的Packages可找到)