Ubuntu ARM64 Vagrant Box Creation Script for UTM. This script downloads an Ubuntu Noble server cloud image and packages it as a Vagrant box. Download the Ubuntu Noble server cloud image for ARM64 architecture. Cloud images are optimized and minimal (~600MB)
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.imgCreate a Vagrantfile for the ARM-based box configuration. This defines the VM specifications: 2GB RAM and 2 CPU cores for UTM provider.
cat > Vagrantfile.arm << 'EOF'
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu-arm64-local"
# UTM provider configuration
config.vm.provider "utm" do |utm|
utm.memory = 2048 # 2GB RAM
utm.cpus = 2 # 2 CPU cores
end
end
EOFCreate directory structure for the Vagrant box. Vagrant boxes require specific metadata and configuration files.
mkdir -p ubuntu-arm64-box
cd ubuntu-arm64-boxCreate metadata.json – defines the box provider type and version. This file tells Vagrant which provider this box is designed for.
cat > metadata.json << 'EOF'
{
"provider": "utm",
"version": "1.0"
}
EOFCreate a minimal Vagrantfile template inside the box. This is the default configuration when the box is used.
cat > Vagrantfile << 'EOF'
Vagrant.configure("2") do |config|
end
EOFCopy the downloaded cloud image and rename it to box.img. Vagrant expects the disk image to be named box.img inside the box archive.
cp ../noble-server-cloudimg-arm64.img box.imgPackage all components into a compressed tar archive. This creates the final ubuntu-arm64.box file that Vagrant can use.
tar czf ../ubuntu-arm64.box \
metadata.json \
Vagrantfile \
box.imgPackage all components into a compressed tar archive. This creates the final ubuntu-arm64.box file that Vagrant can use.
Add the packaged box to Vagrant’s local box storage.The –force flag overwrites if a box with the same name already exists.
cd ..
vagrant box add --name ubuntu-arm64-minimal ./ubuntu-arm64.box --forceVerify the box was added successfully.This lists all available Vagrant boxes on the system.
vagrant box list
ubuntu-arm64-minimal (utm, 0, (arm64))
ls -alh -S
total 2427136
-rw-r--r--@ 1 xchose staff 592M Jan 8 14:25 noble-server-cloudimg-arm64.img
-rw-r--r--@ 1 xchose staff 584M Jan 23 09:56 ubuntu-arm64.box
drwxr-xr-x@ 7 xchose staff 224B Jan 23 09:55 ..
-rw-r--r--@ 1 xchose staff 224B Jan 23 09:56 Vagrantfile.arm
drwxr-xr-x@ 6 xchose staff 192B Jan 23 09:56 .
drwxr-xr-x@ 5 xchose staff 160B Jan 23 09:56 ubuntu-arm64-box