Create Ubuntu (2204) image on Nutanix Element to use with Morpheus

  1. Navigate to Get Ubuntu Server | Download | Ubuntu.

  2. Right-click on the download now button and copy the URL.

  1. Logon to Nutanix web console.

  2. Click on Settings >> Image configuration.

  1. Click Upload image.

  2. Set Name.

  3. Select ‘ISO’ on image type list.

  4. Select ‘SelfServiceContainer’ container on storage container list.

  5. On Image source select ‘From URL’ and paste the download link from ubuntu website that we copied earlier and click ‘Save’.

  1. Check task history to make sure the image has been uploaded as shown below

  1. Navigate to Home >> VM.

  1. Click Create VM.

Untitled 56

  1. Fill in the following settings:
  • Name
  • VCPU(s)
  • Memory

  1. Click on Edit option on the CD-ROM.

  1. Select ‘Clone from Image Service’ as operation

  2. Set bus type as ‘IDE’

  3. Select the image we uploaded earlier and click ‘Update’

  1. Click on ‘Add New Disk’.

  2. Set the config as shown below.

  1. Click on Add New Nic.

  2. Select available VLAN as shown below and click ‘Add’.

  1. Click ‘Save’ to create the VM.

  2. Click on Table and select the VM

  1. Click on Power on.

  2. Click on Launch Console.

  3. Follow the Ubuntu server installation wizard and set the following:

  • Update to the latest installer if a later version is available
  • Use the entire disk and deselect the option to set up the disk as an LVM group
  • Configure an account and set a password
  • Opt to install OpenSSH Server
  • Other optional packages aren’t needed for this basic Ubuntu image

If you see the following error just press Enter and reboot.

  1. Once the VM has been rebooted logon to the VM.

  2. Apply package update/Upgrade with the following commands:

apt-get update
apt-get upgrade

  1. Update GRUB by editing file ‘/etc/default/grub’.

  2. Modify the line 'GRUB_CMDLINE_LINUX=“” ’ with the following :

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
  1. Run the following command :
update-grub
  1. Run the following command to update file ‘70-persistent-net.rules’.
cat << EOF > /etc/udev/rules.d/70-persistent-net.rulesSUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"EOF
  1. Remove the file ‘subiquity-disable-cloudinit-networking.cfg’ with following command as cloud-init will skip network configuration if it’s present:
rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
  1. Update file ‘99-pve.cfg’ with the following:
cat << EOF > /etc/cloud/cloud.cfg.d/99-pve.cfgdatasource_list: [ConfigDrive, NoCloud]EOF
  1. Remove Netplan files with the following command as they won’t be generated if present:
rm -f /etc/netplan/00-installer-config.yaml
rm -f /etc/netplan/50-cloud-init.yaml

  1. Run the following command to clean cloud-init:
cloud-init clean
  1. Reboot the VM and notice the network interface label has now changed to ‘eth0’.

  2. Clear the Bash history with the following command:

cat /dev/null > ~/.bash_history && history -c && exit
  1. Shutdown the VM.

To Convert the VM to an image follow the steps below:

  1. Logon to Nutanix CVM via ssh.

  2. Run the following command to list disks for vm ‘MyUbuntuImgVM’ that we just created:

acli vm.get MyUbuntuImgVM include_vmdisk_paths=1 | grep -E 'disk_list|vmdisk_nfs_path|vmdisk_size|vmdisk_uuid'
  1. Make note of the vmdisk_nfs_path as shown below:

Note that the full disk URL will be : nfs://your_nutanix_node_url/your_vmdisk_nfs_path

  1. To create an image with the above disk url, Navigate to Settings >> Image Configuration >> upload image.

  1. Fill in the name text box.

  2. Select ‘Disk’ as image type.

  3. Set storage container to ‘SelfServiceContainer’.

  4. On the from URL, paste in the full disk path from step 42 and click ‘Save’…
    Note that the full disk URL will be : nfs://your_nutanix_node_url/your_vmdisk_nfs_path

  1. Click view all tasks to check the status of image creation process.

  1. Confirm that the image has been created from disk as shown below.

  1. On Morpheus navigate to Infrastructure >> Clouds >> Nutanix cloud.

  2. Run a short cloud refresh.

  3. Once synced confirm that the image has been synced into Morpheus by searching under Library >> Virtual Images.

  4. Under ‘Virtual Images’ change the filter to ‘Synced’.

  5. Search for image to confirm it has been synced.

  1. Edit the image by clicking on the pencil icon.

  1. Make sure the following settings are set and click save changes.

4 Likes

Thanks @wabbas