[Yum] Yum from CD

Fred fredn1 at gmx.de
Thu Dec 16 12:39:44 UTC 2004


On Friday 10 December 2004 04:25, Ted Goranson wrote:
> I have a working install of YDL 3.01. I also have the YDL 4.0 CDs and
> wish to upgrade KDE to the version therein.
>
> Is it possible to yum from the CDs?

You need to have all RPMs under some directory, to be able to create
one repo from it, or yum won't be able to satisfy dependancies from
the other CDs.

You could perhaps trick it by ensuring that the
headers directory (yum 2.0.x) or  repodata directory (yum 2.1.x)
is always available, and changing CDs when you don't have the right one
mounted. Yum should download the packages it finds and then quit
with an error, you can then mount the next CD, try again, ...

... eventually you have collected all needed rpms in /var/yum/cache,
and the install will suceed.

I don't recommend this method, it's not the point of yum. ;-)

I have done it on Fedora by building a bootable DVD from the CDs,
and creating the yum headers with yum-arch (yum 2.0.7.x, FC2) .

For yum 2.1.x (FC3), you need to replace the yum-arch command with createrepo.
(from the package of the same name)
- I haven't got around to creating a yum-ified FC3 DVD yet.

There are instuctions to create one DVD from RedHat / Fedora CDs on 
http://www.redhat.com/archives/fedora-devel-list/2003-October/msg00736.html,
and a script at ftp://people.redhat.com/ckloiber/mkdvdiso.sh,
but it must work similarly for YellowDog if you copy all the CDs to
the correct directories, and you don't need to make it bootable if
you don't burn it.

I just modified the script (see below),
but I usually edit it to only one step at a time, just to be carefull,
and I mount and check the iso-image before burning it.

I mount the image in my /etc/fstab and use it via a symlink
as one of my local yum repositories, to avoid downloading
rpms which I already have when yum needs to satisfy
dependancies which haven't been updated since the
original distribution.

You can achieve exactly the same thing by copying the rpms
from all the CDs to a hard disk directory and yum-ifying that,
then add accessing it using a http / FTP / File url, depending on
what you have running. The file URL only works locally or 
perhaps NFS / Samba / etc.
- I use ftp (vsftpd).

Fred.

/etc/yum.conf (/fr20/yum/fc2-dvd is a symlink to a DVD-Subdirectory ):
______________________________________________________________________
[fc2-dvd]
name=Fedora Core $releasever - $basearch - Fedora DVD
baseurl=ftp://<my-ftp-server>/fr20/yum/fc2-dvd
#baseurl=file:///data/ftp/pub/fr20/yum/fc2-dvd
gpgcheck=1
______________________________________________________________________

/etc/fstab:
______________________________________________________________________
 /data/ftp/pub/fr20/fc20-dvd.iso /data/ftp/pub/fr20/DVD  iso9660 ro,loop 0 0
______________________________________________________________________

Script (the line breaks are not in the script, they are only for readability):
______________________________________________________________________
#!/bin/bash
#

# by Chris Kloiber <ckloiber at redhat.com>

# 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:=/data/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

echo "creating yum headers diectories..."
#mv $DVD/RedHat/base/comps.rpm $DVD/RedHat/base/comps.rpm.noidx
yum-arch -vv -l -s $DVD $DVD/headers 2>&1|tee $DVD/yum-arch.log
yum-arch -vv -l -s $DVD/RedHat $DVD/RedHat/headers 2>&1|tee 
$DVD/RedHat/yum-arch.log
#mv $DVD/RedHat/base/comps.rpm.noidx $DVD/RedHat/base/comps.rpm

rm -rf $DVD/isolinux/boot.cat
find $DVD -name TRANS.TBL | xargs rm -f

cd $DVD
echo "checking package md5sums..."
find . -name '*.rpm' -exec 'rpm' '-K' '{}' ';'|sort|tee rpm-k.log
chown -R root:root *
chmod -R u+w,go-w,a+r *
find . -type d -exec 'chmod' 'a+x' '{}' ';'

mkisofs -J -R -v -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 ""
______________________________________________________________________



More information about the Yum mailing list