// Module included in the following assemblies
//
// * installing/installing_bare_metal/upi/installing-bare-metal.adoc
// * installing/installing_bare_metal/upi/installing-restricted-networks-bare-metal.adoc
// * installing_bare_metal/upi/installing-bare-metal-network-customizations.adoc

:_mod-docs-content-type: PROCEDURE
[id="installation-user-infra-machines-advanced-customizing-live-{boot}_{context}"]
= Customizing a live {op-system} {boot-media}

[role="_abstract"]
You can customize a live {op-system} {boot-media} directly with the
ifeval::["{boot-media}" == "ISO image"]
`coreos-installer iso customize`
endif::[]
ifeval::["{boot-media}" == "PXE environment"]
`coreos-installer pxe customize`
endif::[]
subcommand. When you boot the {boot-media}, the customizations are applied automatically. You can use this feature to configure the {boot-media} to automatically install {op-system}.

.Procedure

. Download the `coreos-installer` binary from the link:https://mirror.openshift.com/pub/openshift-v4/clients/coreos-installer/latest/[`coreos-installer` image mirror] page.

ifeval::["{boot-media}" == "ISO image"]
. Retrieve the {op-system} ISO image from the link:https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/[{op-system} image mirror] page and the Ignition config file, and then run the following command to inject the Ignition config directly into the ISO image:
+
[source,terminal]
----
$ coreos-installer iso customize rhcos-<version>-live.x86_64.iso \
    --dest-ignition bootstrap.ign \
    --dest-device /dev/disk/by-id/scsi-<serial_number>
----
+
where:
+
`--dest-ignition`:: Specifies the Ignition config file that is generated from the `openshift-installer` installation program.
`--dest-device`:: When you specify this option, the {boot-media} automatically runs an installation. Otherwise, the image remains configured for installation, but does not install automatically unless you specify the `coreos.inst.install_dev` kernel argument.

. Optional: To remove the {boot-media} customizations and return the image to its pristine state, run:
+
[source,terminal]
----
$ coreos-installer iso reset rhcos-<version>-live.x86_64.iso
----
+
You can now re-customize the live {boot-media} or use it in its pristine state.
endif::[]

ifeval::["{boot-media}" == "PXE environment"]
. Retrieve the {op-system} `kernel`, `initramfs`, and `rootfs` files from the link:https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/[{op-system} image mirror] page and the Ignition config file, and then run the following command to create a new `initramfs` file that contains the customizations from your Ignition config:
+
[source,terminal]
----
$ coreos-installer pxe customize rhcos-<version>-live-initramfs.x86_64.img \
    --dest-ignition bootstrap.ign \
    --dest-device /dev/disk/by-id/scsi-<serial_number> \
    -o rhcos-<version>-custom-initramfs.x86_64.img
----
+
where:
+
`--dest-ignition`:: Specifies the Ignition config file that is generated from `openshift-installer`.
`<serial_number>`:: When you specify this option, the {boot-media} automatically runs an install. Otherwise, the image remains configured for installation, but does not do so automatically unless you specify the `coreos.inst.install_dev` kernel argument.
`<version>`:: Use the customized `initramfs` file in your PXE configuration. Add the `ignition.firstboot` and `ignition.platform.id=metal` kernel arguments if they are not already present.
endif::[]
+
Applying your customizations affects every subsequent boot of {op-system}.
