Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Last active October 11, 2023 13:35
Show Gist options
  • Save dmccuk/0aecc01d8eb0807b813c12bf01d167f7 to your computer and use it in GitHub Desktop.
Save dmccuk/0aecc01d8eb0807b813c12bf01d167f7 to your computer and use it in GitHub Desktop.
other info

Creating a VM Template on VMware vSphere 7

Prerequisites

  • ISO Images: Ensure you have the ISO images for RHEL9 and OEL9 downloaded.
  • vSphere Client: Have the vSphere Client open and connected to your vCenter or ESXi host.

1. Prepare the ISO Image

  • Upload the RHEL9 and OEL9 ISOs to a datastore accessible by the ESXi hosts.

2. Create a New Virtual Machine

Step 1

  • In the vSphere Client, right-click on the target ESXi host or cluster. Choose New Virtual Machine.

Step 2

  • Follow the wizard:
    • Name and Location: Name your VM.
    • Compute Resource: Select the host or cluster.
    • Storage: Choose the datastore.
    • Compatibility: Stick with the default for vSphere 7.
    • Guest OS: Choose Linux -> Red Hat Enterprise Linux 9 (or the appropriate version for OEL9).
    • Customize Hardware: Attach the RHEL9 or OEL9 ISO image to the virtual CD/DVD drive. Adjust other hardware settings as needed.
    • Finish: Review and complete the VM creation.

3. Install the OS with ks.cfg

Step 1

  • Start the VM.

Step 2

  • At the boot screen, modify the boot options to use the ks.cfg. Append the boot line with: inst.ks=http://your_server/ks.cfg.

Step 3

  • Proceed with the installation. The OS will install using settings from the ks.cfg.

4. Post-Installation

Step 1

  • Log into the VM after installation.

Step 2

  • Install VMware Tools (yum install open-vm-tools).

Step 3

  • Perform any other necessary configurations.

5. Convert VM to Template

Step 1

  • Clean up (e.g., clear command history with history -c).

Step 2

  • Shut down the VM.

Step 3

  • In vSphere Client, right-click on the VM. Select Template > Convert to Template.

6. Deploying from the Template

  • To deploy a new VM from the template, right-click on the template and choose New VM from this Template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment