Re: boot cd-rom network install on system with no display using vnc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Thu, 2011-02-24 at 18:51 -0800, Peter Allen wrote:
> > Thanks. Do I need to use Kickstart?  Is Kickstart necessary to open
> > the VNC server session?
> > 
> you don't need a kickstart for that.
> >  
> > 
> > I cannot place the Kickstart file on the CD, right? 
> afaik, you can, but i never really tried it.
> 
> btw: why not use pxe? is it because you can't manage dhcp/dns? if thats
> the case, another alternative is to put gpxe on a usb/cdrom, and let it
> fetch the kernel, initrd etc over the network.
> 
> this way, you dont need to create a cdrom each time you want to change
> something.
> 
> but really, if you do that more than once, consider provisioning using a
> tool, like cobbler or foreman.

Here's what I use to do what the OP wants to do. I edited
the script to remove some code that steps outside their stated
requirements, so this is an untested script, but has a good
likelihood of working. Also note that the while the target system
is CentOS5, the generating system was not, so some tweaks
to the top set of definitions may be needed for your system.

Hope that helps,
-- 
Charles Polisher


#!/bin/bash
# Author: Charles Polisher
# Starting with a downloaded CentOS 5.5 image,
# build and burn a custom .iso with a kickstart script

# uncomment the following line to debug
# set -x

export PROJECTROOT=~chas/PROJECTS/foo
export KICKSTART=$PROJECTROOT/ks.template
export ISOIMAGE=/tmp/CentOS-5.5-i386-PUT-YOUR-IMAGE-NAME-HERE.iso
export MOUNTPOINTDIR=/mnt/iso
export TEMPFILESYS=`mktemp -d -t isofilesys_XXXXXX`
export OUTPUT_ISO=$PROJECTROOT/CentOS-5.5-i386-foo.iso
export SYSLINUXBIN=/usr/lib/syslinux/isolinux.bin
export BURNPROG=/usr/X11R6/bin/cdrecord

function cleanup () {
    echo "Cleaning up temporary files."
    if [ "X$TEMPFILESYS" != X ] ; then
       rm -rf $TEMPFILESYS
    fi
}

trap cleanup 0 SIGHUP SIGKILL SIGTERM

if [ ! -f $ISOIMAGE ]
then
    echo "Missing the source .iso image file - aborting."
    exit 1
fi

if [ ! -x /usr/bin/checkisomd5 ]
then
    echo "checkisomd5 not installed - aborting."
    exit 1
fi

if [ ! -x /usr/bin/implantisomd5 ]
then
    echo "implantisomd5 not installed - aborting."
    exit 1
fi

if [ ! -r $ISOIMAGE ]
then
    echo "Stock .iso image not found or not readable - aborting."
    exit 1
fi

if [ ! -r $SYSLINUXBIN ]
then
    echo "Boot loader isolinux.bin not found or not readable - aborting."
    exit 1
fi

if [ ${EUID} != '0' ]
then
    echo "Must run as root - aborting."
    exit 1
fi

if [ ! -d $MOUNTPOINTDIR ]
then
    mkdir $MOUNTPOINTDIR || exit 1
fi

if [ ! -r $KICKSTART ]
then
    echo "Can't find the kickstart file - aborting."
    exit 1
fi

# Mount the original .iso image onto a loopback device
losetup /dev/loop0 $ISOIMAGE || exit 1
mount -t iso9660 /dev/loop0 $MOUNTPOINTDIR || exit 1

# Unpack the original (read-only) iso9660 filesystem into a directory
cd $MOUNTPOINTDIR
tar cf - ./* | (cd $TEMPFILESYS ; tar xf -)

# Copy the kickstart file into the writeable copy of the .iso filesystem
cp $KICKSTART $TEMPFILESYS/isolinux/ks.cfg
cp $KICKSTART $TEMPFILESYS/ks.cfg

# copy a syslinux bootable binary into the writeable copy
cp $SYSLINUXBIN $TEMPFILESYS/isolinux.bin
cp $SYSLINUXBIN $TEMPFILESYS/isolinux/isolinux.bin

chmod 555 $TEMPFILESYS/isolinux.bin
chmod 555 $TEMPFILESYS/isolinux/isolinux.bin

# copy a modified isolinux configuration file into the writeable copy
# (it's basically a grub.conf file)
cat > $TEMPFILESYS/isolinux/isolinux.cfg << EOF1
default ks
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img noapic
label text
  kernel vmlinuz
  append initrd=initrd.img text  noapic
label ks
  kernel vmlinuz
  append ks=cdrom:ks.cfg initrd=initrd.img noapic
label local
  localboot 1
label memtest86
  kernel memtest
  append -

EOF1

# Create a new "el-torito" style .iso filesystem from the writeable copy
# cf. http://syslinux.zytor.com/wiki/index.php/ISOLINUX#How_Can_I_Make_a_Bootable_CD_With_ISOLINUX.3F
pushd $TEMPFILESYS

# Isolinux will not overwrite an existing  boot.cat, so remove it first
rm -f isolinux/boot.cat

mkisofs -o $OUTPUT_ISO \
    -b isolinux.bin \
    -c boot.cat \
    -no-emul-boot \
    -boot-load-size 4 \
    -boot-info-table -r -J \
    -T .

# Reach into the built .iso image and update the md5sum
/usr/bin/implantisomd5 --force --supported-iso $OUTPUT_ISO

# Burn the new .iso file to a blank cd-rom
read -p "Insert blank cd-rom then press enter: " i
$BURNPROG -v gracetime=4 \
    dev=/dev/sr0 \
    speed=1 \
    -dao \
    driveropts=burnfree \
    -eject \
    -data \
    -tsize=4862s \
    $OUTPUT_ISO 

popd

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list


[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux