rhel5添加光盘镜像为本地源(5张以CD合成一张DVD)
2013-01-13 15:37
477 查看
rhel5添加光盘镜像为本地源(5张以CD合成一张DVD)
2007年08月10日 01:43 来源:ChinaUnix博客 作者:Christ 编辑:周荣茂
1 将5张以CD合成一长DVD
touch /root/make_dvd.sh
内容如下
#!/bin/bash
# by Chris Kloiber
# A quick hack that will create a bootable DVD iso of a Red Hat Linux
# Distribution. Feed it either a directory containing the downloaded
# iso files of a distribution, or point it at a directory containing
# the "RedHat", "isolinux", and "images" directories.
# This version only works with "isolinux" based Red Hat Linux versions.
# Lots of disk space required to work, 3X the distribution size at least.
# GPL version 2 applies. No warranties, yadda, yadda. Have fun.
if [ $# -lt 2 ]; then
echo "Usage: `basename $0` source /destination/DVD.iso"
echo ""
echo " The 'source' can be either a directory containing a single"
echo " set of isos, or an exploded tree like an ftp site."
exit 1
fi
cleanup() {
[ ${LOOP:=/tmp/loop} = "/" ] && echo "LOOP mount point = \/, dying!" && exit
[ -d $LOOP ] && rm -rf $LOOP
[ ${DVD:=~/mkrhdvd} = "/" ] && echo "DVD data location is \/, dying!" && exit
[ -d $DVD ] && rm -rf $DVD
}
cleanup
mkdir -p $LOOP
mkdir -p $DVD
if [ !`ls $1/*.iso 2>&1>/dev/null ; echo $?` ]; then
echo "Found ISO CD images..."
CDS=`expr 0`
DISKS="1"
for f in `ls $1/*.iso`; do
mount -o loop $f $LOOP
cp -av $LOOP/* $DVD
if [ -f $LOOP/.discinfo ]; then
cp -av $LOOP/.discinfo $DVD
CDS=`expr $CDS + 1`
if [ $CDS != 1 ] ; then
DISKS=`echo ${DISKS},${CDS}`
fi
fi
umount $LOOP
done
if [ -e $DVD/.discinfo ]; then
awk '{ if ( NR == 4 ) { print disks } else { print ; } }' disks="$DISKS" $DVD/.discinfo > $DVD/.discinfo.new
mv $DVD/.discinfo.new $DVD/.discinfo
fi
else
echo "Found FTP-like tree..."
cp -av $1/* $DVD
[ -e $1/.discinfo ] && cp -av $1/.discinfo $DVD
fi
rm -rf $DVD/isolinux/boot.cat
find $DVD -name TRANS.TBL | xargs rm -f
cd $DVD
mkisofs -J -R -v -T -o $2 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
/usr/lib/anaconda-runtime/implantisomd5 --force $2
cleanup
echo ""
echo "Process Complete!"
echo ""
3 cd /root
chmod a+x make_dvd.sh
假设我的5张cd在
/wind/redhat/rhel-5-server-i386-disc1.iso
/wind/redhat/rhel-5-server-i386-disc2.iso
/wind/redhat/rhel-5-server-i386-disc3.iso
/wind/redhat/rhel-5-server-i386-disc4.iso
/wind/redhat/rhel-5-server-i386-disc5.iso
./make_dvd.sh /wind/redhat /mydoc/rhel-5-server-i386-DVD.iso
然后在/mydoc目录下产生rhel-5-server-i386-DVD.iso
5 mkdir /rhel_dvd
mount -o loop /mydoc/rhel-5-server-i386-DVD.iso /rhel_dvd
6gedit /etc/yum.repos.d/rhel_local.repo
内容如下:
[Cluster]
name=Red Hat Enterprise Linux $releasever-$basearch-Cluster
baseurl=file:///rhel_dvd/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever-$basearch-ClusterStorage
baseurl=file:///rhel_dvd/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=Red Hat Enterprise Linux $releasever-$basearch-Server
baseurl=file:///rhel_dvd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever-$basearch-VT
baseurl=file:///rhel_dvd/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
7执行createrepo命令,如果找不到命令,则要先安装createrepo的rpm包,自己google吧
为了方便,创建一个sh文件
touch /root/yum.sh
内容如下:
mkdir -p /var/rhel/{Server,Cluster,ClusterStorage,VT}
createrepo -o /var/rhel/Cluster -g /rhel_dvd/Cluster/repodata/comps-rhel5-cluster.xml /rhel_dvd/Cluster
createrepo -o /var/rhel/ClusterStorage -g /rhel_dvd/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /rhel_dvd/ClusterStorage
createrepo -o /var/rhel/Server -g /rhel_dvd/Server/repodata/comps-rhel5-server-core.xml /rhel_dvd/Server
createrepo -o /var/rhel/VT -g /rhel_dvd/VT/repodata/comps-rhel5-vt.xml /rhel_dvd/VT
mount --bind /var/rhel/Cluster/repodata /rhel_dvd/Cluster/repodata
mount --bind /var/rhel/ClusterStorage/repodata /rhel_dvd/ClusterStorage/repodata
mount --bind /var/rhel/Server/repodata /rhel_dvd/Server/repodata
mount --bind /var/rhel/VT/repodata /rhel_dvd/VT/repodata
yum clean all
chmod a+x yum.sh
./yum.sh
完成
2007年08月10日 01:43 来源:ChinaUnix博客 作者:Christ 编辑:周荣茂
1 将5张以CD合成一长DVD
touch /root/make_dvd.sh
内容如下
#!/bin/bash
# by Chris Kloiber
# A quick hack that will create a bootable DVD iso of a Red Hat Linux
# Distribution. Feed it either a directory containing the downloaded
# iso files of a distribution, or point it at a directory containing
# the "RedHat", "isolinux", and "images" directories.
# This version only works with "isolinux" based Red Hat Linux versions.
# Lots of disk space required to work, 3X the distribution size at least.
# GPL version 2 applies. No warranties, yadda, yadda. Have fun.
if [ $# -lt 2 ]; then
echo "Usage: `basename $0` source /destination/DVD.iso"
echo ""
echo " The 'source' can be either a directory containing a single"
echo " set of isos, or an exploded tree like an ftp site."
exit 1
fi
cleanup() {
[ ${LOOP:=/tmp/loop} = "/" ] && echo "LOOP mount point = \/, dying!" && exit
[ -d $LOOP ] && rm -rf $LOOP
[ ${DVD:=~/mkrhdvd} = "/" ] && echo "DVD data location is \/, dying!" && exit
[ -d $DVD ] && rm -rf $DVD
}
cleanup
mkdir -p $LOOP
mkdir -p $DVD
if [ !`ls $1/*.iso 2>&1>/dev/null ; echo $?` ]; then
echo "Found ISO CD images..."
CDS=`expr 0`
DISKS="1"
for f in `ls $1/*.iso`; do
mount -o loop $f $LOOP
cp -av $LOOP/* $DVD
if [ -f $LOOP/.discinfo ]; then
cp -av $LOOP/.discinfo $DVD
CDS=`expr $CDS + 1`
if [ $CDS != 1 ] ; then
DISKS=`echo ${DISKS},${CDS}`
fi
fi
umount $LOOP
done
if [ -e $DVD/.discinfo ]; then
awk '{ if ( NR == 4 ) { print disks } else { print ; } }' disks="$DISKS" $DVD/.discinfo > $DVD/.discinfo.new
mv $DVD/.discinfo.new $DVD/.discinfo
fi
else
echo "Found FTP-like tree..."
cp -av $1/* $DVD
[ -e $1/.discinfo ] && cp -av $1/.discinfo $DVD
fi
rm -rf $DVD/isolinux/boot.cat
find $DVD -name TRANS.TBL | xargs rm -f
cd $DVD
mkisofs -J -R -v -T -o $2 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
/usr/lib/anaconda-runtime/implantisomd5 --force $2
cleanup
echo ""
echo "Process Complete!"
echo ""
3 cd /root
chmod a+x make_dvd.sh
假设我的5张cd在
/wind/redhat/rhel-5-server-i386-disc1.iso
/wind/redhat/rhel-5-server-i386-disc2.iso
/wind/redhat/rhel-5-server-i386-disc3.iso
/wind/redhat/rhel-5-server-i386-disc4.iso
/wind/redhat/rhel-5-server-i386-disc5.iso
./make_dvd.sh /wind/redhat /mydoc/rhel-5-server-i386-DVD.iso
然后在/mydoc目录下产生rhel-5-server-i386-DVD.iso
5 mkdir /rhel_dvd
mount -o loop /mydoc/rhel-5-server-i386-DVD.iso /rhel_dvd
6gedit /etc/yum.repos.d/rhel_local.repo
内容如下:
[Cluster]
name=Red Hat Enterprise Linux $releasever-$basearch-Cluster
baseurl=file:///rhel_dvd/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
name=Red Hat Enterprise Linux $releasever-$basearch-ClusterStorage
baseurl=file:///rhel_dvd/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Server]
name=Red Hat Enterprise Linux $releasever-$basearch-Server
baseurl=file:///rhel_dvd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
name=Red Hat Enterprise Linux $releasever-$basearch-VT
baseurl=file:///rhel_dvd/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
7执行createrepo命令,如果找不到命令,则要先安装createrepo的rpm包,自己google吧
为了方便,创建一个sh文件
touch /root/yum.sh
内容如下:
mkdir -p /var/rhel/{Server,Cluster,ClusterStorage,VT}
createrepo -o /var/rhel/Cluster -g /rhel_dvd/Cluster/repodata/comps-rhel5-cluster.xml /rhel_dvd/Cluster
createrepo -o /var/rhel/ClusterStorage -g /rhel_dvd/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /rhel_dvd/ClusterStorage
createrepo -o /var/rhel/Server -g /rhel_dvd/Server/repodata/comps-rhel5-server-core.xml /rhel_dvd/Server
createrepo -o /var/rhel/VT -g /rhel_dvd/VT/repodata/comps-rhel5-vt.xml /rhel_dvd/VT
mount --bind /var/rhel/Cluster/repodata /rhel_dvd/Cluster/repodata
mount --bind /var/rhel/ClusterStorage/repodata /rhel_dvd/ClusterStorage/repodata
mount --bind /var/rhel/Server/repodata /rhel_dvd/Server/repodata
mount --bind /var/rhel/VT/repodata /rhel_dvd/VT/repodata
yum clean all
chmod a+x yum.sh
./yum.sh
完成
相关文章推荐
- rhel 5添加光盘镜像为本地源(5张以CD合成一张DVD)
- 将5张以CD合成一长DVD
- 将Red Hat 9.0 CD iso合成一张DVD iso的方法
- 将三张Red Hat 9.0 CD iso合成一张DVD iso的方法
- 将Linux的三张ISO版CD镜像的合并成一个DVD光盘
- 《linux操作系统》(ubuntu)10.04(CD&DVD)[光盘镜像]
- 将Red Hat 9.0 CD iso合成一张DVD iso的方法
- 将三张Red Hat 9.0 CD iso合成一张DVD iso的方法
- windowsXP 硬盘安装fedora core 7 ,DVD光盘镜像fedora 7下载
- rhel cd镜像 制作 dvd
- 如何将RedHat Linux 9.0三张镜像光盘合并成一张
- Eclipse编程技术与实例(附CD-ROM光盘一张)
- 『系统管理』把Redhat的多个CD安装光盘手工合并成1DVD的方法
- 多个镜像文件刻在一张光盘上
- 使用rhel5的DVD光盘作为本地yum源
- 各种 CD 和 DVD 光盘之间有什么区别
- ubuntu添加dvd光盘源
- RHEL AS4 4张CD合成1张DVD
- 将光盘镜像CentOS-5.3-i386-bin-DVD.iso设置成为yum源
- 一本需要购买的图形学方面的好书:GPU精粹——实时图形编程的技术、技巧和技艺(附CD-ROM光盘一张)