packer-chef-highperf-centos-ami
packer-chef-highperf-centos-ami copied to clipboard
initial CentOS 8 AMI support
I've got a CentOS 8 base AMI that appears to work:
us-east-1: ami-01b3337aae1959300
us-west-2: ami-0b9dbd3ea9899c3e5
Please give it a shot and let me know what does/doesn't work for you (note this is just the base AMI, not the highperf AMI as we don't all know what needs to be tuned yet :)
TODO:
- [ ] CentOS 8 Stream base image
- [ ] 8/Stream "highperf" images with parity to the CentOS 7 images
- [ ] maybe rename this project to remove the 7?
Signed-off-by: Irving Popovetsky [email protected]
Thanks @irvingpop for making this available. We (@pdurbin and @donsizemore mostly) are giving it a shot at https://github.com/IQSS/dataverse-ansible/.
Thanks @irvingpop for making this available. We (@pdurbin and @donsizemore mostly) are giving it a shot at https://github.com/IQSS/dataverse-ansible/.
Awesome!! Thank you for the kind words @djbrooke !!
Pretty cool. I'm sure I'll be using this when I get to checking out support for CentOS 8 for the application I work with!
Some of the differences between create_base_ami.sh and create_base_ami8.sh appear to be arbitrary. Could you either explain with comments in the scripts why there are differences, or make them the same to reduce the diff between the script, which would make maintenance easier?
Differences that stand out to me at first glance are:
- cloud_*_modules
- Excludes in Minimal Install
Maybe you can also use $release_pkg_url in the old script, and set that at the same place as where you set it in create_base_ami8.sh?
hi @siebrand this is just my initial working proof-of-concept, I definitely am looking for feedback and other examples to collaborate with!
In terms of the cloud_*_modules, I simply copied an updated cloud-init config from the Cent8 package.
For the excludes, the many packages had changed and so I had to remove the ones that either didn't exist or broke the install which got me down to a very short list. We can work our way back up, I haven't had a ton of time to investigate yet.
I was able to re-create the CentOS 8 base image with the scripts provided. Pretty cool that you figured out how to create a base image without having to do things manually. That's something I would encourage you to commit to the main tree anyway already, i.e. split up this patch set, and merge without the new CentOS 8 parts.
I got this working with A1 and M6G instance types but I had to set up an EFI partition. I had a difficult time finding any documentation online, so I loaded up the RHEL8 AMI and did a bit of comparison. These are the important bits for making an ARM AMI (I am excluding a lot from this repo, but this is what one would need to fill in the gaps):
ROOTFS=/rootfs
DEVICE="/dev/nvme1n1"
parted --script "$DEVICE" -- \
mklabel gpt \
mkpart primary fat32 1 201MiB \
mkpart primary xfs 201MiB 713MiB \
mkpart primary xfs 713MiB -1 \
set 1 esp on
rpm -q expect || yum -y install expect
# I was unable to set the partition labels to contain spaces or be empty in `parted --script`
env DEVICE="$DEVICE" expect <<'EOS'
set device $env(DEVICE)
spawn parted "$device"
expect "(parted) "
send "name 1 'EFI System Partition'\r"
expect "(parted) "
send "name 2\r"
expect "Partition name? "
send "''\r"
expect "(parted) "
send "name 3\r"
expect "Partition name? "
send "''\r"
expect eof
EOS
mkfs.xfs -f "${DEVICE}p3"
mkdir -p "$ROOTFS"
mount "${DEVICE}p3" "$ROOTFS"
mkfs.xfs -f "${DEVICE}p2"
mkdir -p "$ROOTFS/boot"
mount "${DEVICE}p2" "$ROOTFS/boot"
mkfs.fat -F 16 "${DEVICE}p1"
mkdir -p "$ROOTFS/boot/efi"
mount "${DEVICE}p1" "$ROOTFS/boot/efi"
cat > "${ROOTFS}/etc/fstab" <<EOF
UUID=$( lsblk "${DEVICE}p3" --noheadings --output uuid ) / xfs defaults 0 0
UUID=$( lsblk "${DEVICE}p2" --noheadings --output uuid ) /boot xfs defaults 0 0
UUID=$( lsblk "${DEVICE}p1" --noheadings --output uuid ) /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
EOF
yum --installroot="$ROOTFS" --nogpgcheck -y install kernel efibootmgr grub2-efi grub2-tools-extra shim
chroot "$ROOTFS" grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Once the entire system is mounted at /rootfs, with /, /boot, /boot/efi, and the various bind and tmp mounts, the last two steps will set up the BLS stuff. While virtually no AWS documentation discusses EFI that I could find, I did find https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-recover-blscfg-file/ helpful in getting the kernel bootable, and relying on the post-install scripts for the kernel RPM to do most of the heavy lifting.
hi @irvingpop any plans on finishing this up? /cc @mabunixda