Deploy a Custom Image Using iPXE

iPXE is a free open-source network boot firmware that provides a flexible and extensible framework for booting operating systems over a network. It provides a full PXE implementation enhanced with additional features.

You can use iPXE scripts to deploy your custom image. An iPXE script is essentially a set of instructions that are used to specify the boot process and configure network parameters. iPXE scripts can include commands for tasks such as obtaining an IP address, configuring network settings, loading specific boot images, and more.

Prerequisites

  • You should have a valid public URL to store your iPXE script.

  • If you temporarily have no public URL, you can refer to Netboot to finish the OS installation.

Procedures

Deploying a Custom Image

See Create a Bare Metal Instance for detailed steps of how to create an instance, and in operating system selecting,

  1. Choose Custom-iPXE while creating an instance.

  2. Enter your URL storing your iPXE script.

Follow the other steps to finish instance creation.

Note

After deploying with a custom iPXE image,

  • You cannot create partitions or label your hostname.

  • You can only have the system-generated password.

  • Your instance will show from Creating to Installing, and to Powered On state. That doesn't mean your image has finished installing. You will need to remote access the instance to configure on the system.

What to Do Next

  1. Go to instance Details > OS&IPMI page and set the IPMI password.

  2. Log in to IPMI Console using the public username and the newly set password.

  3. Finish the installation of your OS via the iPXE script.

  4. Back to Console and go to instance Details page, and click Reset IPs.

  5. After IP resetting, restart your instance.

Here is an example of an iPXE script:

#!ipxe

# Download Ubuntu 20.04 ISO image
kernel http://path/to/ubuntu-20.04-netboot/vmlinuz
initrd http://path/to/ubuntu-20.04-netboot/initrd
boot

:install
set base-url http://path/to/ubuntu-20.04-netboot/

# Launch Ubuntu setup
kernel ${base-url}linux auto=true hostname=${hostname} domain=${domain} url=${preseed/url} locale=${locale} console-setup/layoutcode=us keyboard-configuration/layoutcode=us file=/cdrom/preseed/ubuntu-server.seed initrd=initrd.gz quiet ---
initrd ${base-url}initrd.gz
boot

Note

IP resetting may fail. Please try again. If IPs are successfully reset, you also need to check on your server to see whether your operations are effective.

Other Networking Operations

Because you have installed your OS using iPXE, all networking related operations, except for IP resetting, need to be manually configured on your instance system to take effect.

Here we take elastic IP adding as an example.

  1. Go to instance Details > Networking page and click Add Elastic IP.

  2. Select your desired elastic IP (23.90.160.73) to assign.

  3. Click Reset IPs.

  4. Remote access to your instance and execute the following commands.

sudo ip addr add 23.90.160.73/32 dev wan0

Note

You must first make IP Resetting on Console and then configure on your server to make your operations really take effect.

Last updated