Herramientas de usuario

Herramientas del sitio


proxmox:install_proxmox_ve_from_pxe

Introduction

In order to have the installer find the .ISO image it needs to be embedded in the initrd.img that will be downloaded via PXE. Also, the initrd.img needs to be modified so that it finds and mounts the embedded .ISO image instead of searching for a physical CD.

An overview of the required steps:

  1. Extract/copy initrd.img and linux26 from the .ISO image.
  2. Extract initrd.img to a directory.
  3. Copy the .ISO image as proxmox.iso to the initrd directory.
  4. Create a new initrd.img from the directory.
  5. Copy the new initrd.img to the PXE server.

Step by step

  1. Mount the proxmox iso in a temporal directory:
    # mount proxmox-ve_3.3-a06c9f73-2.iso proxmox-iso/
  2. Copy “proxmox-iso/boot/isolinux/initrd.img” and “proxmox-iso/boot/isolinux/linux26” to a temp directory 'initrd-temp':
    # mkdir initrd-temp
    # cp proxmox-iso/boot/isolinux/initrd.img ./initrd-temp
    # cp proxmox-iso/boot/isolinux/linux26 ./initrd-temp
  3. Move to 'initrd-temp' directory and rename “initrd.img” to “initrd.org.img”, then unzip it:
    # cd initrd-temp
    # mv initrd.img initrd.org.img
    # gzip -d -S ".img" ./initrd.org.img
  4. Create a directory 'initrd.tmp' for the files in the initrd, extract initrd to this directory:
    # mkdir initrd.tmp
    # cd initrd.tmp
    # cpio -i -d < ../initrd.org
  5. Umount the Proxmox ISO and copy it as proxmox.iso:
    # umount ../../proxmox-iso/
    # cp ../../proxmox-ve_3.3-a06c9f73-2.iso proxmox.iso
  6. Create a new initrd.img:
    # find . | cpio -H newc -o > ../initrd
  7. Zip this new initrd:
    # cd ..
    # gzip -9 -S ".img" initrd

You should now have an much enlarged “initrd.img” file containing all original files from the original “initrd.org.img” as well as the .ISO. Copy it to your TFPT server (or HTTP server, for this you must to use gpxelinux.0 instead pxelinux.0) together with the “linux26” file:

# cp linux26 /srv/tftp/commons/proxmox/proxmox-ve_3.3
# cp initrd.img /srv/tftp/commons/proxmox/proxmox-ve_3.3

TFTP menu configuration

Your TFTP configuration for the menu, may look like:

label proxmox3.3
        menu label PROXMOX VE 3.3 Installer
        kernel commons/proxmox/proxmox-ve_3.3/linux26
        append vga=791 video=vseafb:ywrap,mtrr ramdisk_size=819200
        initrd commons/proxmox/proxmox-ve_3.3/initrd.img splash=verbose

NOTE: Its very important to put attention to 'ramdisk size' parameter, this value is in KB and represents the amount of RAM needed to expand the 'initrd.img' file. So to check how much RAM you need:

# du -sh initrd.tmp/
616M	initrd.tmp/

In the above example the size of 'initrd.img' when is uncompressed is 616 MB, therefore set 'ramdisk_size' to 700 MB (716800 KB) or 800 MB (819200 KB). Better 819200 KB!!

Automating the process

The follow script from http://www.kickinass.net/proxmox-ve-3-1-ueber-pxe-installieren/ can do the work for you, the only condition is rename your Proxmox VE ISO to proxmox.iso:

#!/bin/bash

BASEDIR=${1:-./}
pushd $BASEDIR >/dev/null

[ -L "proxmox.iso" ] && rm proxmox.iso &>/dev/null

for ISO in *.iso; do
    if [ "$ISO" = "*.iso" ]; then continue; fi
    if [ "$ISO" = "proxmox.iso" ]; then continue; fi
    echo "Using $ISO"
    ln -s "$ISO" proxmox.iso
done

if [ ! -f "proxmox.iso" ]; then
    echo "Couldn't find a proxmox iso, aborting."
    echo "Add /path/to/iso_dir to the commandline."
    exit 2
fi

[ -d pxeboot ] || mkdir  pxeboot
pushd pxeboot >/dev/null
[ -d mnt ] || mkdir  mnt
echo "Mounting iso image"

if ! mount -t iso9660 -o ro,loop ../proxmox.iso mnt/ ; then
    echo "Failed to mount iso image, aborting."
    exit 3
fi

cp  mnt/boot/isolinux/linux26 .
rm -f  initrd.orig initrd.orig.img initrd.img
cp  mnt/boot/isolinux/initrd.img initrd.orig.img

if ! umount  mnt ; then
    echo "Couldn't unmount iso image, aborting."
    exit 4
fi

echo "Unmounted iso, extracting contents of initrd..."
gzip -d -S ".img" ./initrd.orig.img
rm -rf initrd.tmp
mkdir  initrd.tmp
pushd initrd.tmp >/dev/null
echo "Added iso, creating and compressing the new initrd..."
cpio -i -d < ../initrd.orig 2>/dev/null
cp ../../proxmox.iso proxmox.iso
(find . | cpio -H newc -o > ../initrd.iso) 2>/dev/null
popd >/dev/null
rm -f initrd.iso.img
gzip -9 -S ".img" initrd.iso

# Now clean up temp stuff
echo "Cleaning up temp files..."
rmdir  mnt
rm -rf initrd.tmp
rm  ./initrd.orig

echo "Done!  Look in $PWD for pxeboot files."
popd >/dev/null
popd >/dev/null
proxmox/install_proxmox_ve_from_pxe.txt · Última modificación: 2022/11/02 17:58 por 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki