Skip to content

Instantly share code, notes, and snippets.

@sickbock
Last active December 7, 2024 13:09

Revisions

  1. sickbock revised this gist Dec 23, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -24,12 +24,12 @@ create a directory “pxelinux,cfg”
    creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):

    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)
    Copy the kernel and initrd + upgrade images, e.g. from the mounted installation media or from the [web](http://mirror.centos.org/), e.g.:

    cd ~/.config/VirtualBox/TFTP/
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/upgrade.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):

  2. sickbock revised this gist Dec 23, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,7 @@ Copy the kernel and initrd, e.g. from the mounted installation media or the loca

    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/upgrade.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):
  3. sickbock revised this gist Sep 26, 2015. 2 changed files with 5 additions and 2 deletions.
    3 changes: 2 additions & 1 deletion create_vm.sh
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ vboxmanage createvm --name ${MyVM} --ostype RedHat_64 --register
    vboxmanage modifyvm ${MyVM} --memory 6172 --vram=12 --acpi on --nic1 NAT # optional second NIC # --nic2 bridged --bridgeadapter2 enp0s25
    vboxmanage modifyvm ${MyVM} --nictype1 virtio
    # optional second NIC # vboxmanage modifyvm ${MyVM} --nictype2 virtio
    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 net --boot3 dvd --boot4 none
    vboxmanage modifyvm ${MyVM} --boot1 net --boot2 disk --boot3 none --boot4 none # to do PXE boot
    # or for normal boot: # vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 net --boot3 dvd --boot4 none
    vboxmanage storagectl ${MyVM} --name "SATA Controller" --add sata --controller IntelAHCI
    vboxmanage storageattach ${MyVM} --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium `pwd`/${MyVM}.vdi
    4 changes: 3 additions & 1 deletion pxelinux.cfg
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,6 @@ menu label Boot from ^local drive
    LABEL Kickstart CentOS 7 x86_64
    MENU LABEL ^Kickstart CentOS 7 x86_64
    KERNEL vmlinuz
    APPEND initrd=initrd.img ks=http://<host IP>/kickstart.cfg
    APPEND initrd=initrd.img ks=http://<host IP>/kickstart.cfg ramdisk_size=131072 ip=dhcp lang=en_US keymap=us hostname=mypxetest
    # or, if you can not use a webserver or have not yet created your own Kickstart configuration:
    #APPEND initrd=initrd.img https://github.com/sickbock/el7_kickstart/raw/master/kickstart-el7-netboot-basic-install.cfg ramdisk_size=131072 ip=dhcp lang=en_US keymap=us hostname=mypxetest
  4. sickbock revised this gist Sep 26, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pxelinux.cfg
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ LABEL local
    menu label Boot from ^local drive
    `localboot 0xffff

    LABEL RHEL CentOS 7 x86_64
    MENU LABEL CentOS 7 x86_64
    LABEL Kickstart CentOS 7 x86_64
    MENU LABEL ^Kickstart CentOS 7 x86_64
    KERNEL vmlinuz
    APPEND initrd=initrd.img ks=http://<host IP>/kickstart.cfg
  5. sickbock revised this gist Sep 21, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -28,8 +28,7 @@ Copy the kernel and initrd, e.g. from the mounted installation media or the loca

    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/upgrade.img
    mv -i vmlinuz initrd.img upgrade.img ~/.config/VirtualBox/TFTP/
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):

  6. sickbock revised this gist Sep 21, 2015. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ Copy the kernel and initrd, e.g. from the mounted installation media or the loca
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/upgrade.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/
    mv -i vmlinuz initrd.img upgrade.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):

    @@ -85,9 +85,11 @@ For most of these configurations your virtual machine needs to be off line:
    * Add the name your want to use with that address to your `/etc/hosts`
    * Configure portforwarding e.g. forward ssh to listen on `127.0.0.4:2222` for your "third" VM in `/etc/hosts`

    Implement the portforwarding rule:
    Implement the portforwarding rule and, add the VM to your `/etc/hosts`, start your VM and use the rule

    vboxmanage modifyvm ${MyVM} --natpf1 "ssh,tcp,127.0.0.4,2222,,22"


    NB: the fifth field could contain the guest's IP addres. Leave it blank to use the DHCP address.
    echo "127.0.0.4 ${MyVM}" >> /etc/hosts
    vboxmanage startvm ${MyVM}
    ssh -p 2222 root@${MyVM}

    NB: the fifth field could contain the guest's IP addres. Leave it blank to use the DHCP address.
  7. sickbock revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -85,6 +85,7 @@ For most of these configurations your virtual machine needs to be off line:
    * Add the name your want to use with that address to your `/etc/hosts`
    * Configure portforwarding e.g. forward ssh to listen on `127.0.0.4:2222` for your "third" VM in `/etc/hosts`

    Implement the portforwarding rule:

    vboxmanage modifyvm ${MyVM} --natpf1 "ssh,tcp,127.0.0.4,2222,,22"

  8. sickbock revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -88,4 +88,5 @@ For most of these configurations your virtual machine needs to be off line:

    vboxmanage modifyvm ${MyVM} --natpf1 "ssh,tcp,127.0.0.4,2222,,22"


    NB: the fifth field could contain the guest's IP addres. Leave it blank to use the DHCP address.
  9. sickbock revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -80,7 +80,7 @@ For most of these configurations your virtual machine needs to be off line:

    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 dvd --boot3 none --boot4 none

    **NAT:** With the NAT configuartion on just one interface the virtual machine can readh the outside world but you cannot access it directly from your host. A neat trick is to assign the machine an address on your loopback network:
    **NAT:** With the NAT configuartion on just one interface the virtual machine can reach the outside world but you cannot access it directly from your host. A neat trick is to assign the machine an address on your loopback network:
    * Get the next available `127.0.0.*` address from your `/etc/hosts` (or windows equivalent)
    * Add the name your want to use with that address to your `/etc/hosts`
    * Configure portforwarding e.g. forward ssh to listen on `127.0.0.4:2222` for your "third" VM in `/etc/hosts`
  10. sickbock revised this gist Sep 21, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -71,6 +71,10 @@ Or, as soon as you have automated everything:
    vboxheadless --startvm ${MyVM}

    **Post install VirtualBox configurations**

    For most of these configurations your virtual machine needs to be off line:

    vboxmanage controlvm ${MyVM} acpipowerbutton

    **Boot configuration:** The `localboot` item in the sample menu is a bit redundand when using VirtualBox since this hypervisor [refuses](https://www.virtualbox.org/ticket/2680) to honour such a request! Nothing changed since 2008! Only thing you can do is change your boot order again after installation (if this is not done by VirtualBox) e.g.:

    @@ -81,6 +85,7 @@ Or, as soon as you have automated everything:
    * Add the name your want to use with that address to your `/etc/hosts`
    * Configure portforwarding e.g. forward ssh to listen on `127.0.0.4:2222` for your "third" VM in `/etc/hosts`


    vboxmanage modifyvm ${MyVM} --natpf1 "ssh,tcp,127.0.0.4,2222,,22"

    NB: the fifth field could contain the guest's IP addres. Leave it blank to use the DHCP address.
  11. sickbock revised this gist Sep 21, 2015. 1 changed file with 16 additions and 4 deletions.
    20 changes: 16 additions & 4 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -26,8 +26,9 @@ creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you
    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)

    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/upgrade.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):
    @@ -68,7 +69,18 @@ Now you should be able to boot the VM (and at least show the SysLinux menu and e
    Or, as soon as you have automated everything:

    vboxheadless --startvm ${MyVM}

    **Post install VirtualBox configurations**

    **Note:** The `localboot` item in the sample menu is a bit redundand when using VirtualBox since this hypervisor [refuses](https://www.virtualbox.org/ticket/2680) to honour such a request! Nothing changed since 2008! Only thing you can do is change your boot order again after installation (if this is not done by VirtualBox) e.g.:
    **Boot configuration:** The `localboot` item in the sample menu is a bit redundand when using VirtualBox since this hypervisor [refuses](https://www.virtualbox.org/ticket/2680) to honour such a request! Nothing changed since 2008! Only thing you can do is change your boot order again after installation (if this is not done by VirtualBox) e.g.:

    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 dvd --boot3 none --boot4 none

    **NAT:** With the NAT configuartion on just one interface the virtual machine can readh the outside world but you cannot access it directly from your host. A neat trick is to assign the machine an address on your loopback network:
    * Get the next available `127.0.0.*` address from your `/etc/hosts` (or windows equivalent)
    * Add the name your want to use with that address to your `/etc/hosts`
    * Configure portforwarding e.g. forward ssh to listen on `127.0.0.4:2222` for your "third" VM in `/etc/hosts`

    vboxmanage modifyvm ${MyVM} --natpf1 "ssh,tcp,127.0.0.4,2222,,22"

    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 dvd --boot3 none --boot4 none
    NB: the fifth field could contain the guest's IP addres. Leave it blank to use the DHCP address.
  12. sickbock revised this gist Sep 20, 2015. 2 changed files with 2 additions and 2 deletions.
    File renamed without changes.
    4 changes: 2 additions & 2 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -46,8 +46,8 @@ The relevant above steps for OS X (translate to Windows speak if you are using t
    mkdir ~/Library/VirtualBox/TFTP/pxelinux,cfg
    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    cd ~/Library/VirtualBox/TFTP/
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz
    curl -O http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img

    **Virtual machine configuration**

  13. sickbock revised this gist Sep 19, 2015. 2 changed files with 6 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion isolinux.cfg
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ menu title PXE boot menu

    LABEL local
    menu label Boot from ^local drive
    localboot 0xffff
    `localboot 0xffff

    LABEL RHEL CentOS 7 x86_64
    MENU LABEL CentOS 7 x86_64
    6 changes: 5 additions & 1 deletion vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -67,4 +67,8 @@ Now you should be able to boot the VM (and at least show the SysLinux menu and e

    Or, as soon as you have automated everything:

    vboxheadless --startvm ${MyVM}
    vboxheadless --startvm ${MyVM}

    **Note:** The `localboot` item in the sample menu is a bit redundand when using VirtualBox since this hypervisor [refuses](https://www.virtualbox.org/ticket/2680) to honour such a request! Nothing changed since 2008! Only thing you can do is change your boot order again after installation (if this is not done by VirtualBox) e.g.:

    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 dvd --boot3 none --boot4 none
  14. sickbock revised this gist Sep 19, 2015. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,25 @@ Copy the kernel and initrd, e.g. from the mounted installation media or the loca
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    The relevant above steps for OS X (translate to Windows speak if you are using that):

    cd ~/Downloads
    curl -O https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.zip
    mkdir ~/syslinux
    cd syslinux
    unzip -q ~/Downloads/syslinux-6.03.zip
    mkdir ~/Library/VirtualBox/TFTP
    mv -i bios/com32/lib/libcom32.c32 bios/com32/menu/vesamenu.c32 \
    bios/com32/libutil/libutil.c32 bios/com32/elflink/ldlinux/ldlinux.c32 \
    bios/core/pxelinux.0 ~/Library/VirtualBox/TFTP/
    cd
    rm -rf syslinux
    mkdir ~/Library/VirtualBox/TFTP/pxelinux,cfg
    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    cd ~/Library/VirtualBox/TFTP/
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img

    **Virtual machine configuration**

    To configure a virtual machine to boot creat a link to the `pxeboot.0` with the name you used (e.g. `$MyVM`)
  15. sickbock revised this gist Sep 19, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -44,4 +44,8 @@ If needed, reconfigure your VM for network boot using NAT:

    Now you should be able to boot the VM (and at least show the SysLinux menu and eventually continu with your `APPEND` line ..)

    vboxmanage startvm ${MyVM}

    Or, as soon as you have automated everything:

    vboxheadless --startvm ${MyVM}
  16. sickbock revised this gist Sep 19, 2015. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions isolinux.cfg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    default vesamenu.c32
    timeout 300
    ONTIMEOUT local
    display boot.msg
    menu resolution 640 480
    menu clear
    menu title PXE boot menu

    LABEL local
    menu label Boot from ^local drive
    localboot 0xffff

    LABEL RHEL CentOS 7 x86_64
    MENU LABEL CentOS 7 x86_64
    KERNEL vmlinuz
    APPEND initrd=initrd.img ks=http://<host IP>/kickstart.cfg
  17. sickbock revised this gist Sep 19, 2015. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions create_vm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash
    cd ${myVMs}
    MyVM=testvm
    vboxmanage unregistervm ${MyVM} --delete
    rm -rf ${MyVM}
    mkdir ${MyVM}
    cd ${MyVM}
    vboxmanage createhd --filename ${MyVM}.vdi --size 30720
    vboxmanage createvm --name ${MyVM} --ostype RedHat_64 --register
    vboxmanage modifyvm ${MyVM} --memory 6172 --vram=12 --acpi on --nic1 NAT # optional second NIC # --nic2 bridged --bridgeadapter2 enp0s25
    vboxmanage modifyvm ${MyVM} --nictype1 virtio
    # optional second NIC # vboxmanage modifyvm ${MyVM} --nictype2 virtio
    vboxmanage modifyvm ${MyVM} --boot1 disk --boot2 net --boot3 dvd --boot4 none
    vboxmanage storagectl ${MyVM} --name "SATA Controller" --add sata --controller IntelAHCI
    vboxmanage storageattach ${MyVM} --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium `pwd`/${MyVM}.vdi
  18. sickbock revised this gist Sep 19, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    The VirtualBox NAT contains a [built-in](http://www.virtualbox.org/manual/ch06.html#nat-tftp) TFTP and DHCP server that allow you to boot the first interface if you make it a NAT interface.

    **Define a virtual machine using VirtualBox**

    E.g. see the `create_vm.sh` example or use the GUI

    **VirtualBox configuration**

    You can boot any OS supported by VirtualBox. In this example we configure SysLinux.
    Get the required boot files (usually available on Linux, else [download from kernel.org](https://www.kernel.org/pub/linux/utils/boot/syslinux/))

    @@ -29,6 +31,7 @@ Copy the kernel and initrd, e.g. from the mounted installation media or the loca
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    **Virtual machine configuration**

    To configure a virtual machine to boot creat a link to the `pxeboot.0` with the name you used (e.g. `$MyVM`)

    MyVM=testvm
  19. sickbock revised this gist Sep 19, 2015. 1 changed file with 14 additions and 9 deletions.
    23 changes: 14 additions & 9 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -5,35 +5,40 @@ E.g. see the `create_vm.sh` example or use the GUI

    **VirtualBox configuration**
    You can boot any OS supported by VirtualBox. In this example we configure SysLinux.
    * Get the required boot files (usually available on Linux, else [download from kernel.org](https://www.kernel.org/pub/linux/utils/boot/syslinux/))
    * Create a TFTP root directory in your VirtualBox configuration directory (usually `~/.config/VirtualBox/VirtualBox.xml` on Linux or `~/Library/VirtualBox` on OS X)
    * Copy the boot files:
    Get the required boot files (usually available on Linux, else [download from kernel.org](https://www.kernel.org/pub/linux/utils/boot/syslinux/))


    Create a TFTP root directory in your VirtualBox configuration directory (usually `~/.config/VirtualBox/VirtualBox.xml` on Linux or `~/Library/VirtualBox` on OS X)

    Copy the boot files:

    mkdir ~/.config/VirtualBox/TFTP
    cd /usr/share/syslinux/
    cp pxelinux.0 ldlinux.c32 libcom32.c32 libutil.c32 vesamenu.c32 \
    ~/.config/VirtualBox/TFTP/

    * create a directory “pxelinux,cfg”
    create a directory “pxelinux,cfg”

    mkdir ~/.config/VirtualBox/TFTP/pxelinux.cfg

    * creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):
    creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):

    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    * Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)
    Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)

    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    **Virtual machine configuration**
    To configure a virtual machine to boot creat a link to the `pxeboot.0` with the name you used (e.g. `$MyVM`)

    MyVM=testvm
    cd ~/.config/VirtualBox/TFTP/ # cd ~/Library/VirtualBox/TFTP/
    ln -s pxelinux.0 ${MyVM}.pxe
    If needed, reconfigure your VM for network boot using NAT:

    vboxmanage modifyvm ${MyVM} --nic1 NAT --nictype1 virtio
    vboxmanage modifyvm ${MyVM} --boot1 net --boot2 disk --boot3 none --boot4 none
    * Now you should be able to boot the VM (and at least show the SysLinux menu and eventually continu with your `APPEND` line ..)

    Now you should be able to boot the VM (and at least show the SysLinux menu and eventually continu with your `APPEND` line ..)

    vboxheadless --startvm ${MyVM}
  20. sickbock revised this gist Sep 19, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,12 @@ You can boot any OS supported by VirtualBox. In this example we configure SysLin
    mkdir ~/.config/VirtualBox/TFTP
    cd /usr/share/syslinux/
    cp pxelinux.0 ldlinux.c32 libcom32.c32 libutil.c32 vesamenu.c32 \
    ~/.config/VirtualBox/TFTP/
    ~/.config/VirtualBox/TFTP/

    * create a directory “pxelinux,cfg”

    mkdir ~/.config/VirtualBox/TFTP/pxelinux.cfg

    * creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):

    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
  21. sickbock revised this gist Sep 19, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -8,15 +8,19 @@ You can boot any OS supported by VirtualBox. In this example we configure SysLin
    * Get the required boot files (usually available on Linux, else [download from kernel.org](https://www.kernel.org/pub/linux/utils/boot/syslinux/))
    * Create a TFTP root directory in your VirtualBox configuration directory (usually `~/.config/VirtualBox/VirtualBox.xml` on Linux or `~/Library/VirtualBox` on OS X)
    * Copy the boot files:

    mkdir ~/.config/VirtualBox/TFTP
    cd /usr/share/syslinux/
    cp pxelinux.0 ldlinux.c32 libcom32.c32 libutil.c32 vesamenu.c32 \
    ~/.config/VirtualBox/TFTP/
    * create a directory “pxelinux,cfg”

    mkdir ~/.config/VirtualBox/TFTP/pxelinux.cfg
    * creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):

    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    * Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)

    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/
  22. sickbock created this gist Sep 19, 2015.
    33 changes: 33 additions & 0 deletions vbox-pxeboot.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    The VirtualBox NAT contains a [built-in](http://www.virtualbox.org/manual/ch06.html#nat-tftp) TFTP and DHCP server that allow you to boot the first interface if you make it a NAT interface.

    **Define a virtual machine using VirtualBox**
    E.g. see the `create_vm.sh` example or use the GUI

    **VirtualBox configuration**
    You can boot any OS supported by VirtualBox. In this example we configure SysLinux.
    * Get the required boot files (usually available on Linux, else [download from kernel.org](https://www.kernel.org/pub/linux/utils/boot/syslinux/))
    * Create a TFTP root directory in your VirtualBox configuration directory (usually `~/.config/VirtualBox/VirtualBox.xml` on Linux or `~/Library/VirtualBox` on OS X)
    * Copy the boot files:
    mkdir ~/.config/VirtualBox/TFTP
    cd /usr/share/syslinux/
    cp pxelinux.0 ldlinux.c32 libcom32.c32 libutil.c32 vesamenu.c32 \
    ~/.config/VirtualBox/TFTP/
    * create a directory “pxelinux,cfg”
    mkdir ~/.config/VirtualBox/TFTP/pxelinux.cfg
    * creat a menu - see `isolinux.cfg` or the example on your Linux mirror (when you are done testing, you can set it to network-boot with no timeout for hands free network installation):
    vi ~/.config/VirtualBox/TFTP/pxelinux.cfg/default
    * Copy the kernel and initrd, e.g. from the mounted installation media or the local mirror for your [your choice](http://mirror.centos.org/)
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/vmlinuz
    curl -O http://mirror.centos.org/centos-7/7.1.1503/os/x86_64/isolinux/initrd.img
    mv -i vmlinuz initrd.img ~/.config/VirtualBox/TFTP/

    **Virtual machine configuration**
    To configure a virtual machine to boot creat a link to the `pxeboot.0` with the name you used (e.g. `$MyVM`)
    MyVM=testvm
    cd ~/.config/VirtualBox/TFTP/ # cd ~/Library/VirtualBox/TFTP/
    ln -s pxelinux.0 ${MyVM}.pxe
    If needed, reconfigure your VM for network boot using NAT:
    vboxmanage modifyvm ${MyVM} --nic1 NAT --nictype1 virtio
    vboxmanage modifyvm ${MyVM} --boot1 net --boot2 disk --boot3 none --boot4 none
    * Now you should be able to boot the VM (and at least show the SysLinux menu and eventually continu with your `APPEND` line ..)
    vboxheadless --startvm ${MyVM}