From 1a724d967903660510b5a1fd01e6a10412404c70 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 8 Feb 2023 22:37:46 +0000 Subject: [PATCH 01/44] refactor: remove directories and modify `centos-9` packer config --- centos-9/add-key.sh | 6 - centos-9/centos9.pkr.hcl | 89 ++++ centos-9/http/ks.cfg | 40 -- centos-9/http/ks.pkrtpl.hcl | 37 ++ centos-9/scripts/post-install.sh | 14 + centos-9/variables.auto.pkrvars.hcl | 105 +++++ centos-9/vmware-centos9.pkr.hcl | 53 --- centos-9/vmware-cleanup.sh | 7 - debian-10/add-key.sh | 6 - debian-10/buildbox.sh | 9 - debian-10/http/preseed.cfg | 436 -------------------- debian-10/metadata.json | 3 - debian-10/vmware-buster.pkr.hcl | 50 --- debian-10/vmware-cleanup.sh | 17 - ubuntu-server-20.04/add-key.sh | 6 - ubuntu-server-20.04/buildbox-parallels.sh | 10 - ubuntu-server-20.04/buildbox-vmware.sh | 9 - ubuntu-server-20.04/http/meta-data | 0 ubuntu-server-20.04/http/user-data | 22 - ubuntu-server-20.04/metadata-parallels.json | 3 - ubuntu-server-20.04/metadata.json | 3 - ubuntu-server-20.04/parallels-cleanup.sh | 7 - ubuntu-server-20.04/parallels-focal.pkr.hcl | 45 -- ubuntu-server-20.04/vmware-cleanup.sh | 8 - ubuntu-server-20.04/vmware-focal.pkr.hcl | 47 --- ubuntu-server-21.10/add-key.sh | 6 - ubuntu-server-21.10/buildbox.sh | 9 - ubuntu-server-21.10/http/meta-data | 0 ubuntu-server-21.10/http/user-data | 22 - ubuntu-server-21.10/metadata.json | 3 - ubuntu-server-21.10/vmware-cleanup.sh | 8 - ubuntu-server-21.10/vmware-impish.pkr.hcl | 47 --- 32 files changed, 245 insertions(+), 882 deletions(-) delete mode 100644 centos-9/add-key.sh create mode 100644 centos-9/centos9.pkr.hcl delete mode 100644 centos-9/http/ks.cfg create mode 100644 centos-9/http/ks.pkrtpl.hcl create mode 100644 centos-9/scripts/post-install.sh create mode 100644 centos-9/variables.auto.pkrvars.hcl delete mode 100644 centos-9/vmware-centos9.pkr.hcl delete mode 100644 centos-9/vmware-cleanup.sh delete mode 100644 debian-10/add-key.sh delete mode 100755 debian-10/buildbox.sh delete mode 100644 debian-10/http/preseed.cfg delete mode 100644 debian-10/metadata.json delete mode 100644 debian-10/vmware-buster.pkr.hcl delete mode 100644 debian-10/vmware-cleanup.sh delete mode 100644 ubuntu-server-20.04/add-key.sh delete mode 100755 ubuntu-server-20.04/buildbox-parallels.sh delete mode 100755 ubuntu-server-20.04/buildbox-vmware.sh delete mode 100644 ubuntu-server-20.04/http/meta-data delete mode 100644 ubuntu-server-20.04/http/user-data delete mode 100644 ubuntu-server-20.04/metadata-parallels.json delete mode 100644 ubuntu-server-20.04/metadata.json delete mode 100644 ubuntu-server-20.04/parallels-cleanup.sh delete mode 100644 ubuntu-server-20.04/parallels-focal.pkr.hcl delete mode 100644 ubuntu-server-20.04/vmware-cleanup.sh delete mode 100644 ubuntu-server-20.04/vmware-focal.pkr.hcl delete mode 100644 ubuntu-server-21.10/add-key.sh delete mode 100755 ubuntu-server-21.10/buildbox.sh delete mode 100644 ubuntu-server-21.10/http/meta-data delete mode 100644 ubuntu-server-21.10/http/user-data delete mode 100644 ubuntu-server-21.10/metadata.json delete mode 100644 ubuntu-server-21.10/vmware-cleanup.sh delete mode 100644 ubuntu-server-21.10/vmware-impish.pkr.hcl diff --git a/centos-9/add-key.sh b/centos-9/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/centos-9/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/centos-9/centos9.pkr.hcl b/centos-9/centos9.pkr.hcl new file mode 100644 index 0000000..6853271 --- /dev/null +++ b/centos-9/centos9.pkr.hcl @@ -0,0 +1,89 @@ +packer { + required_version = ">= 1.8.5" + required_plugins { + vmware = { + version = ">= 1.0.7" + source = "github.com/hashicorp/vmware" + } + } +} + +locals { + data_source_content = { + "/ks.cfg" = templatefile("${abspath(path.root)}/http/ks.pkrtpl.hcl", { + vm_guest_os_language = var.vm_guest_os_language + vm_guest_os_keyboard = var.vm_guest_os_keyboard + vm_guest_os_timezone = var.vm_guest_os_timezone + }) + } +} + +source "vmware-iso" "centos-9" { + // Optional configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional + disk_size = var.disk_size + guest_os_type = var.guest_os_type + version = var.vmx_hardware_version + vm_name = var.vm_name + + // Extra disk configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration + disk_adapter_type = var.disk_adapter_type + disk_type_id = var.disk_type_id + + // ISO configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration + iso_checksum = var.iso_checksum + iso_url = var.iso_url + + // HTTP configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#http-directory-configuration + http_content = local.data_source_content + + // Shutdown configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#shutdown-configuration + shutdown_command = "sudo shutdown -h now" + + // Hardware configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration + cpus = var.cpus + memory = var.memory + usb = true + + // Output configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#output-configuration + output_directory = "artifacts" + + // VMX configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vmx-configuration + vmx_data = { + "ethernet0.virtualdev" = "e1000e" + "usb_xhci.present" = "true" + } + + // SSH configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields + ssh_username = var.ssh_username + ssh_password = var.ssh_password + ssh_timeout = var.ssh_timeout + + // Boot configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#boot-configuration + boot_command = [ + "", + "e", + "", + "text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg", + "x" + ] +} + +build { + sources = ["sources.vmware-iso.centos-9"] + + provisioner "shell" { + scripts = [ + "scripts/post-install.sh" + ] + } +} diff --git a/centos-9/http/ks.cfg b/centos-9/http/ks.cfg deleted file mode 100644 index 7a7dca5..0000000 --- a/centos-9/http/ks.cfg +++ /dev/null @@ -1,40 +0,0 @@ -# Generated by Anaconda 34.25.0.23 -# Generated by pykickstart v3.32 -#version=RHEL9 -text --non-interactive - -%addon com_redhat_kdump --enable --reserve-mb='auto' - -%end - -# Keyboard layouts -keyboard --xlayouts='us' -# System language -lang en_US.UTF-8 - -%packages -@^minimal-environment -open-vm-tools - -%end - -# Run the Setup Agent on first boot -firstboot --enable - -# Generated using Blivet version 3.4.0 -ignoredisk --only-use=nvme0n1 -autopart -# Partition clearing information -clearpart --none --initlabel - -# System timezone -timezone Europe/London --utc - -# Root password -rootpw --iscrypted $6$abuMwhR2mVqZe90T$xB8SpkmbZx3NiAhm.vQZjRaS9h/XYow3mlF1i0pgJxyl8Qb7gAg/TPbw.6rXDAo7VxPBkLFz06buhdGtYofcG/ -user --groups=wheel --name=vagrant --password=$6$9qB2Wej06Q0KUf75$jX4ePKHL2x.T.TNVGEksqHcumXoLhEm6//HiMN4r2/z2twhF95Oo4IIQlIJQ0iXgMv.usRm7adw3eEoixDmbl1 --iscrypted --uid=1000 --gecos="vagrant" --gid=1000 - -%post -echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant - -%end \ No newline at end of file diff --git a/centos-9/http/ks.pkrtpl.hcl b/centos-9/http/ks.pkrtpl.hcl new file mode 100644 index 0000000..b2951d1 --- /dev/null +++ b/centos-9/http/ks.pkrtpl.hcl @@ -0,0 +1,37 @@ +# Kickstart file for CentOS 9 Stream +text --non-interactive +eula --agreed + +# Configure language +lang ${vm_guest_os_language} + +# Configure keyboard +keyboard ${vm_guest_os_keyboard} + +# Configure timezone +timezone ${vm_guest_os_timezone} + +# Configure packages to be installed +%packages +@^minimal-environment +open-vm-tools +%end + +# Run the setup agent on first boot +firstboot --enable + +# Configure disk and paritioning +ignoredisk --only-use=nvme0n1 +autopart + +# Partition clearing information +clearpart --none --initlabel + +# Root password and user configuration +rootpw --plaintext vagrant +user --groups=wheel --name=vagrant --password=vagrant --plaintext --uid=1000 --gid=1000 --gecos="vagrant" + +# Post configuration +%post +echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant +%end diff --git a/centos-9/scripts/post-install.sh b/centos-9/scripts/post-install.sh new file mode 100644 index 0000000..4dfef3a --- /dev/null +++ b/centos-9/scripts/post-install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Configure vagrant SSH authentication +mkdir -pv /home/vagrant/.ssh +chmod 0700 /home/vagrant/.ssh +wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub +chmod 0600 /home/vagrant/.ssh/authorized_keys + +# Defrag and shrink the disk +sudo e4defrag / +sudo dd if=/dev/zero of=/EMPTY bs=1M +sudo rm -f /EMPTY +sync +sudo vmware-toolbox-cmd disk shrink / diff --git a/centos-9/variables.auto.pkrvars.hcl b/centos-9/variables.auto.pkrvars.hcl new file mode 100644 index 0000000..58fbf4b --- /dev/null +++ b/centos-9/variables.auto.pkrvars.hcl @@ -0,0 +1,105 @@ +// centos9 packer variables file +variable "vm_guest_os_language" { + type = string + description = "Guest OS language" + default = "en_GB" +} + +variable "vm_guest_os_keyboard" { + type = string + description = "Guest OS keyboard" + default = "gb" +} + +variable "vm_guest_os_timezone" { + type = string + description = "Guest OS timezone" + default = "Europe/London" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#disk_size +variable "disk_size" { + type = number + description = "Size of the disk in MB" + // ~20GB + default = 20000 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#guest_os_type +variable "guest_os_type" { + type = string + description = "Guest OS type" + default = "arm-fedora-64" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#version +variable "vmx_hardware_version" { + type = number + description = "VMX hardware version" + default = 20 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vm_name +variable "vm_name" { + type = string + description = "VM name" + default = "centos9 stream" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_adapter_type" { + type = string + description = "Disk adapter type" + default = "nvme" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_type_id" { + type = string + description = "Disk type ID" + default = "1" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration +variable "iso_checksum" { + type = string + description = "ISO checksum" + default = "file:https://mirror.stream.centos.org/9-stream/BaseOS/aarch64/iso/CentOS-Stream-9-latest-aarch64-boot.iso.SHA256SUM" +} + +variable "iso_url" { + type = string + default = "https://mirror.stream.centos.org/9-stream/BaseOS/aarch64/iso/CentOS-Stream-9-latest-aarch64-boot.iso" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration +variable "cpus" { + type = number + description = "Number of CPUs" + default = 2 +} + +variable "memory" { + type = number + description = "Memory in MB" + default = 2048 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields +variable "ssh_username" { + type = string + description = "SSH username" + default = "vagrant" +} + +variable "ssh_password" { + type = string + description = "SSH password" + default = "vagrant" +} + +variable "ssh_timeout" { + type = string + description = "SSH timeout" + default = "30m" +} diff --git a/centos-9/vmware-centos9.pkr.hcl b/centos-9/vmware-centos9.pkr.hcl deleted file mode 100644 index 7743d91..0000000 --- a/centos-9/vmware-centos9.pkr.hcl +++ /dev/null @@ -1,53 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "centos-9" { - iso_url = "http://mirror.stream.centos.org/9-stream/BaseOS/aarch64/iso/CentOS-Stream-9-latest-aarch64-boot.iso" - # As Stream is updated daily we skip the checksum by default - # buildbox script can pull the latest checksum for verfication if required - iso_checksum = "none" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-fedora-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /images/pxeboot/vmlinuz inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg", - "", - "initrd /images/pxeboot/initrd.img", - "", - "boot", - "" - ] - usb = true - vmx_data = { - "usb_xhci.present" = "true", - "ethernet0.virtualdev" = "e1000e" - } - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Centos 9 Stream" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.centos-9"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file diff --git a/centos-9/vmware-cleanup.sh b/centos-9/vmware-cleanup.sh deleted file mode 100644 index b4508e5..0000000 --- a/centos-9/vmware-cleanup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -sudo e4defrag / -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/debian-10/add-key.sh b/debian-10/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/debian-10/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/debian-10/buildbox.sh b/debian-10/buildbox.sh deleted file mode 100755 index b70e374..0000000 --- a/debian-10/buildbox.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -packer init vmware-buster.pkr.hcl -packer build -force vmware-buster.pkr.hcl -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-buster-arm64.box ./* -md5 vmware-buster-arm64.box -rm -rf *.v* *.nvram metadata.json \ No newline at end of file diff --git a/debian-10/http/preseed.cfg b/debian-10/http/preseed.cfg deleted file mode 100644 index 7144bf9..0000000 --- a/debian-10/http/preseed.cfg +++ /dev/null @@ -1,436 +0,0 @@ -#### Contents of the preconfiguration file (for buster) -### Localization -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# The values can also be preseeded individually for greater flexibility. -#d-i debian-installer/language string en -#d-i debian-installer/country string NL -#d-i debian-installer/locale string en_GB.UTF-8 -# Optionally specify additional locales to be generated. -#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8 - -# Keyboard selection. -d-i keyboard-configuration/xkb-keymap select us -# d-i keyboard-configuration/toggle select No toggling - -### Network configuration -# Disable network configuration entirely. This is useful for cdrom -# installations on non-networked devices where the network questions, -# warning and long timeouts are a nuisance. -#d-i netcfg/enable boolean false - -# netcfg will choose an interface that has link if possible. This makes it -# skip displaying a list if there is more than one interface. -d-i netcfg/choose_interface select auto - -# To pick a particular interface instead: -#d-i netcfg/choose_interface select eth1 - -# To set a different link detection timeout (default is 3 seconds). -# Values are interpreted as seconds. -#d-i netcfg/link_wait_timeout string 10 - -# If you have a slow dhcp server and the installer times out waiting for -# it, this might be useful. -#d-i netcfg/dhcp_timeout string 60 -#d-i netcfg/dhcpv6_timeout string 60 - -# If you prefer to configure the network manually, uncomment this line and -# the static network configuration below. -#d-i netcfg/disable_autoconfig boolean true - -# If you want the preconfiguration file to work on systems both with and -# without a dhcp server, uncomment these lines and the static network -# configuration below. -#d-i netcfg/dhcp_failed note -#d-i netcfg/dhcp_options select Configure network manually - -# Static network configuration. -# -# IPv4 example -#d-i netcfg/get_ipaddress string 192.168.1.42 -#d-i netcfg/get_netmask string 255.255.255.0 -#d-i netcfg/get_gateway string 192.168.1.1 -#d-i netcfg/get_nameservers string 192.168.1.1 -#d-i netcfg/confirm_static boolean true -# -# IPv6 example -#d-i netcfg/get_ipaddress string fc00::2 -#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff:: -#d-i netcfg/get_gateway string fc00::1 -#d-i netcfg/get_nameservers string fc00::1 -#d-i netcfg/confirm_static boolean true - -# Any hostname and domain names assigned from dhcp take precedence over -# values set here. However, setting the values still prevents the questions -# from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain - -# If you want to force a hostname, regardless of what either the DHCP -# server returns or what the reverse DNS entry for the IP is, uncomment -# and adjust the following line. -d-i netcfg/hostname string debian - -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string -# The wacky dhcp hostname that some ISPs use as a password of sorts. -#d-i netcfg/dhcp_hostname string radish - -# If non-free firmware is needed for the network or other hardware, you can -# configure the installer to always try to load it, without prompting. Or -# change to false to disable asking. -#d-i hw-detect/load_firmware boolean true - -### Network console -# Use the following settings if you wish to make use of the network-console -# component for remote installation over SSH. This only makes sense if you -# intend to perform the remainder of the installation manually. -#d-i anna/choose_modules string network-console -#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key -#d-i network-console/password password r00tme -#d-i network-console/password-again password r00tme - -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. -#d-i mirror/protocol string ftp -d-i mirror/country string manual -d-i mirror/http/hostname string http.us.debian.org -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -# Suite to install. -#d-i mirror/suite string testing -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string testing - -### Account setup -# Skip creation of a root account (normal user account will be able to -# use sudo). -#d-i passwd/root-login boolean false -# Alternatively, to skip creation of a normal user account. -#d-i passwd/make-user boolean false - -# Root password, either in clear text -d-i passwd/root-password password vagrant -d-i passwd/root-password-again password vagrant -# or encrypted using a crypt(3) hash. -#d-i passwd/root-password-crypted password [crypt(3) hash] - -# To create a normal user account. -d-i passwd/user-fullname string Debian User -d-i passwd/username string vagrant -# Normal user's password, either in clear text -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -# or encrypted using a crypt(3) hash. -#d-i passwd/user-password-crypted password [crypt(3) hash] -# Create the first user with the specified UID instead of the default. -d-i passwd/user-uid string 1010 - -# The user account will be added to some standard initial groups. To -# override that, use this. -#d-i passwd/user-default-groups string audio cdrom video - -### Clock and time zone setup -# Controls whether or not the hardware clock is set to UTC. -d-i clock-setup/utc boolean true - -# You may set this to any valid setting for $TZ; see the contents of -# /usr/share/zoneinfo/ for valid values. -d-i time/zone string US/Eastern - -# Controls whether to use NTP to set the clock during the install -d-i clock-setup/ntp boolean true -# NTP server to use. The default is almost always fine here. -#d-i clock-setup/ntp-server string ntp.example.com - -### Partitioning -## Partitioning example -# If the system has free space you can choose to only partition that space. -# This is only honoured if partman-auto/method (below) is not set. -#d-i partman-auto/init_automatically_partition select biggest_free - -# Alternatively, you may specify a disk to partition. If the system has only -# one disk the installer will default to using that, but otherwise the device -# name must be given in traditional, non-devfs format (so e.g. /dev/sda -# and not e.g. /dev/discs/disc0/disc). -# For example, to use the first SCSI/SATA hard disk: -#d-i partman-auto/disk string /dev/sda -# In addition, you'll need to specify the method to use. -# The presently available methods are: -# - regular: use the usual partition types for your architecture -# - lvm: use LVM to partition the disk -# - crypto: use LVM within an encrypted partition -d-i partman-auto/method string lvm - -# You can define the amount of space that will be used for the LVM volume -# group. It can either be a size with its unit (eg. 20 GB), a percentage of -# free space or the 'max' keyword. -d-i partman-auto-lvm/guided_size string max - -# If one of the disks that are going to be automatically partitioned -# contains an old LVM configuration, the user will normally receive a -# warning. This can be preseeded away... -d-i partman-lvm/device_remove_lvm boolean true -# The same applies to pre-existing software RAID array: -d-i partman-md/device_remove_md boolean true -# And the same goes for the confirmation to write the lvm partitions. -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -# You can choose one of the three predefined partitioning recipes: -# - atomic: all files in one partition -# - home: separate /home partition -# - multi: separate /home, /var, and /tmp partitions -d-i partman-auto/choose_recipe select atomic - -# Or provide a recipe of your own... -# If you have a way to get a recipe file into the d-i environment, you can -# just point at it. -#d-i partman-auto/expert_recipe_file string /hd-media/recipe - -# If not, you can put an entire recipe into the preconfiguration file in one -# (logical) line. This example creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: -#d-i partman-auto/expert_recipe string \ -# boot-root :: \ -# 40 50 100 ext3 \ -# $primary{ } $bootable{ } \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ /boot } \ -# . \ -# 500 10000 1000000000 ext3 \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ / } \ -# . \ -# 64 512 300% linux-swap \ -# method{ swap } format{ } \ -# . - -# The full recipe format is documented in the file partman-auto-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. This also documents how to specify settings such as file -# system labels, volume group names and which physical devices to include -# in a volume group. - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -# When disk encryption is enabled, skip wiping the partitions beforehand. -#d-i partman-auto-crypto/erase_disks boolean false - -## Partitioning using RAID -# The method should be set to "raid". -#d-i partman-auto/method string raid -# Specify the disks to be partitioned. They will all get the same layout, -# so this will only work if the disks are the same size. -#d-i partman-auto/disk string /dev/sda /dev/sdb - -# Next you need to specify the physical partitions that will be used. -#d-i partman-auto/expert_recipe string \ -# multiraid :: \ -# 1000 5000 4000 raid \ -# $primary{ } method{ raid } \ -# . \ -# 64 512 300% raid \ -# method{ raid } \ -# . \ -# 500 10000 1000000000 raid \ -# method{ raid } \ -# . - -# Last you need to specify how the previously defined partitions will be -# used in the RAID setup. Remember to use the correct partition numbers -# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; -# devices are separated using "#". -# Parameters are: -# \ -# - -#d-i partman-auto-raid/recipe string \ -# 1 2 0 ext3 / \ -# /dev/sda1#/dev/sdb1 \ -# . \ -# 1 2 0 swap - \ -# /dev/sda5#/dev/sdb5 \ -# . \ -# 0 2 0 ext3 /home \ -# /dev/sda6#/dev/sdb6 \ -# . - -# For additional information see the file partman-auto-raid-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. - -# This makes partman automatically partition without confirmation. -d-i partman-md/confirm boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -## Controlling how partitions are mounted -# The default is to mount by UUID, but you can also choose "traditional" to -# use traditional device names, or "label" to try filesystem labels before -# falling back to UUIDs. -#d-i partman/mount_style select uuid - -### Base system installation -# Configure APT to not install recommended packages by default. Use of this -# option can result in an incomplete system and should only be used by very -# experienced users. -#d-i base-installer/install-recommends boolean false - -# The kernel image (meta) package to be installed; "none" can be used if no -# kernel is to be installed. -#d-i base-installer/kernel/image string linux-image-686 - -### Apt setup -# You can choose to install non-free and contrib software. -#d-i apt-setup/non-free boolean true -#d-i apt-setup/contrib boolean true -# Uncomment this if you don't want to use a network mirror. -#d-i apt-setup/use_mirror boolean false -# Select which update services to use; define the mirrors to be used. -# Values shown below are the normal defaults. -#d-i apt-setup/services-select multiselect security, updates -#d-i apt-setup/security_host string security.debian.org - -# Additional repositories, local[0-9] available -#d-i apt-setup/local0/repository string \ -# http://local.server/debian stable main -#d-i apt-setup/local0/comment string local server -# Enable deb-src lines -#d-i apt-setup/local0/source boolean true -# URL to the public key of the local repository; you must provide a key or -# apt will complain about the unauthenticated repository and so the -# sources.list line will be left commented out -#d-i apt-setup/local0/key string http://local.server/key - -# By default the installer requires that repositories be authenticated -# using a known gpg key. This setting can be used to disable that -# authentication. Warning: Insecure, not recommended. -#d-i debian-installer/allow_unauthenticated boolean true - -# Uncomment this to add multiarch configuration for i386 -#d-i apt-setup/multiarch string i386 - - -### Package selection -tasksel tasksel/first multiselect standard, ssh-server - -# Individual additional packages to install -d-i pkgsel/include string sudo fuse3 -# Whether to upgrade packages after debootstrap. -# Allowed values: none, safe-upgrade, full-upgrade -#d-i pkgsel/upgrade select none - -# Some versions of the installer can report back on what software you have -# installed, and what software you use. The default is not to report back, -# but sending reports helps the project determine what software is most -# popular and include it on CDs. -#popularity-contest popularity-contest/participate boolean false - -### Boot loader installation -# Grub is the default boot loader (for x86). If you want lilo installed -# instead, uncomment this: -#d-i grub-installer/skip boolean true -# To also skip installing lilo, and install no bootloader, uncomment this -# too: -#d-i lilo-installer/skip boolean true - - -# This is fairly safe to set, it makes grub install automatically to the MBR -# if no other operating system is detected on the machine. -d-i grub-installer/only_debian boolean true - -# This one makes grub-installer install to the MBR if it also finds some other -# OS, which is less safe as it might not be able to boot that other OS. -d-i grub-installer/with_other_os boolean true - -# Due notably to potential USB sticks, the location of the MBR can not be -# determined safely in general, so this needs to be specified: -#d-i grub-installer/bootdev string /dev/sda -# To install to the first device (assuming it is not a USB stick): -#d-i grub-installer/bootdev string default - -# Alternatively, if you want to install to a location other than the mbr, -# uncomment and edit these lines: -#d-i grub-installer/only_debian boolean false -#d-i grub-installer/with_other_os boolean false -#d-i grub-installer/bootdev string (hd0,1) -# To install grub to multiple disks: -#d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1) - -# Optional password for grub, either in clear text -#d-i grub-installer/password password r00tme -#d-i grub-installer/password-again password r00tme -# or encrypted using an MD5 hash, see grub-md5-crypt(8). -#d-i grub-installer/password-crypted password [MD5 hash] - -# Use the following option to add additional boot parameters for the -# installed system (if supported by the bootloader installer). -# Note: options passed to the installer will be added automatically. -#d-i debian-installer/add-kernel-opts string nousb - -### Finishing up the installation -# During installations from serial console, the regular virtual consoles -# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next -# line to prevent this. -#d-i finish-install/keep-consoles boolean true - -# Avoid that last message about the install being complete. -d-i finish-install/reboot_in_progress note - -# This will prevent the installer from ejecting the CD during the reboot, -# which is useful in some situations. -#d-i cdrom-detect/eject boolean false - -# This is how to make the installer shutdown when finished, but not -# reboot into the installed system. -#d-i debian-installer/exit/halt boolean true -# This will power off the machine instead of just halting it. -#d-i debian-installer/exit/poweroff boolean true - -### Preseeding other packages -# Depending on what software you choose to install, or if things go wrong -# during the installation process, it's possible that other questions may -# be asked. You can preseed those too, of course. To get a list of every -# possible question that could be asked during an install, do an -# installation, and then run these commands: -# debconf-get-selections --installer > file -# debconf-get-selections >> file - - -#### Advanced options -### Running custom commands during the installation -# d-i preseeding is inherently not secure. Nothing in the installer checks -# for attempts at buffer overflows or other exploits of the values of a -# preconfiguration file like this one. Only use preconfiguration files from -# trusted locations! To drive that home, and because it's generally useful, -# here's a way to run any shell command you'd like inside the installer, -# automatically. - -# This first command is run as early as possible, just after -# preseeding is read. -#d-i preseed/early_command string anna-install some-udeb -# This command is run immediately before the partitioner starts. It may be -# useful to apply dynamic partitioner preseeding that depends on the state -# of the disks (which may not be visible when preseed/early_command runs). -#d-i partman/early_command \ -# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" -# This command is run just before the install finishes, but when there is -# still a usable /target directory. You can chroot to /target and use it -# directly, or use the apt-install and in-target commands to easily install -# packages and run commands in the target system. -d-i preseed/late_command string \ - echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/vagrant ; - echo export PATH=/sbin:$PATH >> ~/.bashrc diff --git a/debian-10/metadata.json b/debian-10/metadata.json deleted file mode 100644 index 121f0fc..0000000 --- a/debian-10/metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "vmware_fusion" -} \ No newline at end of file diff --git a/debian-10/vmware-buster.pkr.hcl b/debian-10/vmware-buster.pkr.hcl deleted file mode 100644 index 0948454..0000000 --- a/debian-10/vmware-buster.pkr.hcl +++ /dev/null @@ -1,50 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "debian-buster" { - iso_url = "https://cdimage.debian.org/cdimage/archive/10.11.0/arm64/iso-cd/debian-10.11.0-arm64-netinst.iso" - iso_checksum = "md5:6dc8ea84db6cc9c36c34045891f12f5b" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-debian10-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /install.a64/vmlinuz auto=true priority=critical url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg --- quiet", - "", - "initrd /install.a64/initrd.gz", - "", - "boot", - "" - ] - usb = true - vmx_data = { - "usb_xhci.present" = "true" - } - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Debian 10" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.debian-buster"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file diff --git a/debian-10/vmware-cleanup.sh b/debian-10/vmware-cleanup.sh deleted file mode 100644 index ef9e60a..0000000 --- a/debian-10/vmware-cleanup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -x - -# sudo e4defrag / - -wget https://packages.vmware.com/tools/open-vm-tools/ovt-arm-tech-preview/Debian-10/open-vm-tools-11.2.5-2debian10.tgz -tar -zxf open-vm-tools-11.2.5-2debian10.tgz -sudo dpkg -i ./open-vm-tools_11.2.5-2debian10_arm64.deb -sudo apt --fix-broken install -y -sudo mkdir -p /mnt/hgfs/ -sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs/ -o subtype=vmhgfs-fuse,allow_other - -sudo apt-get clean -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync - -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/ubuntu-server-20.04/add-key.sh b/ubuntu-server-20.04/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/ubuntu-server-20.04/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/ubuntu-server-20.04/buildbox-parallels.sh b/ubuntu-server-20.04/buildbox-parallels.sh deleted file mode 100755 index 0083d34..0000000 --- a/ubuntu-server-20.04/buildbox-parallels.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -packer init parallels-focal.pkr.hcl -packer build -force parallels-focal.pkr.hcl -cp metadata-parallels.json output/metadata.json -prl_disk_tool compact --hdd output/*.pvm/*.hdd -cd output -tar cvzf parallels-focal-arm64.box ./* -md5 parallels-focal-arm64.box -rm -rf *.pvm metadata.json \ No newline at end of file diff --git a/ubuntu-server-20.04/buildbox-vmware.sh b/ubuntu-server-20.04/buildbox-vmware.sh deleted file mode 100755 index 9c85671..0000000 --- a/ubuntu-server-20.04/buildbox-vmware.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -packer init vmware-focal.pkr.hcl -packer build -force vmware-focal.pkr.hcl -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-focal-arm64.box ./* -md5 vmware-focal-arm64.box -rm -f *.v* *.nvram metadata.json \ No newline at end of file diff --git a/ubuntu-server-20.04/http/meta-data b/ubuntu-server-20.04/http/meta-data deleted file mode 100644 index e69de29..0000000 diff --git a/ubuntu-server-20.04/http/user-data b/ubuntu-server-20.04/http/user-data deleted file mode 100644 index f59c945..0000000 --- a/ubuntu-server-20.04/http/user-data +++ /dev/null @@ -1,22 +0,0 @@ -#cloud-config -autoinstall: - version: 1 - early-commands: - - sudo systemctl stop ssh - locale: en_US - keyboard: - layout: en - variant: us - identity: - hostname: ubuntu - username: vagrant - password: $6$rounds=4096$WL6Yb6B2dkPIZ$r8GqjQg6InPmTtFKoT41kXWWIfIPfHIvLhmFpIp8SFKi0c4282Tufycx787xeyt7Vq4UDoSMzWqkCLYOsXpvu0 - ssh: - install-server: true - allow-pw: true - package_update: true - package_upgrade: true - packages: - - open-vm-tools - late-commands: - - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu diff --git a/ubuntu-server-20.04/metadata-parallels.json b/ubuntu-server-20.04/metadata-parallels.json deleted file mode 100644 index 036aa9d..0000000 --- a/ubuntu-server-20.04/metadata-parallels.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "parallels" -} \ No newline at end of file diff --git a/ubuntu-server-20.04/metadata.json b/ubuntu-server-20.04/metadata.json deleted file mode 100644 index 121f0fc..0000000 --- a/ubuntu-server-20.04/metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "vmware_fusion" -} \ No newline at end of file diff --git a/ubuntu-server-20.04/parallels-cleanup.sh b/ubuntu-server-20.04/parallels-cleanup.sh deleted file mode 100644 index 1dba0ff..0000000 --- a/ubuntu-server-20.04/parallels-cleanup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -x - -sudo apt clean -sudo e4defrag / -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync \ No newline at end of file diff --git a/ubuntu-server-20.04/parallels-focal.pkr.hcl b/ubuntu-server-20.04/parallels-focal.pkr.hcl deleted file mode 100644 index 1a16eaa..0000000 --- a/ubuntu-server-20.04/parallels-focal.pkr.hcl +++ /dev/null @@ -1,45 +0,0 @@ -source "parallels-iso" "ubuntu-focal" { - iso_url = "https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso" - iso_checksum = "md5:679870a4e76a34a7438689cd7ebccf49" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "ubuntu" - http_directory = "http" - boot_command = [ - "c", - "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", - "", - "initrd /casper/initrd", - "", - "boot", - "" - ] - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Ubuntu Server 20.04" - output_directory = "output" - parallels_tools_flavor = "lin" -} - -build { - sources = ["sources.parallels-iso.ubuntu-focal"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "parallels-cleanup.sh" - ] - } -} - -packer { - required_plugins { - parallels = { - version = ">= 1.0.0" - source = "github.com/hashicorp/parallels" - } - } -} \ No newline at end of file diff --git a/ubuntu-server-20.04/vmware-cleanup.sh b/ubuntu-server-20.04/vmware-cleanup.sh deleted file mode 100644 index d7b7884..0000000 --- a/ubuntu-server-20.04/vmware-cleanup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -x - -sudo apt clean -sudo e4defrag / -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/ubuntu-server-20.04/vmware-focal.pkr.hcl b/ubuntu-server-20.04/vmware-focal.pkr.hcl deleted file mode 100644 index 1d8f15b..0000000 --- a/ubuntu-server-20.04/vmware-focal.pkr.hcl +++ /dev/null @@ -1,47 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "ubuntu-focal" { - iso_url = "https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso" - iso_checksum = "md5:679870a4e76a34a7438689cd7ebccf49" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-ubuntu-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", - "", - "initrd /casper/initrd", - "", - "boot", - "" - ] - usb = true - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Ubuntu Server 20.04" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.ubuntu-focal"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file diff --git a/ubuntu-server-21.10/add-key.sh b/ubuntu-server-21.10/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/ubuntu-server-21.10/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/ubuntu-server-21.10/buildbox.sh b/ubuntu-server-21.10/buildbox.sh deleted file mode 100755 index 567208d..0000000 --- a/ubuntu-server-21.10/buildbox.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -packer init vmware-impish.pkr.hcl -packer build -force vmware-impish.pkr.hcl -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-impish-arm64.box ./* -md5 vmware-impish-arm64.box -rm -f *.v* *.nvram metadata.json \ No newline at end of file diff --git a/ubuntu-server-21.10/http/meta-data b/ubuntu-server-21.10/http/meta-data deleted file mode 100644 index e69de29..0000000 diff --git a/ubuntu-server-21.10/http/user-data b/ubuntu-server-21.10/http/user-data deleted file mode 100644 index f59c945..0000000 --- a/ubuntu-server-21.10/http/user-data +++ /dev/null @@ -1,22 +0,0 @@ -#cloud-config -autoinstall: - version: 1 - early-commands: - - sudo systemctl stop ssh - locale: en_US - keyboard: - layout: en - variant: us - identity: - hostname: ubuntu - username: vagrant - password: $6$rounds=4096$WL6Yb6B2dkPIZ$r8GqjQg6InPmTtFKoT41kXWWIfIPfHIvLhmFpIp8SFKi0c4282Tufycx787xeyt7Vq4UDoSMzWqkCLYOsXpvu0 - ssh: - install-server: true - allow-pw: true - package_update: true - package_upgrade: true - packages: - - open-vm-tools - late-commands: - - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu diff --git a/ubuntu-server-21.10/metadata.json b/ubuntu-server-21.10/metadata.json deleted file mode 100644 index 121f0fc..0000000 --- a/ubuntu-server-21.10/metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "vmware_fusion" -} \ No newline at end of file diff --git a/ubuntu-server-21.10/vmware-cleanup.sh b/ubuntu-server-21.10/vmware-cleanup.sh deleted file mode 100644 index d362b5f..0000000 --- a/ubuntu-server-21.10/vmware-cleanup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -sudo apt clean -sudo e4defrag / -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/ubuntu-server-21.10/vmware-impish.pkr.hcl b/ubuntu-server-21.10/vmware-impish.pkr.hcl deleted file mode 100644 index 2420420..0000000 --- a/ubuntu-server-21.10/vmware-impish.pkr.hcl +++ /dev/null @@ -1,47 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "ubuntu-impish" { - iso_url = "https://cdimage.ubuntu.com/releases/21.10/release/ubuntu-21.10-live-server-arm64.iso" - iso_checksum = "md5:5420a741f41927ce9ddac768b69181c7" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-ubuntu-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", - "", - "initrd /casper/initrd", - "", - "boot", - "" - ] - usb = true - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Ubuntu Server 21.10" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.ubuntu-impish"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file From 5f1c65f803b5075b7a3c92a021007e232183141c Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 8 Feb 2023 23:00:28 +0000 Subject: [PATCH 02/44] refactor: rename file --- centos-9/{variables.auto.pkrvars.hcl => centos9.auto.pkrvars.hcl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename centos-9/{variables.auto.pkrvars.hcl => centos9.auto.pkrvars.hcl} (100%) diff --git a/centos-9/variables.auto.pkrvars.hcl b/centos-9/centos9.auto.pkrvars.hcl similarity index 100% rename from centos-9/variables.auto.pkrvars.hcl rename to centos-9/centos9.auto.pkrvars.hcl From fae11ade7dbefe5beab5af5ec0520f3438de1e73 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:26:37 +0000 Subject: [PATCH 03/44] fix: undefined variable issue --- .../{centos9.auto.pkrvars.hcl => centos9.auto.pkr.hcl} | 1 + centos-9/centos9.pkr.hcl | 8 ++++---- centos-9/{http => data}/ks.pkrtpl.hcl | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename centos-9/{centos9.auto.pkrvars.hcl => centos9.auto.pkr.hcl} (99%) rename centos-9/{http => data}/ks.pkrtpl.hcl (100%) diff --git a/centos-9/centos9.auto.pkrvars.hcl b/centos-9/centos9.auto.pkr.hcl similarity index 99% rename from centos-9/centos9.auto.pkrvars.hcl rename to centos-9/centos9.auto.pkr.hcl index 58fbf4b..13a11c3 100644 --- a/centos-9/centos9.auto.pkrvars.hcl +++ b/centos-9/centos9.auto.pkr.hcl @@ -1,4 +1,5 @@ // centos9 packer variables file + variable "vm_guest_os_language" { type = string description = "Guest OS language" diff --git a/centos-9/centos9.pkr.hcl b/centos-9/centos9.pkr.hcl index 6853271..0c67f6f 100644 --- a/centos-9/centos9.pkr.hcl +++ b/centos-9/centos9.pkr.hcl @@ -10,10 +10,10 @@ packer { locals { data_source_content = { - "/ks.cfg" = templatefile("${abspath(path.root)}/http/ks.pkrtpl.hcl", { - vm_guest_os_language = var.vm_guest_os_language - vm_guest_os_keyboard = var.vm_guest_os_keyboard - vm_guest_os_timezone = var.vm_guest_os_timezone + "/ks.cfg" = templatefile("${abspath(path.root)}/data/ks.pkrtpl.hcl", { + vm_guest_os_language = var.vm_guest_os_language + vm_guest_os_keyboard = var.vm_guest_os_keyboard + vm_guest_os_timezone = var.vm_guest_os_timezone }) } } diff --git a/centos-9/http/ks.pkrtpl.hcl b/centos-9/data/ks.pkrtpl.hcl similarity index 100% rename from centos-9/http/ks.pkrtpl.hcl rename to centos-9/data/ks.pkrtpl.hcl From b0ee55493911c3b9d9762eb408063155ff44d767 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:41:14 +0000 Subject: [PATCH 04/44] fix: add missing `url` and `repo` --- centos-9/centos9.auto.pkr.hcl | 12 ++++++++++++ centos-9/centos9.pkr.hcl | 4 +++- centos-9/data/ks.pkrtpl.hcl | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/centos-9/centos9.auto.pkr.hcl b/centos-9/centos9.auto.pkr.hcl index 13a11c3..95b76a1 100644 --- a/centos-9/centos9.auto.pkr.hcl +++ b/centos-9/centos9.auto.pkr.hcl @@ -18,6 +18,18 @@ variable "vm_guest_os_timezone" { default = "Europe/London" } +variable "vm_guest_os_install_url" { + type = string + description = "Guest OS install URL" + default = "https://mirror.stream.centos.org/9-stream/BaseOS/aarch64/os/" +} + +variable "vm_guest_os_repo_url" { + type = string + description = "Guest OS repo URL" + default = "https://mirror.stream.centos.org/9-stream/AppStream/aarch64/os/" +} + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#disk_size variable "disk_size" { type = number diff --git a/centos-9/centos9.pkr.hcl b/centos-9/centos9.pkr.hcl index 0c67f6f..4516141 100644 --- a/centos-9/centos9.pkr.hcl +++ b/centos-9/centos9.pkr.hcl @@ -14,6 +14,8 @@ locals { vm_guest_os_language = var.vm_guest_os_language vm_guest_os_keyboard = var.vm_guest_os_keyboard vm_guest_os_timezone = var.vm_guest_os_timezone + vm_guest_os_install_url = var.vm_guest_os_install_url + vm_guest_os_repo_url = var.vm_guest_os_repo_url }) } } @@ -73,7 +75,7 @@ source "vmware-iso" "centos-9" { "", "e", "", - "text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg", + "text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg", "x" ] } diff --git a/centos-9/data/ks.pkrtpl.hcl b/centos-9/data/ks.pkrtpl.hcl index b2951d1..20ff8fd 100644 --- a/centos-9/data/ks.pkrtpl.hcl +++ b/centos-9/data/ks.pkrtpl.hcl @@ -11,6 +11,12 @@ keyboard ${vm_guest_os_keyboard} # Configure timezone timezone ${vm_guest_os_timezone} +# Configure install source +url --url=${vm_guest_os_install_url} + +# Configure repo for CentOS 9 Stream +repo --name=centos9-AppStream --baseurl=${vm_guest_os_repo_url} + # Configure packages to be installed %packages @^minimal-environment From e756de7b8681b5dd9e23b5a027db9df4bb4b717e Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:53:10 +0000 Subject: [PATCH 05/44] fix: reboot when install has finished and install wget --- centos-9/data/ks.pkrtpl.hcl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/centos-9/data/ks.pkrtpl.hcl b/centos-9/data/ks.pkrtpl.hcl index 20ff8fd..861de6e 100644 --- a/centos-9/data/ks.pkrtpl.hcl +++ b/centos-9/data/ks.pkrtpl.hcl @@ -1,4 +1,5 @@ # Kickstart file for CentOS 9 Stream +reboot text --non-interactive eula --agreed @@ -21,6 +22,7 @@ repo --name=centos9-AppStream --baseurl=${vm_guest_os_repo_url} %packages @^minimal-environment open-vm-tools +wget %end # Run the setup agent on first boot From 79206bd0ddd704256e339fe73498d147cec0019f Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:53:25 +0000 Subject: [PATCH 06/44] fix: increase disk to ~40GB --- centos-9/centos9.auto.pkr.hcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/centos-9/centos9.auto.pkr.hcl b/centos-9/centos9.auto.pkr.hcl index 95b76a1..124f0f8 100644 --- a/centos-9/centos9.auto.pkr.hcl +++ b/centos-9/centos9.auto.pkr.hcl @@ -34,8 +34,8 @@ variable "vm_guest_os_repo_url" { variable "disk_size" { type = number description = "Size of the disk in MB" - // ~20GB - default = 20000 + // ~40GB + default = 40000 } // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#guest_os_type From 0675fec88bf6951d26b25b204b50bbfb20f0e2eb Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:06:04 +0000 Subject: [PATCH 07/44] refactor: remove drag as centos default FS is xfs --- centos-9/scripts/post-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/centos-9/scripts/post-install.sh b/centos-9/scripts/post-install.sh index 4dfef3a..a1a4a7c 100644 --- a/centos-9/scripts/post-install.sh +++ b/centos-9/scripts/post-install.sh @@ -6,8 +6,7 @@ chmod 0700 /home/vagrant/.ssh wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub chmod 0600 /home/vagrant/.ssh/authorized_keys -# Defrag and shrink the disk -sudo e4defrag / +# Shrink the disk sudo dd if=/dev/zero of=/EMPTY bs=1M sudo rm -f /EMPTY sync From 99274d5ed4d4e7c05436a1ca8a9fd7cb78594758 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:11:45 +0000 Subject: [PATCH 08/44] feat: https://developer.hashicorp.com/vagrant/docs/boxes/base#ssh-tweaks --- centos-9/scripts/post-install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/centos-9/scripts/post-install.sh b/centos-9/scripts/post-install.sh index a1a4a7c..9ea5f3d 100644 --- a/centos-9/scripts/post-install.sh +++ b/centos-9/scripts/post-install.sh @@ -6,6 +6,9 @@ chmod 0700 /home/vagrant/.ssh wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub chmod 0600 /home/vagrant/.ssh/authorized_keys +# Modify SSH server configuration UseDNS no +sudo sed -i 's/^UseDNS yes/UseDNS no/' /etc/ssh/sshd_config + # Shrink the disk sudo dd if=/dev/zero of=/EMPTY bs=1M sudo rm -f /EMPTY From a1d6a5aa36c61e5401984b8fbe1caa552b2babeb Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:25:25 +0000 Subject: [PATCH 09/44] refactor: update script --- centos-9/buildbox.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/centos-9/buildbox.sh b/centos-9/buildbox.sh index 1dfff11..2883c60 100755 --- a/centos-9/buildbox.sh +++ b/centos-9/buildbox.sh @@ -1,10 +1,14 @@ #!/bin/bash +BOX_NAME="centos9-arm64.box" -# TODO: Pull and inject md5 hash into packer -packer init vmware-centos9.pkr.hcl -packer build -force vmware-centos9.pkr.hcl -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-centos9-arm64.box ./* -md5 vmware-centos9-arm64.box -rm -f *.v* *.nvram metadata.json \ No newline at end of file +# Initalise packer and build the VM +packer init . +packer build -force . +# Copy Vagrant metadata file to artifacts directory +cp metadata.json artifacts/metadata.json && cd artifacts +# Create Vagrant box +tar cvzf $BOX_NAME ./* +# Show the SHA256 checksum of the box +shasum -a 256 $BOX_NAME +# Clean up +rm -f *.v* *.nvram *.log *.scoreboard *.plist metadata.json From 8d39c56601dbb178f2bfecaaa8d6e29d890ced89 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:00:59 +0000 Subject: [PATCH 10/44] refactor: modify default `vm_name` --- centos-9/centos9.auto.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centos-9/centos9.auto.pkr.hcl b/centos-9/centos9.auto.pkr.hcl index 124f0f8..bb2a0bf 100644 --- a/centos-9/centos9.auto.pkr.hcl +++ b/centos-9/centos9.auto.pkr.hcl @@ -56,7 +56,7 @@ variable "vmx_hardware_version" { variable "vm_name" { type = string description = "VM name" - default = "centos9 stream" + default = "centos9" } // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration From ca05a4f70d539a7c05e6b795f779eb4a57bc6c5b Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:05:45 +0000 Subject: [PATCH 11/44] feat: add working vagrant file --- centos-9/Vagrantfile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 centos-9/Vagrantfile diff --git a/centos-9/Vagrantfile b/centos-9/Vagrantfile new file mode 100644 index 0000000..09bcc00 --- /dev/null +++ b/centos-9/Vagrantfile @@ -0,0 +1,10 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "centos9-arm64" + config.vm.provider "vmware_desktop" do |v| + v.vmx["ethernet0.virtualDev"] = "e1000e" + v.vmx["usb_xhci.present"] = "true" + end +end From 673c31cd63b1a37c72dcb7b89460be625f5902d6 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:16:59 +0000 Subject: [PATCH 12/44] feat: add box to vagrant --- centos-9/buildbox.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/centos-9/buildbox.sh b/centos-9/buildbox.sh index 2883c60..8beb2b3 100755 --- a/centos-9/buildbox.sh +++ b/centos-9/buildbox.sh @@ -12,3 +12,5 @@ tar cvzf $BOX_NAME ./* shasum -a 256 $BOX_NAME # Clean up rm -f *.v* *.nvram *.log *.scoreboard *.plist metadata.json +# Add the box to Vagrant +vagrant box add --force --name centos9-arm64 $BOX_NAME From 42002cce4de9cc3434286ea85f1541dedbfca03a Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:50:37 +0000 Subject: [PATCH 13/44] refactor: remove files --- debian-11/add-key.sh | 6 - debian-11/buildbox-parallels.sh | 10 - debian-11/buildbox-vmware.sh | 9 - debian-11/http/preseed.cfg | 456 ----------------------- debian-11/metadata-parallels.json | 3 - debian-11/metadata.json | 3 - debian-11/parallels-bullseye.pkr.hcl | 47 --- debian-11/parallels-cleanup.sh | 12 - debian-11/vmware-bullseye.pkr.hcl | 50 --- debian-11/vmware-cleanup.sh | 17 - ubuntu-server-22.04/add-key.sh | 6 - ubuntu-server-22.04/buildbox.sh | 11 - ubuntu-server-22.04/http/meta-data | 0 ubuntu-server-22.04/http/user-data | 22 -- ubuntu-server-22.04/metadata.json | 3 - ubuntu-server-22.04/vmware-cleanup.sh | 8 - ubuntu-server-22.04/vmware-jammy.pkr.hcl | 47 --- 17 files changed, 710 deletions(-) delete mode 100644 debian-11/add-key.sh delete mode 100755 debian-11/buildbox-parallels.sh delete mode 100755 debian-11/buildbox-vmware.sh delete mode 100644 debian-11/http/preseed.cfg delete mode 100644 debian-11/metadata-parallels.json delete mode 100644 debian-11/metadata.json delete mode 100644 debian-11/parallels-bullseye.pkr.hcl delete mode 100644 debian-11/parallels-cleanup.sh delete mode 100644 debian-11/vmware-bullseye.pkr.hcl delete mode 100644 debian-11/vmware-cleanup.sh delete mode 100644 ubuntu-server-22.04/add-key.sh delete mode 100755 ubuntu-server-22.04/buildbox.sh delete mode 100644 ubuntu-server-22.04/http/meta-data delete mode 100644 ubuntu-server-22.04/http/user-data delete mode 100644 ubuntu-server-22.04/metadata.json delete mode 100644 ubuntu-server-22.04/vmware-cleanup.sh delete mode 100644 ubuntu-server-22.04/vmware-jammy.pkr.hcl diff --git a/debian-11/add-key.sh b/debian-11/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/debian-11/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/debian-11/buildbox-parallels.sh b/debian-11/buildbox-parallels.sh deleted file mode 100755 index 881d9b6..0000000 --- a/debian-11/buildbox-parallels.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -packer init parallels-bullseye.pkr.hcl -packer build -force parallels-bullseye.pkr.hcl -cp metadata-parallels.json output/metadata.json -prl_disk_tool compact --hdd output/*.pvm/*.hdd -cd output -tar cvzf parallels-bullseye-arm64.box ./* -md5 parallels-bullseye-arm64.box -rm -rf *.pvm metadata.json \ No newline at end of file diff --git a/debian-11/buildbox-vmware.sh b/debian-11/buildbox-vmware.sh deleted file mode 100755 index 814849d..0000000 --- a/debian-11/buildbox-vmware.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -packer init vmware-bullseye.pkr.hcl -packer build -force vmware-bullseye.pkr.hcl -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-bullseye-arm64.box ./* -md5 vmware-bullseye-arm64.box -rm -rf *.v* *.nvram metadata.json \ No newline at end of file diff --git a/debian-11/http/preseed.cfg b/debian-11/http/preseed.cfg deleted file mode 100644 index dc60f1f..0000000 --- a/debian-11/http/preseed.cfg +++ /dev/null @@ -1,456 +0,0 @@ -#_preseed_V1 -#### Contents of the preconfiguration file (for bullseye) -### Localization -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# The values can also be preseeded individually for greater flexibility. -#d-i debian-installer/language string en -#d-i debian-installer/country string NL -#d-i debian-installer/locale string en_GB.UTF-8 -# Optionally specify additional locales to be generated. -#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8 - -# Keyboard selection. -d-i keyboard-configuration/xkb-keymap select us -# d-i keyboard-configuration/toggle select No toggling - -### Network configuration -# Disable network configuration entirely. This is useful for cdrom -# installations on non-networked devices where the network questions, -# warning and long timeouts are a nuisance. -#d-i netcfg/enable boolean false - -# netcfg will choose an interface that has link if possible. This makes it -# skip displaying a list if there is more than one interface. -d-i netcfg/choose_interface select auto - -# To pick a particular interface instead: -#d-i netcfg/choose_interface select eth1 - -# To set a different link detection timeout (default is 3 seconds). -# Values are interpreted as seconds. -#d-i netcfg/link_wait_timeout string 10 - -# If you have a slow dhcp server and the installer times out waiting for -# it, this might be useful. -#d-i netcfg/dhcp_timeout string 60 -#d-i netcfg/dhcpv6_timeout string 60 - -# If you prefer to configure the network manually, uncomment this line and -# the static network configuration below. -#d-i netcfg/disable_autoconfig boolean true - -# If you want the preconfiguration file to work on systems both with and -# without a dhcp server, uncomment these lines and the static network -# configuration below. -#d-i netcfg/dhcp_failed note -#d-i netcfg/dhcp_options select Configure network manually - -# Static network configuration. -# -# IPv4 example -#d-i netcfg/get_ipaddress string 192.168.1.42 -#d-i netcfg/get_netmask string 255.255.255.0 -#d-i netcfg/get_gateway string 192.168.1.1 -#d-i netcfg/get_nameservers string 192.168.1.1 -#d-i netcfg/confirm_static boolean true -# -# IPv6 example -#d-i netcfg/get_ipaddress string fc00::2 -#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff:: -#d-i netcfg/get_gateway string fc00::1 -#d-i netcfg/get_nameservers string fc00::1 -#d-i netcfg/confirm_static boolean true - -# Any hostname and domain names assigned from dhcp take precedence over -# values set here. However, setting the values still prevents the questions -# from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain - -# If you want to force a hostname, regardless of what either the DHCP -# server returns or what the reverse DNS entry for the IP is, uncomment -# and adjust the following line. -d-i netcfg/hostname string debian - -# Disable that annoying WEP key dialog. -d-i netcfg/wireless_wep string -# The wacky dhcp hostname that some ISPs use as a password of sorts. -#d-i netcfg/dhcp_hostname string radish - -# If non-free firmware is needed for the network or other hardware, you can -# configure the installer to always try to load it, without prompting. Or -# change to false to disable asking. -#d-i hw-detect/load_firmware boolean true - -### Network console -# Use the following settings if you wish to make use of the network-console -# component for remote installation over SSH. This only makes sense if you -# intend to perform the remainder of the installation manually. -#d-i anna/choose_modules string network-console -#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key -#d-i network-console/password password r00tme -#d-i network-console/password-again password r00tme - -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. -#d-i mirror/protocol string ftp -d-i mirror/country string manual -d-i mirror/http/hostname string http.us.debian.org -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -# Suite to install. -#d-i mirror/suite string testing -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string testing - -### Account setup -# Skip creation of a root account (normal user account will be able to -# use sudo). -#d-i passwd/root-login boolean false -# Alternatively, to skip creation of a normal user account. -#d-i passwd/make-user boolean false - -# Root password, either in clear text -d-i passwd/root-password password vagrant -d-i passwd/root-password-again password vagrant -# or encrypted using a crypt(3) hash. -#d-i passwd/root-password-crypted password [crypt(3) hash] - -# To create a normal user account. -d-i passwd/user-fullname string Debian User -d-i passwd/username string vagrant -# Normal user's password, either in clear text -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -# or encrypted using a crypt(3) hash. -#d-i passwd/user-password-crypted password [crypt(3) hash] -# Create the first user with the specified UID instead of the default. -d-i passwd/user-uid string 1010 - -# The user account will be added to some standard initial groups. To -# override that, use this. -#d-i passwd/user-default-groups string audio cdrom video - -### Clock and time zone setup -# Controls whether or not the hardware clock is set to UTC. -d-i clock-setup/utc boolean true - -# You may set this to any valid setting for $TZ; see the contents of -# /usr/share/zoneinfo/ for valid values. -d-i time/zone string US/Eastern - -# Controls whether to use NTP to set the clock during the install -d-i clock-setup/ntp boolean true -# NTP server to use. The default is almost always fine here. -#d-i clock-setup/ntp-server string ntp.example.com - -### Partitioning -## Partitioning example -# If the system has free space you can choose to only partition that space. -# This is only honoured if partman-auto/method (below) is not set. -#d-i partman-auto/init_automatically_partition select biggest_free - -# Alternatively, you may specify a disk to partition. If the system has only -# one disk the installer will default to using that, but otherwise the device -# name must be given in traditional, non-devfs format (so e.g. /dev/sda -# and not e.g. /dev/discs/disc0/disc). -# For example, to use the first SCSI/SATA hard disk: -#d-i partman-auto/disk string /dev/sda -# In addition, you'll need to specify the method to use. -# The presently available methods are: -# - regular: use the usual partition types for your architecture -# - lvm: use LVM to partition the disk -# - crypto: use LVM within an encrypted partition -d-i partman-auto/method string lvm - -# You can define the amount of space that will be used for the LVM volume -# group. It can either be a size with its unit (eg. 20 GB), a percentage of -# free space or the 'max' keyword. -d-i partman-auto-lvm/guided_size string max - -# If one of the disks that are going to be automatically partitioned -# contains an old LVM configuration, the user will normally receive a -# warning. This can be preseeded away... -d-i partman-lvm/device_remove_lvm boolean true -# The same applies to pre-existing software RAID array: -d-i partman-md/device_remove_md boolean true -# And the same goes for the confirmation to write the lvm partitions. -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -# You can choose one of the three predefined partitioning recipes: -# - atomic: all files in one partition -# - home: separate /home partition -# - multi: separate /home, /var, and /tmp partitions -d-i partman-auto/choose_recipe select atomic - -# Or provide a recipe of your own... -# If you have a way to get a recipe file into the d-i environment, you can -# just point at it. -#d-i partman-auto/expert_recipe_file string /hd-media/recipe - -# If not, you can put an entire recipe into the preconfiguration file in one -# (logical) line. This example creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: -#d-i partman-auto/expert_recipe string \ -# boot-root :: \ -# 40 50 100 ext3 \ -# $primary{ } $bootable{ } \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ /boot } \ -# . \ -# 500 10000 1000000000 ext3 \ -# method{ format } format{ } \ -# use_filesystem{ } filesystem{ ext3 } \ -# mountpoint{ / } \ -# . \ -# 64 512 300% linux-swap \ -# method{ swap } format{ } \ -# . - -# The full recipe format is documented in the file partman-auto-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. This also documents how to specify settings such as file -# system labels, volume group names and which physical devices to include -# in a volume group. - -## Partitioning for EFI -# If your system needs an EFI partition you could add something like -# this to the recipe above, as the first element in the recipe: -# 538 538 1075 free \ -# $iflabel{ gpt } \ -# $reusemethod{ } \ -# method{ efi } \ -# format{ } \ -# . \ -# -# The fragment above is for the amd64 architecture; the details may be -# different on other architectures. The 'partman-auto' package in the -# D-I source repository may have an example you can follow. - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -# Force UEFI booting ('BIOS compatibility' will be lost). Default: false. -#d-i partman-efi/non_efi_system boolean true -# Ensure the partition table is GPT - this is required for EFI -#d-i partman-partitioning/choose_label string gpt -#d-i partman-partitioning/default_label string gpt - -# When disk encryption is enabled, skip wiping the partitions beforehand. -#d-i partman-auto-crypto/erase_disks boolean false - -## Partitioning using RAID -# The method should be set to "raid". -#d-i partman-auto/method string raid -# Specify the disks to be partitioned. They will all get the same layout, -# so this will only work if the disks are the same size. -#d-i partman-auto/disk string /dev/sda /dev/sdb - -# Next you need to specify the physical partitions that will be used. -#d-i partman-auto/expert_recipe string \ -# multiraid :: \ -# 1000 5000 4000 raid \ -# $primary{ } method{ raid } \ -# . \ -# 64 512 300% raid \ -# method{ raid } \ -# . \ -# 500 10000 1000000000 raid \ -# method{ raid } \ -# . - -# Last you need to specify how the previously defined partitions will be -# used in the RAID setup. Remember to use the correct partition numbers -# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; -# devices are separated using "#". -# Parameters are: -# \ -# - -#d-i partman-auto-raid/recipe string \ -# 1 2 0 ext3 / \ -# /dev/sda1#/dev/sdb1 \ -# . \ -# 1 2 0 swap - \ -# /dev/sda5#/dev/sdb5 \ -# . \ -# 0 2 0 ext3 /home \ -# /dev/sda6#/dev/sdb6 \ -# . - -# For additional information see the file partman-auto-raid-recipe.txt -# included in the 'debian-installer' package or available from D-I source -# repository. - -# This makes partman automatically partition without confirmation. -d-i partman-md/confirm boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -## Controlling how partitions are mounted -# The default is to mount by UUID, but you can also choose "traditional" to -# use traditional device names, or "label" to try filesystem labels before -# falling back to UUIDs. -#d-i partman/mount_style select uuid - -### Base system installation -# Configure APT to not install recommended packages by default. Use of this -# option can result in an incomplete system and should only be used by very -# experienced users. -#d-i base-installer/install-recommends boolean false - -# The kernel image (meta) package to be installed; "none" can be used if no -# kernel is to be installed. -#d-i base-installer/kernel/image string linux-image-686 - -### Apt setup -# You can choose to install non-free and contrib software. -#d-i apt-setup/non-free boolean true -#d-i apt-setup/contrib boolean true -# Uncomment this if you don't want to use a network mirror. -#d-i apt-setup/use_mirror boolean false -# Select which update services to use; define the mirrors to be used. -# Values shown below are the normal defaults. -#d-i apt-setup/services-select multiselect security, updates -#d-i apt-setup/security_host string security.debian.org - -# Additional repositories, local[0-9] available -#d-i apt-setup/local0/repository string \ -# http://local.server/debian stable main -#d-i apt-setup/local0/comment string local server -# Enable deb-src lines -#d-i apt-setup/local0/source boolean true -# URL to the public key of the local repository; you must provide a key or -# apt will complain about the unauthenticated repository and so the -# sources.list line will be left commented out. -#d-i apt-setup/local0/key string http://local.server/key -# If the provided key file ends in ".asc" the key file needs to be an -# ASCII-armoured PGP key, if it ends in ".gpg" it needs to use the -# "GPG key public keyring" format, the "keybox database" format is -# currently not supported. - -# By default the installer requires that repositories be authenticated -# using a known gpg key. This setting can be used to disable that -# authentication. Warning: Insecure, not recommended. -#d-i debian-installer/allow_unauthenticated boolean true - -# Uncomment this to add multiarch configuration for i386 -#d-i apt-setup/multiarch string i386 - - -### Package selection -tasksel tasksel/first multiselect standard, ssh-server - -# Individual additional packages to install -d-i pkgsel/include string sudo fuse3 -# Whether to upgrade packages after debootstrap. -# Allowed values: none, safe-upgrade, full-upgrade -#d-i pkgsel/upgrade select none - -# Some versions of the installer can report back on what software you have -# installed, and what software you use. The default is not to report back, -# but sending reports helps the project determine what software is most -# popular and should be included on the first CD/DVD. -#popularity-contest popularity-contest/participate boolean false - -### Boot loader installation -# Grub is the boot loader (for x86). - -# This is fairly safe to set, it makes grub install automatically to the UEFI -# partition/boot record if no other operating system is detected on the machine. -d-i grub-installer/only_debian boolean true - -# This one makes grub-installer install to the UEFI partition/boot record, if -# it also finds some other OS, which is less safe as it might not be able to -# boot that other OS. -d-i grub-installer/with_other_os boolean true - -# Due notably to potential USB sticks, the location of the primary drive can -# not be determined safely in general, so this needs to be specified: -#d-i grub-installer/bootdev string /dev/sda -# To install to the primary device (assuming it is not a USB stick): -#d-i grub-installer/bootdev string default - -# Alternatively, if you want to install to a location other than the UEFI -# parition/boot record, uncomment and edit these lines: -#d-i grub-installer/only_debian boolean false -#d-i grub-installer/with_other_os boolean false -#d-i grub-installer/bootdev string (hd0,1) -# To install grub to multiple disks: -#d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1) - -# Optional password for grub, either in clear text -#d-i grub-installer/password password r00tme -#d-i grub-installer/password-again password r00tme -# or encrypted using an MD5 hash, see grub-md5-crypt(8). -#d-i grub-installer/password-crypted password [MD5 hash] - -# Use the following option to add additional boot parameters for the -# installed system (if supported by the bootloader installer). -# Note: options passed to the installer will be added automatically. -#d-i debian-installer/add-kernel-opts string nousb - -### Finishing up the installation -# During installations from serial console, the regular virtual consoles -# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next -# line to prevent this. -#d-i finish-install/keep-consoles boolean true - -# Avoid that last message about the install being complete. -d-i finish-install/reboot_in_progress note - -# This will prevent the installer from ejecting the CD during the reboot, -# which is useful in some situations. -#d-i cdrom-detect/eject boolean false - -# This is how to make the installer shutdown when finished, but not -# reboot into the installed system. -#d-i debian-installer/exit/halt boolean true -# This will power off the machine instead of just halting it. -#d-i debian-installer/exit/poweroff boolean true - -### Preseeding other packages -# Depending on what software you choose to install, or if things go wrong -# during the installation process, it's possible that other questions may -# be asked. You can preseed those too, of course. To get a list of every -# possible question that could be asked during an install, do an -# installation, and then run these commands: -# debconf-get-selections --installer > file -# debconf-get-selections >> file - - -#### Advanced options -### Running custom commands during the installation -# d-i preseeding is inherently not secure. Nothing in the installer checks -# for attempts at buffer overflows or other exploits of the values of a -# preconfiguration file like this one. Only use preconfiguration files from -# trusted locations! To drive that home, and because it's generally useful, -# here's a way to run any shell command you'd like inside the installer, -# automatically. - -# This first command is run as early as possible, just after -# preseeding is read. -#d-i preseed/early_command string anna-install some-udeb -# This command is run immediately before the partitioner starts. It may be -# useful to apply dynamic partitioner preseeding that depends on the state -# of the disks (which may not be visible when preseed/early_command runs). -#d-i partman/early_command \ -# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" -# This command is run just before the install finishes, but when there is -# still a usable /target directory. You can chroot to /target and use it -# directly, or use the apt-install and in-target commands to easily install -# packages and run commands in the target system. -d-i preseed/late_command string \ - echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/vagrant ; - echo export PATH=/sbin:$PATH >> ~/.bashrc diff --git a/debian-11/metadata-parallels.json b/debian-11/metadata-parallels.json deleted file mode 100644 index 036aa9d..0000000 --- a/debian-11/metadata-parallels.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "parallels" -} \ No newline at end of file diff --git a/debian-11/metadata.json b/debian-11/metadata.json deleted file mode 100644 index 121f0fc..0000000 --- a/debian-11/metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "vmware_fusion" -} \ No newline at end of file diff --git a/debian-11/parallels-bullseye.pkr.hcl b/debian-11/parallels-bullseye.pkr.hcl deleted file mode 100644 index 89194e5..0000000 --- a/debian-11/parallels-bullseye.pkr.hcl +++ /dev/null @@ -1,47 +0,0 @@ -source "parallels-iso" "debian-bullseye" { - iso_url = "https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-11.3.0-arm64-netinst.iso" - iso_checksum = "md5:1fb24715f545447aff432e543436e57d" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "debian" - http_directory = "http" - boot_command = [ - "c", - "linux /install.a64/vmlinuz auto=true priority=critical url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg --- quiet", - "", - "initrd /install.a64/initrd.gz", - "", - "boot", - "" - ] - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Debian 11" - output_directory = "output" - parallels_tools_flavor = "lin-arm" - parallels_tools_mode = "upload" - parallels_tools_guest_path = "/tmp/prltools.iso" -} - -build { - sources = ["sources.parallels-iso.debian-bullseye"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "parallels-cleanup.sh" - ] - } -} - -packer { - required_plugins { - parallels = { - version = ">= 1.0.1" - source = "github.com/hashicorp/parallels" - } - } -} \ No newline at end of file diff --git a/debian-11/parallels-cleanup.sh b/debian-11/parallels-cleanup.sh deleted file mode 100644 index 0b333f3..0000000 --- a/debian-11/parallels-cleanup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -x - -sudo mkdir -p /media/tools -sudo mount -o loop /tmp/prltools.iso /media/tools -sudo /media/tools/install --install-unattended-with-deps -sudo umount /media/tools -sudo rm -f /tmp/prltools.iso - -sudo apt-get clean -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync \ No newline at end of file diff --git a/debian-11/vmware-bullseye.pkr.hcl b/debian-11/vmware-bullseye.pkr.hcl deleted file mode 100644 index 4fc12c3..0000000 --- a/debian-11/vmware-bullseye.pkr.hcl +++ /dev/null @@ -1,50 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "debian-bullseye" { - iso_url = "https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-11.2.0-arm64-netinst.iso" - iso_checksum = "md5:f7be9e4eeb6de6e848ee1c75dece83be" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-debian11-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /install.a64/vmlinuz auto=true priority=critical url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg --- quiet", - "", - "initrd /install.a64/initrd.gz", - "", - "boot", - "" - ] - usb = true - vmx_data = { - "usb_xhci.present" = "true" - } - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Debian 11" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.debian-bullseye"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file diff --git a/debian-11/vmware-cleanup.sh b/debian-11/vmware-cleanup.sh deleted file mode 100644 index ef9e60a..0000000 --- a/debian-11/vmware-cleanup.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -x - -# sudo e4defrag / - -wget https://packages.vmware.com/tools/open-vm-tools/ovt-arm-tech-preview/Debian-10/open-vm-tools-11.2.5-2debian10.tgz -tar -zxf open-vm-tools-11.2.5-2debian10.tgz -sudo dpkg -i ./open-vm-tools_11.2.5-2debian10_arm64.deb -sudo apt --fix-broken install -y -sudo mkdir -p /mnt/hgfs/ -sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs/ -o subtype=vmhgfs-fuse,allow_other - -sudo apt-get clean -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync - -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/ubuntu-server-22.04/add-key.sh b/ubuntu-server-22.04/add-key.sh deleted file mode 100644 index 4f6f19a..0000000 --- a/ubuntu-server-22.04/add-key.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh -wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys \ No newline at end of file diff --git a/ubuntu-server-22.04/buildbox.sh b/ubuntu-server-22.04/buildbox.sh deleted file mode 100755 index e6a628c..0000000 --- a/ubuntu-server-22.04/buildbox.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -packer init vmware-jammy.pkr.hcl -packer build -force vmware-jammy.pkr.hcl - - -cp metadata.json output/metadata.json -cd output -tar cvzf vmware-jammy-arm64.box ./* -md5 vmware-jammy-arm64.box -rm -f *.v* *.nvram metadata.json \ No newline at end of file diff --git a/ubuntu-server-22.04/http/meta-data b/ubuntu-server-22.04/http/meta-data deleted file mode 100644 index e69de29..0000000 diff --git a/ubuntu-server-22.04/http/user-data b/ubuntu-server-22.04/http/user-data deleted file mode 100644 index f59c945..0000000 --- a/ubuntu-server-22.04/http/user-data +++ /dev/null @@ -1,22 +0,0 @@ -#cloud-config -autoinstall: - version: 1 - early-commands: - - sudo systemctl stop ssh - locale: en_US - keyboard: - layout: en - variant: us - identity: - hostname: ubuntu - username: vagrant - password: $6$rounds=4096$WL6Yb6B2dkPIZ$r8GqjQg6InPmTtFKoT41kXWWIfIPfHIvLhmFpIp8SFKi0c4282Tufycx787xeyt7Vq4UDoSMzWqkCLYOsXpvu0 - ssh: - install-server: true - allow-pw: true - package_update: true - package_upgrade: true - packages: - - open-vm-tools - late-commands: - - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu diff --git a/ubuntu-server-22.04/metadata.json b/ubuntu-server-22.04/metadata.json deleted file mode 100644 index 121f0fc..0000000 --- a/ubuntu-server-22.04/metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "provider": "vmware_fusion" -} \ No newline at end of file diff --git a/ubuntu-server-22.04/vmware-cleanup.sh b/ubuntu-server-22.04/vmware-cleanup.sh deleted file mode 100644 index d362b5f..0000000 --- a/ubuntu-server-22.04/vmware-cleanup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -sudo apt clean -sudo e4defrag / -sudo dd if=/dev/zero of=/EMPTY bs=1M -sudo rm -f /EMPTY -sync -sudo vmware-toolbox-cmd disk shrink / \ No newline at end of file diff --git a/ubuntu-server-22.04/vmware-jammy.pkr.hcl b/ubuntu-server-22.04/vmware-jammy.pkr.hcl deleted file mode 100644 index 989e7cf..0000000 --- a/ubuntu-server-22.04/vmware-jammy.pkr.hcl +++ /dev/null @@ -1,47 +0,0 @@ -packer { - required_plugins { - vmware = { - version = ">= 1.0.5" - source = "github.com/hashicorp/vmware" - } - } -} - -source "vmware-iso" "ubuntu-jammy" { - iso_url = "https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04-live-server-arm64.iso" - iso_checksum = "md5:4dcafe2e69d6d0a8979cb4eb7c26c3fd" - ssh_username = "vagrant" - ssh_password = "vagrant" - ssh_timeout = "30m" - shutdown_command = "sudo shutdown -h now" - guest_os_type = "arm-ubuntu-64" - disk_adapter_type = "nvme" - version = 19 - http_directory = "http" - boot_command = [ - "c", - "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", - "", - "initrd /casper/initrd", - "", - "boot", - "" - ] - usb = true - memory = 2048 - cpus = 2 - disk_size = 40000 - vm_name = "Ubuntu Server 22.04" - output_directory = "output" -} - -build { - sources = ["sources.vmware-iso.ubuntu-jammy"] - - provisioner "shell" { - scripts = [ - "add-key.sh", - "vmware-cleanup.sh" - ] - } -} \ No newline at end of file From cb52ae188a50a79e4bcc05630a55cbc1fb1ed3ab Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:51:03 +0000 Subject: [PATCH 14/44] docs(refactor): add prerequisites and usage --- README.md | 60 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 8ced2f9..da518d7 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,50 @@ # arm-base-boxes -Vagrant Base Boxes for ARM Hosts (e.g., Apple Silicon / M1) -This repository provides the Packer files for building Vagrant base boxes for ARM hosts. +Vagrant base boxes for ARM hosts (e.g., Apple Silicon M1). -The pre-built boxes can be found on [Vagrant Cloud](https://app.vagrantup.com/bytesguy) +This repository provides packer files for building Vagrant base boxes for ARM hosts. 🚨 These should not be used for production workloads - use them at your own risk! 🚨 -## Currently Supported Boxes +## Supported Boxes -| Distro | Version | Provider | Source | Box | -| ------ | ------- | -------- | ------ | --- | -| Ubuntu Server | 20.04.3 (Focal Fossa) | VMWare Fusion | [Source](ubuntu-server-20.04/) | [bytesguy/ubuntu-server-20.04-arm64](https://app.vagrantup.com/bytesguy/boxes/ubuntu-server-20.04-arm64) | -| Ubuntu Server | 20.04.3 (Focal Fossa) | Parallels | [Source](ubuntu-server-20.04/) | [bytesguy/ubuntu-server-20.04-arm64](https://app.vagrantup.com/bytesguy/boxes/ubuntu-server-20.04-arm64) | -| Ubuntu Server | 21.10 (Impish Indri) | VMWare Fusion | [Source](ubuntu-server-21.10/) | [bytesguy/ubuntu-server-21.10-arm64](https://app.vagrantup.com/bytesguy/boxes/ubuntu-server-21.10-arm64) | -| Debian | 11.2 (Bullseye) | VMWare Fusion | [Source](debian-11/) | [bytesguy/debian-11-arm64](https://app.vagrantup.com/bytesguy/boxes/debian-11-arm64) | -| Debian | 11.3 (Bullseye) | Parallels | [Source](debian-11/) | [bytesguy/debian-11-arm64](https://app.vagrantup.com/bytesguy/boxes/debian-11-arm64) | -| Debian | 10.11 (Buster) | VMWare Fusion | [Source](debian-10/) | [bytesguy/debian-10-arm64](https://app.vagrantup.com/bytesguy/boxes/debian-10-arm64) | +| Distro | Version | Provider | Source | +| --------------- | ------- | ------------- | ------------------ | +| CentOS 9 Stream | 9 | VMWare Fusion | [Source](centos-9) | -## In-Progress / Planned +## Dependencies -| Distro | Version | Provider | Source | -| ------ | ------- | -------- | ------ | -| Ubuntu Server | 22.04 | VMWare Fusion | [Source](ubuntu-server-22.04/) | -| Centos | 9 Stream | VMWare Fusion | [Source](centos-9/) | -| Fedora | 35 | VMWare Fusion | [Source](fedora-35/) | -| FreeBSD | 14 | VMWare Fusion | [Source](freebsd-14/) | +- [Packer](https://www.packer.io/): -## Usage Instructions + ```bash + brew install packer + ``` -TODO +- [Vagrant](https://www.vagrantup.com/): -## Building Instructions + ```bash + # You may need to install rosetta first + # sudo softwareupdate --install-rosetta + brew install --cask vagrant + ``` -The VM images are built with Packer and VMWare Fusion. Each subdirectory in this repo contains all the files needed to build the base box. The easiest way of building the box is to run the `buildbox.sh` command. This will start Packer and build the image, then compact the image into a box and print the checksum. +- [VMWare Fusion](https://www.vmware.com/products/fusion.html) +- [Vagrant VMWare Utility](https://formulae.brew.sh/cask/vagrant-vmware-utility): + + ```bash + brew install --cask vagrant-vmware-utility + ``` + +- [Vagrant VMware provider plugin](https://developer.hashicorp.com/vagrant/docs/providers/vmware/installation): + + ```bash + vagrant plugin install vagrant-vmware-desktop + ``` + +## Usage + +1. Use the `buildbox.sh` script in each directory to build the box and add it to Vagrant: + + ```bash + ./buildbox.sh + ``` From 246dd22a7d57317066fa00403bc39e42a30cc927 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:51:57 +0000 Subject: [PATCH 15/44] docs(refactor): remove number --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da518d7..6452688 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ This repository provides packer files for building Vagrant base boxes for ARM ho ## Usage -1. Use the `buildbox.sh` script in each directory to build the box and add it to Vagrant: +Use the `buildbox.sh` script in each directory to build the box and add it to Vagrant: - ```bash - ./buildbox.sh - ``` +```bash +./buildbox.sh +``` From ac87e5092b396d5650317fbf2d8e4b0dbc0666ca Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Thu, 9 Feb 2023 21:11:04 +0000 Subject: [PATCH 16/44] refactor: hardcode username and password It shouldn't be modified --- centos-9/centos9.auto.pkr.hcl | 12 ------------ centos-9/centos9.pkr.hcl | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/centos-9/centos9.auto.pkr.hcl b/centos-9/centos9.auto.pkr.hcl index bb2a0bf..5c30fc8 100644 --- a/centos-9/centos9.auto.pkr.hcl +++ b/centos-9/centos9.auto.pkr.hcl @@ -99,18 +99,6 @@ variable "memory" { } // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields -variable "ssh_username" { - type = string - description = "SSH username" - default = "vagrant" -} - -variable "ssh_password" { - type = string - description = "SSH password" - default = "vagrant" -} - variable "ssh_timeout" { type = string description = "SSH timeout" diff --git a/centos-9/centos9.pkr.hcl b/centos-9/centos9.pkr.hcl index 4516141..7704474 100644 --- a/centos-9/centos9.pkr.hcl +++ b/centos-9/centos9.pkr.hcl @@ -65,8 +65,8 @@ source "vmware-iso" "centos-9" { // SSH configuration // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields - ssh_username = var.ssh_username - ssh_password = var.ssh_password + ssh_username = "vagrant" + ssh_password = "vagrant" ssh_timeout = var.ssh_timeout // Boot configuration From 62a4904180ff61422959e237503d4414b6147949 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Mon, 13 Feb 2023 21:20:43 +0000 Subject: [PATCH 17/44] feat: add artifacts --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1404c31..b22298f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ output .DS_Store -packer_cache \ No newline at end of file +packer_cache +artifacts From f41845aa4de89bd4f2c9ff7ace5bfe9374bf9c9d Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Mon, 13 Feb 2023 21:20:53 +0000 Subject: [PATCH 18/44] feat: ubuntu 22.04 --- ubuntu-server-22.04/buildbox.sh | 16 ++++ ubuntu-server-22.04/data/meta-data | 0 ubuntu-server-22.04/data/user-data.pkrtpl.hcl | 36 +++++++ ubuntu-server-22.04/metadata.json | 3 + ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl | 94 +++++++++++++++++++ ubuntu-server-22.04/ubuntu2204.pkr.hcl | 81 ++++++++++++++++ 6 files changed, 230 insertions(+) create mode 100755 ubuntu-server-22.04/buildbox.sh create mode 100644 ubuntu-server-22.04/data/meta-data create mode 100644 ubuntu-server-22.04/data/user-data.pkrtpl.hcl create mode 100644 ubuntu-server-22.04/metadata.json create mode 100644 ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl create mode 100644 ubuntu-server-22.04/ubuntu2204.pkr.hcl diff --git a/ubuntu-server-22.04/buildbox.sh b/ubuntu-server-22.04/buildbox.sh new file mode 100755 index 0000000..d24d1bb --- /dev/null +++ b/ubuntu-server-22.04/buildbox.sh @@ -0,0 +1,16 @@ +#!/bin/bash +BOX_NAME="ubuntu-server-2204-arm64.box" + +# Initalise packer and build the VM +packer init . +packer build -force . +# Copy Vagrant metadata file to artifacts directory +cp metadata.json artifacts/metadata.json && cd artifacts +# Create Vagrant box +tar cvzf $BOX_NAME ./* +# Show the SHA256 checksum of the box +shasum -a 256 $BOX_NAME +# Clean up +rm -f *.v* *.nvram *.log *.scoreboard *.plist metadata.json +# Add the box to Vagrant +vagrant box add --force --name "ubuntu-server-2204-arm64" $BOX_NAME diff --git a/ubuntu-server-22.04/data/meta-data b/ubuntu-server-22.04/data/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl new file mode 100644 index 0000000..e1c4fcc --- /dev/null +++ b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl @@ -0,0 +1,36 @@ +#cloud-config +autoinstall: + version: 1 + early-commands: + - sudo systemctl stop ssh + locale: ${vm_guest_os_language} + keyboard: + layout: ${vm_guest_os_keyboard} + ssh: + install-server: true + allow-pw: true + packages: + - openssh-server + - open-vm-tools + - cloud-init + - wget + user-data: + disable_root: false + timezone: ${vm_guest_os_timezone} + late-commands: + - sed -i -e 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config + - sed -i -e 's/^UseDNS yes/UseDNS no/' /target/etc/ssh/sshd_config + - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/vagrant + - curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/vagrant + - mkdir -pv /home/vagrant/.ssh + - chmod 0700 /home/vagrant/.ssh + - wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub + - chmod 0600 /home/vagrant/.ssh/authorized_keys + - sudo dd if=/dev/zero of=/EMPTY bs=1M + - sudo rm -f /EMPTY + - sync + - sudo vmware-toolbox-cmd disk shrink / + identity: + hostname: ubuntu-server-2204 + password: "$64n946x4NEoA" + username: vagrant diff --git a/ubuntu-server-22.04/metadata.json b/ubuntu-server-22.04/metadata.json new file mode 100644 index 0000000..121f0fc --- /dev/null +++ b/ubuntu-server-22.04/metadata.json @@ -0,0 +1,3 @@ +{ + "provider": "vmware_fusion" +} \ No newline at end of file diff --git a/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl new file mode 100644 index 0000000..695f97f --- /dev/null +++ b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl @@ -0,0 +1,94 @@ +// centos9 packer variables file + +variable "vm_guest_os_language" { + type = string + description = "Guest OS language" + default = "en_GB" +} + +variable "vm_guest_os_keyboard" { + type = string + description = "Guest OS keyboard" + default = "gb" +} + +variable "vm_guest_os_timezone" { + type = string + description = "Guest OS timezone" + default = "Europe/London" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#disk_size +variable "disk_size" { + type = number + description = "Size of the disk in MB" + // ~40GB + default = 40000 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#guest_os_type +variable "guest_os_type" { + type = string + description = "Guest OS type" + default = "arm-ubuntu-64" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#version +variable "vmx_hardware_version" { + type = number + description = "VMX hardware version" + default = 20 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vm_name +variable "vm_name" { + type = string + description = "VM name" + default = "ubuntu-server-2204" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_adapter_type" { + type = string + description = "Disk adapter type" + default = "nvme" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_type_id" { + type = string + description = "Disk type ID" + default = "1" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration +variable "iso_checksum" { + type = string + description = "ISO checksum" + default = "file:https://cdimage.ubuntu.com/releases/22.04/release/SHA256SUMS" +} + +variable "iso_url" { + type = string + default = "https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.1-live-server-arm64.iso" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration +variable "cpus" { + type = number + description = "Number of CPUs" + default = 2 +} + +variable "memory" { + type = number + description = "Memory in MB" + default = 2048 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields +variable "ssh_timeout" { + type = string + description = "SSH timeout" + default = "30m" +} diff --git a/ubuntu-server-22.04/ubuntu2204.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.pkr.hcl new file mode 100644 index 0000000..80cd3f1 --- /dev/null +++ b/ubuntu-server-22.04/ubuntu2204.pkr.hcl @@ -0,0 +1,81 @@ +packer { + required_version = ">= 1.8.5" + required_plugins { + vmware = { + version = ">= 1.0.7" + source = "github.com/hashicorp/vmware" + } + } +} + +locals { + data_source_content = { + "/meta-data" = file("${abspath(path.root)}/data/meta-data") + "/user-data" = templatefile("${abspath(path.root)}/data/user-data.pkrtpl.hcl", { + vm_guest_os_language = var.vm_guest_os_language + vm_guest_os_keyboard = var.vm_guest_os_keyboard + vm_guest_os_timezone = var.vm_guest_os_timezone + }) + } +} + +source "vmware-iso" "ubuntu-server-2204" { + // Optional configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional + disk_size = var.disk_size + guest_os_type = var.guest_os_type + version = var.vmx_hardware_version + vm_name = var.vm_name + + // Extra disk configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration + disk_adapter_type = var.disk_adapter_type + disk_type_id = var.disk_type_id + + // ISO configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration + iso_checksum = var.iso_checksum + iso_url = var.iso_url + + // HTTP configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#http-directory-configuration + http_content = local.data_source_content + + // Shutdown configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#shutdown-configuration + shutdown_command = "sudo shutdown -h now" + + // Hardware configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration + cpus = var.cpus + memory = var.memory + usb = true + + // Output configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#output-configuration + output_directory = "artifacts" + + // SSH configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields + ssh_username = "vagrant" + ssh_password = "vagrant" + ssh_timeout = var.ssh_timeout + + // Boot configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#boot-configuration + boot_command = [ + "c", + "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", + "", + "initrd /casper/initrd", + "", + "modprobe.blacklist=vmwgfx", + "", + "boot", + "" + ] +} + +build { + sources = ["sources.vmware-iso.ubuntu-server-2204"] +} From 4b8f74277326fae15a532c636bb7c943d8616614 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Mon, 13 Feb 2023 21:32:44 +0000 Subject: [PATCH 19/44] refactor: https://kb.vmware.com/s/article/89983?lang=en_US --- ubuntu-server-22.04/ubuntu2204.pkr.hcl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ubuntu-server-22.04/ubuntu2204.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.pkr.hcl index 80cd3f1..1fbe882 100644 --- a/ubuntu-server-22.04/ubuntu2204.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.pkr.hcl @@ -65,12 +65,10 @@ source "vmware-iso" "ubuntu-server-2204" { // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#boot-configuration boot_command = [ "c", - "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", + "linux /casper/vmlinuz modprobe.blacklist=vmwgfx \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", "", "initrd /casper/initrd", "", - "modprobe.blacklist=vmwgfx", - "", "boot", "" ] From 582dc929821de35b9b8ba8bc39533f15eb0fba3d Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 15:53:04 +0100 Subject: [PATCH 20/44] refactor: update image URL --- ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl index 695f97f..9299ac3 100644 --- a/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl @@ -70,7 +70,7 @@ variable "iso_checksum" { variable "iso_url" { type = string - default = "https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.1-live-server-arm64.iso" + default = "https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.2-live-server-arm64.iso" } // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration From 54e13965a4eb37bb3f5998e40bc5b6bad28a6f0a Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 15:53:13 +0100 Subject: [PATCH 21/44] refactor: remove blacklist --- ubuntu-server-22.04/ubuntu2204.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-server-22.04/ubuntu2204.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.pkr.hcl index 1fbe882..2713740 100644 --- a/ubuntu-server-22.04/ubuntu2204.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.pkr.hcl @@ -65,7 +65,7 @@ source "vmware-iso" "ubuntu-server-2204" { // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#boot-configuration boot_command = [ "c", - "linux /casper/vmlinuz modprobe.blacklist=vmwgfx \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", + "linux /casper/vmlinuz \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" --- autoinstall", "", "initrd /casper/initrd", "", From 3c9b732f9e133950378fe2ed8472333289ac9cfa Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 16:53:53 +0100 Subject: [PATCH 22/44] fix: boot stuck at network --- ubuntu-server-22.04/ubuntu2204.pkr.hcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ubuntu-server-22.04/ubuntu2204.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.pkr.hcl index 2713740..13e16f2 100644 --- a/ubuntu-server-22.04/ubuntu2204.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.pkr.hcl @@ -55,6 +55,13 @@ source "vmware-iso" "ubuntu-server-2204" { // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#output-configuration output_directory = "artifacts" + // VMX configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vmx-configuration + vmx_data = { + "ethernet0.virtualdev" = "e1000e" + "usb_xhci.present" = "true" + } + // SSH configuration // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields ssh_username = "vagrant" From f20ba281f8b6f35d60d98219319cfe3b65b0b4e9 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 16:54:04 +0100 Subject: [PATCH 23/44] fix: command sequence --- ubuntu-server-22.04/data/user-data.pkrtpl.hcl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl index e1c4fcc..a8c3019 100644 --- a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl +++ b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl @@ -22,15 +22,15 @@ autoinstall: - sed -i -e 's/^UseDNS yes/UseDNS no/' /target/etc/ssh/sshd_config - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/vagrant - curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/vagrant - - mkdir -pv /home/vagrant/.ssh - - chmod 0700 /home/vagrant/.ssh - - wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub - - chmod 0600 /home/vagrant/.ssh/authorized_keys - - sudo dd if=/dev/zero of=/EMPTY bs=1M - - sudo rm -f /EMPTY - - sync - - sudo vmware-toolbox-cmd disk shrink / + - curtin in-target --target=/target -- mkdir -pv /home/vagrant/.ssh + - curtin in-target --target=/target -- chmod 700 /home/vagrant/.ssh + - curtin in-target --target=/target -- wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub + - curtin in-target --target=/target -- chmod 644 /home/vagrant/.ssh/authorized_keys + - curtin in-target --target=/target -- dd if=/dev/zero of=/EMPTY bs=1M || true + - curtin in-target --target=/target -- rm -f /EMPTY + - curtin in-target --target=/target -- sync + - curtin in-target --target=/target -- vmware-toolbox-cmd disk shrink / identity: hostname: ubuntu-server-2204 - password: "$64n946x4NEoA" + password: "$1$r2NloNBC$kSbIBH09KfzNU9PXtH3.D." username: vagrant From 15654a03067abdabd83aab49417c2393f680cd4c Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 16:59:57 +0100 Subject: [PATCH 24/44] fix: add missing `-` --- centos-9/buildbox.sh | 2 +- ubuntu-server-22.04/buildbox.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/centos-9/buildbox.sh b/centos-9/buildbox.sh index 8beb2b3..7f2062d 100755 --- a/centos-9/buildbox.sh +++ b/centos-9/buildbox.sh @@ -7,7 +7,7 @@ packer build -force . # Copy Vagrant metadata file to artifacts directory cp metadata.json artifacts/metadata.json && cd artifacts # Create Vagrant box -tar cvzf $BOX_NAME ./* +tar -cvzf $BOX_NAME ./* # Show the SHA256 checksum of the box shasum -a 256 $BOX_NAME # Clean up diff --git a/ubuntu-server-22.04/buildbox.sh b/ubuntu-server-22.04/buildbox.sh index d24d1bb..8010ae3 100755 --- a/ubuntu-server-22.04/buildbox.sh +++ b/ubuntu-server-22.04/buildbox.sh @@ -7,7 +7,7 @@ packer build -force . # Copy Vagrant metadata file to artifacts directory cp metadata.json artifacts/metadata.json && cd artifacts # Create Vagrant box -tar cvzf $BOX_NAME ./* +tar -cvzf $BOX_NAME ./* # Show the SHA256 checksum of the box shasum -a 256 $BOX_NAME # Clean up From 73fcec3bba5858bede6869aa265ec71db1233ef1 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 17:21:36 +0100 Subject: [PATCH 25/44] feat: add `v.gui` For some reason `vagrant up` doesn't work without it --- centos-9/Vagrantfile | 1 + ubuntu-server-22.04/Vagrantfile | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 ubuntu-server-22.04/Vagrantfile diff --git a/centos-9/Vagrantfile b/centos-9/Vagrantfile index 09bcc00..9c7ea45 100644 --- a/centos-9/Vagrantfile +++ b/centos-9/Vagrantfile @@ -4,6 +4,7 @@ Vagrant.configure("2") do |config| config.vm.box = "centos9-arm64" config.vm.provider "vmware_desktop" do |v| + v.gui = true v.vmx["ethernet0.virtualDev"] = "e1000e" v.vmx["usb_xhci.present"] = "true" end diff --git a/ubuntu-server-22.04/Vagrantfile b/ubuntu-server-22.04/Vagrantfile new file mode 100644 index 0000000..bb57cf2 --- /dev/null +++ b/ubuntu-server-22.04/Vagrantfile @@ -0,0 +1,11 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "ubuntu-server-2204-arm64" + config.vm.provider "vmware_desktop" do |v| + v.gui = true + v.vmx["ethernet0.virtualDev"] = "e1000e" + v.vmx["usb_xhci.present"] = "true" + end +end From d1cb39f6cd0c0e69d498aa81824db03f8c8d723f Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 17:26:44 +0100 Subject: [PATCH 26/44] fix: correct home permissions --- ubuntu-server-22.04/data/user-data.pkrtpl.hcl | 1 + 1 file changed, 1 insertion(+) diff --git a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl index a8c3019..1d6e7b3 100644 --- a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl +++ b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl @@ -26,6 +26,7 @@ autoinstall: - curtin in-target --target=/target -- chmod 700 /home/vagrant/.ssh - curtin in-target --target=/target -- wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub - curtin in-target --target=/target -- chmod 644 /home/vagrant/.ssh/authorized_keys + - curtin in-target --target=/target -- chown -R vagrant:vagrant /home/vagrant/ - curtin in-target --target=/target -- dd if=/dev/zero of=/EMPTY bs=1M || true - curtin in-target --target=/target -- rm -f /EMPTY - curtin in-target --target=/target -- sync From 67a5771f8bb051cc782998c1ea4e54741e97bb13 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 17:29:11 +0100 Subject: [PATCH 27/44] chore: ignore `.vagrant` --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b22298f..f93019f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ output .DS_Store packer_cache artifacts +.vagrant From 774de51d20a89a08fd27906441d4e54623a63ecb Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 18:45:10 +0100 Subject: [PATCH 28/44] refactor: changes --- centos-9/scripts/post-install.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/centos-9/scripts/post-install.sh b/centos-9/scripts/post-install.sh index 9ea5f3d..fa7de7d 100644 --- a/centos-9/scripts/post-install.sh +++ b/centos-9/scripts/post-install.sh @@ -1,14 +1,11 @@ #!/bin/bash - -# Configure vagrant SSH authentication +# Configure vagrant SSH key based authentication mkdir -pv /home/vagrant/.ssh -chmod 0700 /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub -chmod 0600 /home/vagrant/.ssh/authorized_keys - -# Modify SSH server configuration UseDNS no +chmod 644 /home/vagrant/.ssh/authorized_keys +# Modify SSH server configuration sudo sed -i 's/^UseDNS yes/UseDNS no/' /etc/ssh/sshd_config - # Shrink the disk sudo dd if=/dev/zero of=/EMPTY bs=1M sudo rm -f /EMPTY From 449f6bcebcb996a6c962da54971af69b0e43de82 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 18:45:48 +0100 Subject: [PATCH 29/44] refactor: fix permissions for /home/vagrant --- ubuntu-server-22.04/data/user-data.pkrtpl.hcl | 9 --------- ubuntu-server-22.04/scripts/post-install.sh | 11 +++++++++++ ubuntu-server-22.04/ubuntu2204.pkr.hcl | 6 ++++++ 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 ubuntu-server-22.04/scripts/post-install.sh diff --git a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl index 1d6e7b3..b134371 100644 --- a/ubuntu-server-22.04/data/user-data.pkrtpl.hcl +++ b/ubuntu-server-22.04/data/user-data.pkrtpl.hcl @@ -22,15 +22,6 @@ autoinstall: - sed -i -e 's/^UseDNS yes/UseDNS no/' /target/etc/ssh/sshd_config - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/vagrant - curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/vagrant - - curtin in-target --target=/target -- mkdir -pv /home/vagrant/.ssh - - curtin in-target --target=/target -- chmod 700 /home/vagrant/.ssh - - curtin in-target --target=/target -- wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub - - curtin in-target --target=/target -- chmod 644 /home/vagrant/.ssh/authorized_keys - - curtin in-target --target=/target -- chown -R vagrant:vagrant /home/vagrant/ - - curtin in-target --target=/target -- dd if=/dev/zero of=/EMPTY bs=1M || true - - curtin in-target --target=/target -- rm -f /EMPTY - - curtin in-target --target=/target -- sync - - curtin in-target --target=/target -- vmware-toolbox-cmd disk shrink / identity: hostname: ubuntu-server-2204 password: "$1$r2NloNBC$kSbIBH09KfzNU9PXtH3.D." diff --git a/ubuntu-server-22.04/scripts/post-install.sh b/ubuntu-server-22.04/scripts/post-install.sh new file mode 100644 index 0000000..c969efd --- /dev/null +++ b/ubuntu-server-22.04/scripts/post-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Configure vagrant SSH key based authentication +mkdir -pv /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh +wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub +chmod 644 /home/vagrant/.ssh/authorized_keys +# Shrink the disk +sudo dd if=/dev/zero of=/EMPTY bs=1M +sudo rm -f /EMPTY +sync +sudo vmware-toolbox-cmd disk shrink / diff --git a/ubuntu-server-22.04/ubuntu2204.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.pkr.hcl index 13e16f2..928e7c1 100644 --- a/ubuntu-server-22.04/ubuntu2204.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.pkr.hcl @@ -83,4 +83,10 @@ source "vmware-iso" "ubuntu-server-2204" { build { sources = ["sources.vmware-iso.ubuntu-server-2204"] + + provisioner "shell" { + scripts = [ + "scripts/post-install.sh" + ] + } } From 6436d5e02c893ecbd247dfa47db3090f85dca359 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 19:37:38 +0100 Subject: [PATCH 30/44] ignore `.box` --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f93019f..9bc63e5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ output packer_cache artifacts .vagrant +*.box From 4d302b0bf387ca88c24e40064fde64b209002a99 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 19:39:08 +0100 Subject: [PATCH 31/44] docs(refactor): support ubuntu 22.04 --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6452688..54c49fa 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,16 @@ Vagrant base boxes for ARM hosts (e.g., Apple Silicon M1). -This repository provides packer files for building Vagrant base boxes for ARM hosts. +This repository contains Packer files for building Vagrant base boxes for ARM hosts. -🚨 These should not be used for production workloads - use them at your own risk! 🚨 +🚨 These Vagrant boxes should not be used for production workloads - use them at your own risk! 🚨 ## Supported Boxes -| Distro | Version | Provider | Source | -| --------------- | ------- | ------------- | ------------------ | -| CentOS 9 Stream | 9 | VMWare Fusion | [Source](centos-9) | +| Distro | Version | Provider | Source | +| --------------- | ------- | ------------- | ----------------------------- | +| CentOS 9 Stream | 9 | VMWare Fusion | [Source](centos-9) | +| Ubuntu Server | 22.04.2 | VMWare Fusion | [Source](ubuntu-server-22.04) | ## Dependencies From 9d269ded787e0db02f51952317f867b116f02f9e Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 19:43:44 +0100 Subject: [PATCH 32/44] refactor: comment --- ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl index 9299ac3..debf5bb 100644 --- a/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl +++ b/ubuntu-server-22.04/ubuntu2204.auto.pkr.hcl @@ -1,4 +1,4 @@ -// centos9 packer variables file +// ubuntu-server-22.04 packer variables file variable "vm_guest_os_language" { type = string From dad46e69fa2295ef68c6b7acfd4e4c5f1d12a1ef Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 23:30:41 +0100 Subject: [PATCH 33/44] docs(refactor): VMware --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 54c49fa..bc116df 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho | Distro | Version | Provider | Source | | --------------- | ------- | ------------- | ----------------------------- | -| CentOS 9 Stream | 9 | VMWare Fusion | [Source](centos-9) | -| Ubuntu Server | 22.04.2 | VMWare Fusion | [Source](ubuntu-server-22.04) | +| CentOS 9 Stream | 9 | VMware Fusion | [Source](centos-9) | +| Ubuntu Server | 22.04.2 | VMware Fusion | [Source](ubuntu-server-22.04) | ## Dependencies @@ -29,8 +29,8 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho brew install --cask vagrant ``` -- [VMWare Fusion](https://www.vmware.com/products/fusion.html) -- [Vagrant VMWare Utility](https://formulae.brew.sh/cask/vagrant-vmware-utility): +- [VMware Fusion](https://www.vmware.com/products/fusion.html) +- [Vagrant VMware Utility](https://formulae.brew.sh/cask/vagrant-vmware-utility): ```bash brew install --cask vagrant-vmware-utility From c3f264c7df2066910bf237e95e4f04760e682580 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 9 Apr 2023 23:34:40 +0100 Subject: [PATCH 34/44] docs(refactor): usage --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bc116df..00217ec 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,16 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho ## Usage -Use the `buildbox.sh` script in each directory to build the box and add it to Vagrant: +1. Use the `buildbox.sh` script in each directory to build the box and add it to Vagrant: -```bash -./buildbox.sh -``` + ```bash + chmod +x ./buildbox.sh && ./buildbox.sh + ``` + +2. Start the VM with Vagrant: + + ```bash + vagrant up + ``` + +Enjoy! ✨🚀 From 2f7b904107e8e826659a75e9b85034ab1d426ebf Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 16 Apr 2023 20:58:52 +0100 Subject: [PATCH 35/44] feat: add `debian-11` --- debian-11/Vagrantfile | 11 + debian-11/buildbox.sh | 16 ++ debian-11/data/preseed.cfg.pkrtpl.hcl | 289 ++++++++++++++++++++++++++ debian-11/debian11.auto.pkr.hcl | 94 +++++++++ debian-11/debian11.pkr.hcl | 90 ++++++++ debian-11/metadata.json | 3 + debian-11/scripts/post-install.sh | 32 +++ 7 files changed, 535 insertions(+) create mode 100644 debian-11/Vagrantfile create mode 100755 debian-11/buildbox.sh create mode 100644 debian-11/data/preseed.cfg.pkrtpl.hcl create mode 100644 debian-11/debian11.auto.pkr.hcl create mode 100644 debian-11/debian11.pkr.hcl create mode 100644 debian-11/metadata.json create mode 100644 debian-11/scripts/post-install.sh diff --git a/debian-11/Vagrantfile b/debian-11/Vagrantfile new file mode 100644 index 0000000..fbe6654 --- /dev/null +++ b/debian-11/Vagrantfile @@ -0,0 +1,11 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "debian-11-arm64" + config.vm.provider "vmware_desktop" do |v| + v.gui = true + v.vmx["ethernet0.virtualDev"] = "e1000e" + v.vmx["usb_xhci.present"] = "true" + end +end diff --git a/debian-11/buildbox.sh b/debian-11/buildbox.sh new file mode 100755 index 0000000..10e978c --- /dev/null +++ b/debian-11/buildbox.sh @@ -0,0 +1,16 @@ +#!/bin/bash +BOX_NAME="debian-11-arm64.box" + +# Initalise packer and build the VM +packer init . +packer build -force . +# Copy Vagrant metadata file to artifacts directory +cp metadata.json artifacts/metadata.json && cd artifacts +# Create Vagrant box +tar -cvzf $BOX_NAME ./* +# Show the SHA256 checksum of the box +shasum -a 256 $BOX_NAME +# Clean up +rm -f *.v* *.nvram *.log *.scoreboard *.plist metadata.json +# Add the box to Vagrant +vagrant box add --force --name "debian-11-arm64" $BOX_NAME diff --git a/debian-11/data/preseed.cfg.pkrtpl.hcl b/debian-11/data/preseed.cfg.pkrtpl.hcl new file mode 100644 index 0000000..34fd34a --- /dev/null +++ b/debian-11/data/preseed.cfg.pkrtpl.hcl @@ -0,0 +1,289 @@ +#### Contents of the preconfiguration file +### Localization +# Locale sets language and country. +d-i debian-installer/locale string ${vm_guest_os_language} + +# Keyboard selection. +#d-i console-tools/archs select at +d-i keyboard-configuration/xkb-keymap select ${vm_guest_os_keyboard} +# Example for a different keyboard architecture +#d-i console-keymaps-usb/keymap select mac-usb-us + +### Network configuration +# netcfg will choose an interface that has link if possible. This makes it +# skip displaying a list if there is more than one interface. +d-i netcfg/choose_interface select auto + +# To pick a particular interface instead: +#d-i netcfg/choose_interface select eth1 + +# If you have a slow dhcp server and the installer times out waiting for +# it, this might be useful. +#d-i netcfg/dhcp_timeout string 60 + +# If you prefer to configure the network manually, uncomment this line and +# the static network configuration below. +#d-i netcfg/disable_dhcp boolean true + +# If you want the preconfiguration file to work on systems both with and +# without a dhcp server, uncomment these lines and the static network +# configuration below. +#d-i netcfg/dhcp_failed note +#d-i netcfg/dhcp_options select Configure network manually + +# Static network configuration. +#d-i netcfg/get_nameservers string 192.168.1.1 +#d-i netcfg/get_ipaddress string 192.168.1.42 +#d-i netcfg/get_netmask string 255.255.255.0 +#d-i netcfg/get_gateway string 192.168.1.1 +#d-i netcfg/confirm_static boolean true + +# Any hostname and domain names assigned from dhcp take precedence over +# values set here. However, setting the values still prevents the questions +# from being shown, even if values come from dhcp. +d-i netcfg/get_hostname string unassigned-hostname +d-i netcfg/get_domain string unassigned-domain + +# Disable that annoying WEP key dialog. +d-i netcfg/wireless_wep string +# The wacky dhcp hostname that some ISPs use as a password of sorts. +#d-i netcfg/dhcp_hostname string radish + +### Mirror settings +# If you select ftp, the mirror/country string does not need to be set. +#d-i mirror/protocol string ftp +d-i mirror/country string manual +d-i mirror/http/hostname string http.us.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string + +# Suite to install. +#d-i mirror/suite string testing +# Suite to use for loading installer components (optional). +#d-i mirror/udeb/suite string testing + +### Partitioning +# If the system has free space you can choose to only partition that space. +# Note: this must be preseeded with a localized (translated) value. +#d-i partman-auto/init_automatically_partition \ +# select Guided - use the largest continuous free space + +# Alternatively, you can specify a disk to partition. The device name +# can be given in either devfs or traditional non-devfs format. +# For example, to use the first disk: +#d-i partman-auto/disk string /dev/discs/disc0/disc +# In addition, you'll need to specify the method to use. +# The presently available methods are: "regular", "lvm" and "crypto" +d-i partman-auto/method string lvm + +# If one of the disks that are going to be automatically partitioned +# contains an old LVM configuration, the user will normally receive a +# warning. This can be preseeded away... +d-i partman-auto/purge_lvm_from_device boolean true +# And the same goes for the confirmation to write the lvm partitions. +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +# You can choose from any of the predefined partitioning recipes. +# Note: this must be preseeded with a localized (translated) value. +d-i partman-auto/choose_recipe select atomic +# You can define the amount of space that will be used for the LVM volume +# group. It can either be a size with its unit (eg. 20 GB), a percentage of +# free space or the 'max' keyword. +d-i partman-auto-lvm/guided_size string max +#d-i partman-auto/choose_recipe \ +# select Separate /home partition +#d-i partman-auto/choose_recipe \ +# select Separate /home, /usr, /var, and /tmp partitions + +# Or provide a recipe of your own... +# The recipe format is documented in the file devel/partman-auto-recipe.txt. +# If you have a way to get a recipe file into the d-i environment, you can +# just point at it. +#d-i partman-auto/expert_recipe_file string /hd-media/recipe + +# If not, you can put an entire recipe into the preconfiguration file in one +# (logical) line. This example creates a small /boot partition, suitable +# swap, and uses the rest of the space for the root partition: +#d-i partman-auto/expert_recipe string \ +# boot-root :: \ +# 40 50 100 ext3 \ +# $primary{ } $bootable{ } \ +# method{ format } format{ } \ +# use_filesystem{ } filesystem{ ext3 } \ +# mountpoint{ /boot } \ +# . \ +# 500 10000 1000000000 ext3 \ +# method{ format } format{ } \ +# use_filesystem{ } filesystem{ ext3 } \ +# mountpoint{ / } \ +# . \ +# 64 512 300% linux-swap \ +# method{ swap } format{ } \ +# . + +# This makes partman automatically partition without confirmation. +d-i partman/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +### Clock and time zone setup +# Controls whether or not the hardware clock is set to UTC. +d-i clock-setup/utc boolean true + +# You may set this to any valid setting for $TZ; see the contents of +# /usr/share/zoneinfo/ for valid values. +d-i time/zone string ${vm_guest_os_timezone} + +### Apt setup +# You can choose to install non-free and contrib software. +#d-i apt-setup/non-free boolean true +#d-i apt-setup/contrib boolean true +# Uncomment this if you don't want to use a network mirror. +#d-i apt-setup/use_mirror boolean false +# Uncomment this to avoid adding security sources, or +# add a hostname to use a different server than security.debian.org. +#d-i apt-setup/security_host string + +# Additional repositories, local[0-9] available +#d-i apt-setup/local0/repository string \ +# deb http://local.server/debian stable main +#d-i apt-setup/local0/comment string local server +# Enable deb-src lines +#d-i apt-setup/local0/source boolean true +# URL to the public key of the local repository; you must provide a key or +# apt will complain about the unauthenticated repository and so the +# sources.list line will be left commented out +#d-i apt-setup/local0/key string http://local.server/key + +# By default the installer requires that repositories be authenticated +# using a known gpg key. This setting can be used to disable that +# authentication. Warning: Insecure, not recommended. +#d-i debian-installer/allow_unauthenticated string true + +### Account setup +# Skip creation of a root account (normal user account will be able to +# use sudo). +#d-i passwd/root-login boolean false +# Alternatively, to skip creation of a normal user account. +#d-i passwd/make-user boolean false + +# Root password, either in clear text +d-i passwd/root-password password vagrant +d-i passwd/root-password-again password vagrant +# or encrypted using an MD5 hash. +#d-i passwd/root-password-crypted password [MD5 hash] + +# To create a normal user account. +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +# Normal user's password, either in clear text +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant +# or encrypted using an MD5 hash. +#d-i passwd/user-password-crypted password [MD5 hash] + +### Base system installation +# Select the initramfs generator used to generate the initrd for 2.6 kernels. +#d-i base-installer/kernel/linux/initramfs-generators string yaird + +### Boot loader installation +# Grub is the default boot loader (for x86). If you want lilo installed +# instead, uncomment this: +#d-i grub-installer/skip boolean true + +# This is fairly safe to set, it makes grub install automatically to the MBR +# if no other operating system is detected on the machine. +d-i grub-installer/only_debian boolean true + +# This one makes grub-installer install to the MBR if it also finds some other +# OS, which is less safe as it might not be able to boot that other OS. +d-i grub-installer/with_other_os boolean true + +# Alternatively, if you want to install to a location other than the mbr, +# uncomment and edit these lines: +#d-i grub-installer/only_debian boolean false +#d-i grub-installer/with_other_os boolean false +#d-i grub-installer/bootdev string (hd0,0) +# To install grub to multiple disks: +#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0) + +### Package selection +tasksel tasksel/first multiselect standard +#tasksel tasksel/first multiselect standard, desktop +#tasksel tasksel/first multiselect standard, web-server +#tasksel tasksel/first multiselect standard, kde-desktop + +# Individual additional packages to install +d-i pkgsel/include string openssh-server sudo + +# Some versions of the installer can report back on what software you have +# installed, and what software you use. The default is not to report back, +# but sending reports helps the project determine what software is most +# popular and include it on CDs. +#popularity-contest popularity-contest/participate boolean false + +### Finishing up the first stage install +# Avoid that last message about the install being complete. +d-i finish-install/reboot_in_progress note + +# This will prevent the installer from ejecting the CD during the reboot, +# which is useful in some situations. +#d-i cdrom-detect/eject boolean false + +### X configuration +# X can detect the right driver for some cards, but if you're preseeding, +# you override whatever it chooses. Still, vesa will work most places. +#xserver-xorg xserver-xorg/config/device/driver select vesa + +# A caveat with mouse autodetection is that if it fails, X will retry it +# over and over. So if it's preseeded to be done, there is a possibility of +# an infinite loop if the mouse is not autodetected. +#xserver-xorg xserver-xorg/autodetect_mouse boolean true + +# Monitor autodetection is recommended. +#xserver-xorg xserver-xorg/autodetect_monitor boolean true +# Uncomment if you have an LCD display. +#xserver-xorg xserver-xorg/config/monitor/lcd boolean true +# X has three configuration paths for the monitor. Here's how to preseed +# the "medium" path, which is always available. The "simple" path may not +# be available, and the "advanced" path asks too many questions. +#xserver-xorg xserver-xorg/config/monitor/selection-method \ +# select medium +#xserver-xorg xserver-xorg/config/monitor/mode-list \ +# select 1024x768 @ 60 Hz + +### Preseeding other packages +# Depending on what software you choose to install, or if things go wrong +# during the installation process, it's possible that other questions may +# be asked. You can preseed those too, of course. To get a list of every +# possible question that could be asked during an install, do an +# installation, and then run these commands: +# debconf-get-selections --installer > file +# debconf-get-selections >> file + + +#### Advanced options +### Running custom commands during the installation +# d-i preseeding is inherently not secure. Nothing in the installer checks +# for attempts at buffer overflows or other exploits of the values of a +# preconfiguration file like this one. Only use preconfiguration files from +# trusted locations! To drive that home, and because it's generally useful, +# here's a way to run any shell command you'd like inside the installer, +# automatically. + +# This first command is run as early as possible, just after +# preseeding is read. +#d-i preseed/early_command string anna-install some-udeb + +# This command is run just before the install finishes, but when there is +# still a usable /target directory. You can chroot to /target and use it +# directly, or use the apt-install and in-target commands to easily install +# packages and run commands in the target system. +#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh +d-i preseed/late_command string \ + echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/vagrant ; \ + in-target chmod 440 /etc/sudoers.d/vagrant ; diff --git a/debian-11/debian11.auto.pkr.hcl b/debian-11/debian11.auto.pkr.hcl new file mode 100644 index 0000000..a3768c5 --- /dev/null +++ b/debian-11/debian11.auto.pkr.hcl @@ -0,0 +1,94 @@ +// debian11 packer variables file + +variable "vm_guest_os_language" { + type = string + description = "Guest OS language" + default = "en_GB" +} + +variable "vm_guest_os_keyboard" { + type = string + description = "Guest OS keyboard" + default = "gb" +} + +variable "vm_guest_os_timezone" { + type = string + description = "Guest OS timezone" + default = "Europe/London" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#disk_size +variable "disk_size" { + type = number + description = "Size of the disk in MB" + // ~40GB + default = 40000 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#guest_os_type +variable "guest_os_type" { + type = string + description = "Guest OS type" + default = "arm-debian-64" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#version +variable "vmx_hardware_version" { + type = number + description = "VMX hardware version" + default = 20 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vm_name +variable "vm_name" { + type = string + description = "VM name" + default = "debian11" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_adapter_type" { + type = string + description = "Disk adapter type" + default = "nvme" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration +variable "disk_type_id" { + type = string + description = "Disk type ID" + default = "1" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration +variable "iso_checksum" { + type = string + description = "ISO checksum" + default = "file:http://cdimage.debian.org/debian-cd/current/arm64/iso-cd/SHA256SUMS" +} + +variable "iso_url" { + type = string + default = "http://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-11.6.0-arm64-netinst.iso" +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration +variable "cpus" { + type = number + description = "Number of CPUs" + default = 2 +} + +variable "memory" { + type = number + description = "Memory in MB" + default = 2048 +} + +// https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields +variable "ssh_timeout" { + type = string + description = "SSH timeout" + default = "30m" +} diff --git a/debian-11/debian11.pkr.hcl b/debian-11/debian11.pkr.hcl new file mode 100644 index 0000000..00965da --- /dev/null +++ b/debian-11/debian11.pkr.hcl @@ -0,0 +1,90 @@ +packer { + required_version = ">= 1.8.5" + required_plugins { + vmware = { + version = ">= 1.0.7" + source = "github.com/hashicorp/vmware" + } + } +} + +locals { + data_source_content = { + "/preseed.cfg" = templatefile("${abspath(path.root)}/data/preseed.cfg.pkrtpl.hcl", { + vm_guest_os_language = var.vm_guest_os_language + vm_guest_os_keyboard = var.vm_guest_os_keyboard + vm_guest_os_timezone = var.vm_guest_os_timezone + }) + } +} + +source "vmware-iso" "debian-11" { + // Optional configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional + disk_size = var.disk_size + guest_os_type = var.guest_os_type + version = var.vmx_hardware_version + vm_name = var.vm_name + + // Extra disk configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#extra-disk-configuration + disk_adapter_type = var.disk_adapter_type + disk_type_id = var.disk_type_id + + // ISO configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#iso-configuration + iso_checksum = var.iso_checksum + iso_url = var.iso_url + + // HTTP configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#http-directory-configuration + http_content = local.data_source_content + + // Shutdown configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#shutdown-configuration + shutdown_command = "sudo shutdown -h now" + + // Hardware configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration + cpus = var.cpus + memory = var.memory + usb = true + + // Output configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#output-configuration + output_directory = "artifacts" + + // VMX configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#vmx-configuration + vmx_data = { + "ethernet0.virtualdev" = "e1000e" + "usb_xhci.present" = "true" + } + + // SSH configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#optional-ssh-fields + ssh_username = "vagrant" + ssh_password = "vagrant" + ssh_timeout = var.ssh_timeout + + // Boot configuration + // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#boot-configuration + boot_command = [ + "c", + "linux /install.a64/vmlinuz auto-install/enable=true debconf/priority=critical noprompt url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg --", + "initrd /install.a64/initrd.gz", + "", + "boot", + "" + ] +} + +build { + sources = ["sources.vmware-iso.debian-11"] + + provisioner "shell" { + scripts = [ + "scripts/post-install.sh" + ] + } +} diff --git a/debian-11/metadata.json b/debian-11/metadata.json new file mode 100644 index 0000000..121f0fc --- /dev/null +++ b/debian-11/metadata.json @@ -0,0 +1,3 @@ +{ + "provider": "vmware_fusion" +} \ No newline at end of file diff --git a/debian-11/scripts/post-install.sh b/debian-11/scripts/post-install.sh new file mode 100644 index 0000000..56b5765 --- /dev/null +++ b/debian-11/scripts/post-install.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Install apt package sources +# https://wiki.debian.org/SourcesList +sudo tee /etc/apt/sources.list > /dev/null <<'EOF' +deb http://deb.debian.org/debian bullseye main +deb-src http://deb.debian.org/debian bullseye main + +deb http://deb.debian.org/debian-security/ bullseye-security main +deb-src http://deb.debian.org/debian-security/ bullseye-security main + +deb http://deb.debian.org/debian bullseye-updates main +deb-src http://deb.debian.org/debian bullseye-updates main +EOF +# Ensure system is up to date +sudo apt-get update && sudo apt-get upgrade -y +# Download open-vm-tools +wget -O open-vm-tools.tgz https://packages.vmware.com/tools/open-vm-tools/ovt-arm-tech-preview/Debian-10/open-vm-tools-11.2.5-2debian10.tgz +tar -xf open-vm-tools.tgz +# Install open-vm-tools +sudo dpkg -i ./open-vm-tools_11.2.5-2debian10_arm64.deb && rm -f open-vm-tools* +sudo apt-get install -f -y +# Configure vagrant SSH key based authentication +mkdir -pv /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh +wget -O /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub +chmod 644 /home/vagrant/.ssh/authorized_keys +# Shrink the disk +sudo dd if=/dev/zero of=/EMPTY bs=1M +sudo rm -f /EMPTY +sync +sudo vmware-toolbox-cmd disk shrink / From 7f638064a3704d8da9905e15b529ee68c4c1f60e Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:11:27 +0100 Subject: [PATCH 36/44] fix: HGFS setup --- debian-11/scripts/post-install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian-11/scripts/post-install.sh b/debian-11/scripts/post-install.sh index 56b5765..308f189 100644 --- a/debian-11/scripts/post-install.sh +++ b/debian-11/scripts/post-install.sh @@ -19,7 +19,11 @@ wget -O open-vm-tools.tgz https://packages.vmware.com/tools/open-vm-tools/ovt-ar tar -xf open-vm-tools.tgz # Install open-vm-tools sudo dpkg -i ./open-vm-tools_11.2.5-2debian10_arm64.deb && rm -f open-vm-tools* -sudo apt-get install -f -y +sudo apt-get install -f -y && sudo apt-get clean +# Setup HGFS for VMware Tools Shared Folders Linux mounts +# https://kb.vmware.com/s/article/60262 +sudo mkdir -pv /mnt/hgfs/ +sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs/ -o subtype=vmhgfs-fuse,allow_other # Configure vagrant SSH key based authentication mkdir -pv /home/vagrant/.ssh chmod 700 /home/vagrant/.ssh From d4ba958ae93f1b1283777e335b312ca8b1acf14d Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:14:51 +0100 Subject: [PATCH 37/44] docs(refactor): add debian 11 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00217ec..c5b9b69 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho | Distro | Version | Provider | Source | | --------------- | ------- | ------------- | ----------------------------- | -| CentOS 9 Stream | 9 | VMware Fusion | [Source](centos-9) | +| CentOS Stream | 9 | VMware Fusion | [Source](centos-9) | | Ubuntu Server | 22.04.2 | VMware Fusion | [Source](ubuntu-server-22.04) | +| Debian | 11 | VMware Fusion | [Source](debian-11) | ## Dependencies From bbe7166883eeab833940ab25d2fd7ae211de132e Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:05:53 +0100 Subject: [PATCH 38/44] fix: add missing package `fuse` --- debian-11/data/preseed.cfg.pkrtpl.hcl | 2 +- debian-11/scripts/post-install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian-11/data/preseed.cfg.pkrtpl.hcl b/debian-11/data/preseed.cfg.pkrtpl.hcl index 34fd34a..2e4dc65 100644 --- a/debian-11/data/preseed.cfg.pkrtpl.hcl +++ b/debian-11/data/preseed.cfg.pkrtpl.hcl @@ -218,7 +218,7 @@ tasksel tasksel/first multiselect standard #tasksel tasksel/first multiselect standard, kde-desktop # Individual additional packages to install -d-i pkgsel/include string openssh-server sudo +d-i pkgsel/include string openssh-server sudo fuse # Some versions of the installer can report back on what software you have # installed, and what software you use. The default is not to report back, diff --git a/debian-11/scripts/post-install.sh b/debian-11/scripts/post-install.sh index 308f189..f5aa402 100644 --- a/debian-11/scripts/post-install.sh +++ b/debian-11/scripts/post-install.sh @@ -23,7 +23,7 @@ sudo apt-get install -f -y && sudo apt-get clean # Setup HGFS for VMware Tools Shared Folders Linux mounts # https://kb.vmware.com/s/article/60262 sudo mkdir -pv /mnt/hgfs/ -sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs/ -o subtype=vmhgfs-fuse,allow_other +sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other # Configure vagrant SSH key based authentication mkdir -pv /home/vagrant/.ssh chmod 700 /home/vagrant/.ssh From 961c0ea95b69456a687631c166e06fa312fa1cbe Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:19:33 +0100 Subject: [PATCH 39/44] docs(refactor): VMware Fusion link for registering for personal license --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c5b9b69..1349878 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho ## Supported Boxes -| Distro | Version | Provider | Source | -| --------------- | ------- | ------------- | ----------------------------- | -| CentOS Stream | 9 | VMware Fusion | [Source](centos-9) | -| Ubuntu Server | 22.04.2 | VMware Fusion | [Source](ubuntu-server-22.04) | -| Debian | 11 | VMware Fusion | [Source](debian-11) | +| Distro | Version | Provider | Source | +| ------------- | ------- | ------------- | ----------------------------- | +| CentOS Stream | 9 | VMware Fusion | [Source](centos-9) | +| Ubuntu Server | 22.04.2 | VMware Fusion | [Source](ubuntu-server-22.04) | +| Debian | 11 | VMware Fusion | [Source](debian-11) | ## Dependencies @@ -30,7 +30,7 @@ This repository contains Packer files for building Vagrant base boxes for ARM ho brew install --cask vagrant ``` -- [VMware Fusion](https://www.vmware.com/products/fusion.html) +- [VMware Fusion](https://customerconnect.vmware.com/en/evalcenter?p=fusion-player-personal-13) - [Vagrant VMware Utility](https://formulae.brew.sh/cask/vagrant-vmware-utility): ```bash From 49cfe0b38defd7420e40ddfaa7a86959a97d5bcf Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:20:44 +0100 Subject: [PATCH 40/44] docs(refactor): specifically VMware Fusion --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1349878..5283b31 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # arm-base-boxes -Vagrant base boxes for ARM hosts (e.g., Apple Silicon M1). +VMware Fusion Vagrant base boxes for ARM hosts (e.g., Apple Silicon M1). -This repository contains Packer files for building Vagrant base boxes for ARM hosts. +This repository contains Packer files for building VMware Fusion based Vagrant base boxes for ARM hosts. 🚨 These Vagrant boxes should not be used for production workloads - use them at your own risk! 🚨 From d9ca79b18af7fc97fb7f0b5a7cb63c52fb40b396 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:28:08 +0100 Subject: [PATCH 41/44] refactor: add quotes --- centos-9/buildbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centos-9/buildbox.sh b/centos-9/buildbox.sh index 7f2062d..c4ce29e 100755 --- a/centos-9/buildbox.sh +++ b/centos-9/buildbox.sh @@ -13,4 +13,4 @@ shasum -a 256 $BOX_NAME # Clean up rm -f *.v* *.nvram *.log *.scoreboard *.plist metadata.json # Add the box to Vagrant -vagrant box add --force --name centos9-arm64 $BOX_NAME +vagrant box add --force --name "centos9-arm64" $BOX_NAME From 6494bfdc29085a7a4ccd7729051a616b1f4d007a Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:28:22 +0100 Subject: [PATCH 42/44] fix: iso URLs --- debian-11/debian11.auto.pkr.hcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian-11/debian11.auto.pkr.hcl b/debian-11/debian11.auto.pkr.hcl index a3768c5..3b3dde7 100644 --- a/debian-11/debian11.auto.pkr.hcl +++ b/debian-11/debian11.auto.pkr.hcl @@ -65,12 +65,12 @@ variable "disk_type_id" { variable "iso_checksum" { type = string description = "ISO checksum" - default = "file:http://cdimage.debian.org/debian-cd/current/arm64/iso-cd/SHA256SUMS" + default = "file:https://cdimage.debian.org/mirror/cdimage/archive/11.6.0/arm64/iso-cd/SHA256SUMS" } variable "iso_url" { type = string - default = "http://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-11.6.0-arm64-netinst.iso" + default = "https://cdimage.debian.org/mirror/cdimage/archive/11.6.0/arm64/iso-cd/debian-11.6.0-arm64-netinst.iso" } // https://developer.hashicorp.com/packer/plugins/builders/vmware/iso#hardware-configuration From be3256093f6a04f46e4c5ed5e01b2f51a329e226 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:33:33 +0100 Subject: [PATCH 43/44] chore: update license year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index b9fe5cf..00accd7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Adam Hartley +Copyright (c) 2023 Adam Hartley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ac791fe2396bfb8634d40ecd96cd70d14baf1761 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:33:41 +0100 Subject: [PATCH 44/44] docs: add LICENSE --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5283b31..a90ab38 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,7 @@ This repository contains Packer files for building VMware Fusion based Vagrant b ``` Enjoy! ✨🚀 + +## License + +[MIT](LICENSE)