Our Authentication & Quality Assurance Procedure For Creating Ubuntu Installation Media

The following procedures are followed in the production of Ubuntu flash drive installation media:

# Open a terminal and create directory in Downloads folder

cd Downloads
mkdir ubuntu
cd ubuntu

# Download the latest release of Ubuntu

wget https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso

2023-02-13 15:42:17 (20.7 MB/s) - ‘ubuntu-22.04.1-desktop-amd64.iso’ saved [3826831360/3826831360]

# Download SHA256SUMS and SHA256SUMS.gpg

wget https://releases.ubuntu.com/22.04.1/SHA256SUMS

2023-02-13 15:42:44 (74.7 MB/s) - ‘SHA256SUMS’ saved [202/202]

wget https://releases.ubuntu.com/22.04.1/SHA256SUMS.gpg

2023-02-13 15:43:03 (277 MB/s) - ‘SHA256SUMS.gpg’ saved [833/833]

# Perform an integrity check on the downloaded image

sha256sum -b ubuntu-22.04.1-desktop-amd64.iso

c396e956a9f52c418397867d1ea5c0cf1a99a49dcf648b086d2fb762330cc88d *ubuntu-22.04.1-desktop-amd64.iso

# Compare the above output against the content of SHA256SUMS, the outputs should match

cat SHA256SUMS

c396e956a9f52c418397867d1ea5c0cf1a99a49dcf648b086d2fb762330cc88d *ubuntu-22.04.1-desktop-amd64.iso
10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb *ubuntu-22.04.1-live-server-amd64.iso

# Import the Ubuntu signing key

gpg --keyid-format long --keyserver hkp://keyserver.ubuntu.com --recv-keys 0x46181433FBB75451 0xD94AA3F0EFE21092

gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) " imported
gpg: key 46181433FBB75451: public key "Ubuntu CD Image Automatic Signing Key " imported
gpg: Total number processed: 2
gpg: imported: 2

# Verify the authenticity of SHA256SUMS: The output of the below command should tell you that the file signature is
# "good signature" and that it was signed with the D94AA3F0EFE21092 key. If you see a warning about not being certified
# with a trusted signature this is normal, and generally not a concern

gpg --keyid-format long --verify SHA256SUMS.gpg SHA256SUMS

gpg: Signature made Thu 11 Aug 2022 07:07:33 AM EDT
gpg: using RSA key 843938DF228D22F7B3742BC0D94AA3F0EFE21092
gpg: Good signature from "Ubuntu CD Image Automatic Signing Key (2012) " [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092

# Plug in a USB flash drive and unmount any auto-mounted partitions to ensure reliability of written image
# At a minimum make sure the size of the flash drive matches what you inserted to avoid accidentally
# overwriting important data

sudo fdisk -l

Disk /dev/sda: 59.75 GiB, 64160400896 bytes, 125313283 sectors
Disk model: Flash Drive
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 07896644-3E61-4841-B41A-CA3F44823CCE

Device Start End Sectors Size Type
/dev/sda1 64 5228883 5228820 2.5G Microsoft basic data
/dev/sda2 5228884 5237379 8496 4.1M EFI System
/dev/sda3 5238784 125313219 120074436 57.3G Linux filesystem

# So we're going to run the follow commands as the flash drive above we are using has mounted partitions

sudo umount /dev/sda1
sudo umount /dev/sda2
sudo umount /dev/sda3

# Write the Ubuntu ISO image to disk

sudo dd if=ubuntu-22.04.1-desktop-amd64.iso of=/dev/sda bs=16M oflag=direct status=progress

228+1 records in
228+1 records out
3826831360 bytes (3.8 GB, 3.6 GiB) copied, 108.527 s, 35.3 MB/s

# Run the sync command to flush any data to disk and make sure it's written

sync

# Identify the size of the ISO image using the stat command

stat -c '%s' ubuntu-22.04.1-desktop-amd64.iso

3826831360

# Along with the above number output use the head command to check the portion of the disk we've written
# the ISO to Prior to running this command it isn't a bad idea to unplug the USB drive and connect it again

sudo head -c 3826831360 /dev/sda | sha256sum

# Make sure the output above matches what is in the sha256sum.txt file we downloaded earlier

cat SHA256SUMS

c396e956a9f52c418397867d1ea5c0cf1a99a49dcf648b086d2fb762330cc88d *ubuntu-22.04.1-desktop-amd64.iso
10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb *ubuntu-22.04.1-live-server-amd64.iso

# In this case the above matches so we can conclude that the ISO image is fully and properly written to disk