Amazon Linux 2023 on VirtualBox

About seven months ago I threw my hat into a GitHub thread that had opened over a year before (March 2022!) asking Amazon to make good on its promise to release off-prem images of its AL 2023 operating system. My jab at Amazon was picked up in an article on The Register and a few weeks later there was finally some movement by Amazon, raising the profile of the issue and eventually leading to a release of KVM and VMware images mid-November. There was no image for VirtualBox and I mentioned this omission in a follow-up on GitHub. The current January 2024 release still only supports KVM and VMWare. The online instructions also omit VirtualBox. This is unusual because they had done so for previous versions of their OS.

Two weeks after the failure of Amazon to produce a VirtualBox image I decided to solve the problem myself . Here’s the environment in which I created the solution:

  • Windows 10
  • Oracle VirtualBox v7
  • WinZip / 7Zip or similar Zip tool
  • CDBurnerXP

First get the OVA file from the latest release page by navigating to the VMware sub-page and downloading the .ova file from the link therein. For the Jan 2024 release you want the file named al2023-vmware_esx-2023.3.20240122.0-kernel-6.1-x86_64.xfs.gpt.ova, and remember to check the SHA256 signature!

Using your preferred Zip tool open the .ova file and extract the .vmdk file therein.

You will find the VBoxManage.exe program in Program Files/Oracle and you can use it to generate a .vdi file for VirtualBox as follows:

  VBoxManage.exe clonehd al2023-___.vmdk al2023-___.vdi --format VDI

(I am using “___” as a shorthand.) Now create three files named “meta-data”, “network-config” and “user-data” as follows:

meta-data

local-hostname: myhost.mydomain.example.org

network-config

network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: false
      addresses:
        - 192.168.1.234/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8]

user-data

package_upgrade: false
ssh_pwauth: True
chpasswd:
  list: |
    ec2-user:mY-C0mpl3x-Pwd
  expire: False
write_files:
  - path: /etc/cloud/cloud.cfg.d/80_disable_network_after_firstboot.cfg
    content: |
      network:
        config: disabled

These are YAML files with two-space indenting. If you are interested in such configurations, check out some official examples! Feel free to use a different IP address for your VM and whatever DNS nameserver you want, and choose a different (complex) password to your liking.

Finally use the command line tool from CDBurnerXP to create an ISO containing the above three files:

cdbxpcmd.exe --burn-data -name:cidata -file:meta-data -file:network-config -file:user-data -iso:seed.iso -format:iso -changefiledates

Run VirtualBox and add the al2023-___.vdi file to the collection of virtual media images. Then set up a new VM with the following configuration:

  • Type: Linux 64-bit
  • System: 4Gb RAM, 1 or 2 CPUs
  • Storage [Controller=IDE] mounted image seed.iso
  • Storage [Controller=SATA] mounted image al2023-___.vdi
  • Display: 33MB, 1 monitor, VMSVGA.
  • Network: bridged adapter, Realtek

Boot the VM and after some initialisation sequences you should be at a login prompt in a minute or two. Log in via the console or use PuTTY (SSH). The user name is ec2-user and the password is per the user-data file above. At this point you can unmount the seed.iso as it has done its job.

Categorised as: Operating Systems, Technology

Comment Free Zone

Comments are closed.