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