Search This Blog

Showing posts with label pxe. Show all posts
Showing posts with label pxe. Show all posts

2015-02-02

ESXi 5.1 PXE Install

ESXi PXE Install is very similar to any other kind of automated PXE deployment.

There are a few finicky components you'll have to deal with but overall it's fairly straight forward.

This is assuming you already have PXELINUX fully installed and configured along with DHCP and TFTP Server

  1. Download the ISO
  2. Mount the iso (I'm mounting in BSD)
  3. mdconfig -a -t vnode -f isoimage.iso -u 1 mount -t cd9660 /dev/md1 /mnt/iso/
  4. Create a directory to store the raw iso files
  5. mkdir -p /images/esxi/5.1/1065491/dell-a03/ I like to organize my images via. MajorVersion-Build-SpecialInfo
  6. Rsync the iso contents over
  7. rsync -av /mnt/iso/ /images/esxi/5.1/1065491/dell-a03/
  8. unmount the iso
  9. umount /mnt/iso mdconfig -d -u 1
  10. Create an "isolinux.cfg" file which basically is just used to point to the files required to boot up and run the kernel/kickstart files. This file will exist typically under the pxelinux.cfg directory either as the file called "default" or will match the mac-address of the machine you would like to image
  11. /images/kickstart/ESXI-5.1-1065491-dell-a03.ks DEFAULT install LABEL install KERNEL images/esxi/5.1/1065491/dell-a03/mboot.c32 APPEND -c images/esxi/5.1/1065491/dell-a03/boot.cfg MENU LABEL Dell ESXi-5.1-Update 1-1065491(A03) ^Installer As you can see mine is fairly simple with no menu.c32 as this file I dont want to have any options. I just want to copy this file over and have it boot up the correct references files ex. KERNEL $path to mboot.c32
  12. Modify the boot.cfg file so that it does not reference the tftp root directory thanks to http://brain.serenity-networks.com/networking-computers/vmware/esxi-5-5-5-pxe-installation-via-syslinux
  13. sed -e "s#/##g" -e "3s#^#prefix=/`basename $PWD`/\n#" -i.bak boot.cfg The above line will not only remove preceeding / it will also add a prefix= parameter where we can specify the path to our files.
  14. Then you will modify the prefix parameter with the path to your files on tftp. In my case it would be "/images/esxi/5.1/1065491/dell-a03/"
  15. bootstate=0 title=Loading ESXi installer prefix=images/esxi/5.1/1065491/dell-a03/ kernel=tboot.b00 kernelopt=ks=ftp://ftp/images/kickstart/scripts/ESXI-5.1-1065491-dell-a03.ks modules=b.b00 --- useropts.gz --- k.b00 --- chardevs.b00 --- a.b00 --- user.b00 --- s.v00 --- misc_cni.v00 --- net_bnx2.v00 --- net_bnx2.v01 --- net_cnic.v00 --- net_tg3.v00 --- scsi_bnx.v00 --- scsi_bnx.v01 --- net_bna.v00 --- scsi_bfa.v00 --- ima_be2i.v00 --- scsi_be2.v00 --- scsi_lpf.v00 --- net_igb.v00 --- net_ixgb.v00 --- scsi_mpt.v00 --- scsi_mti.v00 --- ima_qla4.v00 --- net_qlcn.v00 --- scsi_qla.v00 --- scsi_qla.v01 --- ata_pata.v00 --- ata_pata.v01 --- ata_pata.v02 --- ata_pata.v03 --- ata_pata.v04 --- ata_pata.v05 --- ata_pata.v06 --- ata_pata.v07 --- block_cc.v00 --- ehci_ehc.v00 --- weaselin.t00 --- esx_dvfi.v00 --- xlibs.v00 --- ipmi_ipm.v00 --- ipmi_ipm.v01 --- ipmi_ipm.v02 --- misc_dri.v00 --- net_be2n.v00 --- net_e100.v00 --- net_e100.v01 --- net_enic.v00 --- net_forc.v00 --- net_nx_n.v00 --- net_qlge.v00 --- net_r816.v00 --- net_r816.v01 --- net_s2io.v00 --- net_sky2.v00 --- net_vmxn.v00 --- ohci_usb.v00 --- sata_ahc.v00 --- sata_ata.v00 --- sata_sat.v00 --- sata_sat.v01 --- sata_sat.v02 --- sata_sat.v03 --- sata_sat.v04 --- scsi_aac.v00 --- scsi_adp.v00 --- scsi_aic.v00 --- scsi_fni.v00 --- scsi_hps.v00 --- scsi_ips.v00 --- scsi_meg.v00 --- scsi_meg.v01 --- scsi_meg.v02 --- scsi_mpt.v01 --- scsi_mpt.v02 --- scsi_rst.v00 --- uhci_usb.v00 --- tools.t00 --- dell_con.v00 --- xorg.v00 --- imgdb.tgz --- imgpayld.tgz build= updated=0

References:
Example kickstart config from yellow-bricks: http://www.yellow-bricks.com/2011/07/19/esxi-5-0-and-scripted-installs/
Kickstart valid parameters: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2004582
Example kickstart from william lam: http://www.virtuallyghetto.com/2011/07/automating-esxi-5x-kickstart-tips.html
Blog to show how to structure boot.cfg: http://brain.serenity-networks.com/networking-computers/vmware/esxi-5-5-5-pxe-installation-via-syslinux/
Vmware documentation on PXE Install: https://pubs.vmware.com/vsphere-50/index.jsp#com.vmware.vsphere.install.doc_50/GUID-B9DB94CA-4857-458B-B6F1-6A688726AED0.html

2014-11-11

Network Ubuntu Install via PXE Using Preseed - Kickstart Alternative

Ubuntu has a method of automatic network installation similar to redhat's kickstart install.

It's called "debian-installer" and it is the recommended method of installing ubuntu automatically.

Similar to kickstart you have a preconfiguration file called "preseed" in which you answer questions asked by the installer.

You can either:
  1. Install ubuntu manually and export answers to questions
  2. Create answers to questions manually

#1 you can perform using:

# Generate a sample preseed.cfg with some default values you selected during manual install
apt-get install debconf-utils
debconf-get-selections --installer > preseed.cfg
debconf-get-selections >> preseed.cfg


Then you make this file available in the kickstart menu.

I've included a sample menu file (which points to the preseed) as well as the contents of a basic preseed file.
Menu File:

default linux

SERIAL 0 115200

label linux
kernel images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/linux
append initrd=images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/initrd.gz auto=true priority=critical interface=auto url=ftp://fbsd-ftp/images/ubuntu/14.04/preseed/sandvine.seed -- console=ttyS0,115200n8
IPAPPEND 2


Preseed File:

# Primary network interface:
d-i netcfg/choose_interface select auto

# Locale Configuration
d-i debian-installer/locale string en_US

# Set Keyboard to American English
d-i console-keymaps-at/keymap select American English
d-i debian-installer/keymap string us

# Set timezone
d-i time/zone string American/Toronto

# Do not make a user account
d-i passwd/make-user boolean false

# Assign the password for root
d-i passwd/root-password password sandvine
d-i passwd/root-password-again password sandvine

# Allow root login
user-setup-udeb passwd/root-login boolean true

# Partitioning
# Partition using LVM on the first and only detected disk
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean false
partman-lvm partman-lvm/device_remove_lvm boolean true
partman-lvm partman-lvm/confirm_nochanges boolean true
partman-lvm partman-lvm/confirm boolean true
unknown partman-lvm/confirm boolean true
partman-lvm partman-lvm/vgdelete_confirm boolean true

# Choose automatic partitioning recipes where automatic puts
# All configuration on the same partition
d-i partman-auto/choose_recipe select automic
# Complete partitioning without further confirmation
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

#Choose some additional packages to instal
d-i pkgsel/include string openssh-server


### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
d-i finish-install/keep-consoles boolean true

# Send command to pxeboot server to tell it to boot from HDD after imaging is successful
d-i preseed/late_command string /bin/echo "$(hostname -s)" | nc -w 3 lab-nfsbootlinux 2509

# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note


Ubuntu does have support for kickstart but there are some important features that may not be fully featured in kickstart that are available in debian installer. Ubuntu even has system-config-kickstart utility to build kickstart files but because of the lack of full functionality it does not end up being as useful as the more fully funcitoning debian installer.

References:
Serial Console - http://blather.michaelwlucas.com/archives/638
Package Install (openssh) - http://www.stratuslab.eu/fp7/doku.php/tutoral:examplepreseed.html
Remove LVM Parts - http://ubuntuforums.org/showthread.php?t=1505174
Debian Example Preseed - http://d-i.debian.org/manual/example-preseed.txt
Ubutntu Example Preseed - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
Ubuntu 12.04 Preseed Explained - https://help.ubuntu.com/12.04/installation-guide/i386/preseed-contents.html
Ubuntu 10.04 Preseed example - https://help.ubuntu.com/10.04/installation-guide/example-preseed.txt
Generate a preseed - http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
Puppet and Preseed - http://ghantoos.org/2012/10/21/cocktail-of-pxe-debian-preseed-ipmi-puppet/
Add Console and debug to menu - http://christian.hofstaedtler.name/blog/2008/09/debian-installer-preseeding-autostart-from-pxe.html
Ubuntu 14.04 install bug - http://www.michaelm.info/blog/?p=1378
What you need to append to menu - https://saz.sh/2011/07/30/preseed-debian-squeeze-using-pxe/
Create User Accounts - https://help.ubuntu.com/community/Cobbler/Preseed
Debian links:
https://www.debian-administration.org/article/394/Automating_new_Debian_installations_with_preseeding
https://www.debian.org/releases/wheezy/i386/apbs04.html.en
https://www.debian.org/releases/wheezy/i386/apbs03.html.en

Official Documentation:
http://www.debian.org/releases/stable/i386/apb.html.en
https://wiki.debian.org/DebianInstaller/Preseed
http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
http://www.debuntu.org/how-to-unattended-ubuntu-deployment-over-network-page-5-preseed-file/

New Docs:
http://web.theurbanpenguin.com/auto-installing-ubuntu-16-04/
https://www.debian.org/releases/stable/example-preseed.txt
http://hands.com/d-i/

How to get a post-install command working:
http://www.50ply.com/blog/2012/07/16/automating-debian-installs-with-preseed-and-puppet/
https://ubuntuforums.org/showthread.php?t=1977570