Official guide without modifications for my own requirements.
- Hostname: LAB-UXC0001
- RAM: 1GiB
- Storage: x1 VHDX @ 6GiB
- Network: Hyper-V Network Adapter using DHCP
- Hyper-V Switch: External
- DVD Drive for ISO
- Bootloader: GRUB
- Extra packages in build:
- grub
- efimgr
- networkmanager
- vi
- hyperv
Using the above VM hardware settings, create this VM:
New-VM -Name 'LAB-UXC0001' -MemoryStartupBytes '1073741824' -Generation 2 -NewVHDPath 'X:\Virtualisation\Hyper-V\Clients\LAB-UXC0001\Virtual Hard Disks\New Virtual Hard Disk.vhdx' -NewVHDSizeBytes '6442450944' -SwitchName 'LAB-EXTSWT-01' -Path 'X:\Virtualisation\Hyper-V\Clients\LAB-UXC0001'
# I then create the DVD device and attach the .ISO to the VM:
Add-VMDvdDrive -VMName 'LAB-UXC0001' -ControllerLocation 1 -ControllerNumber 0 -Path 'X:\UNIX\Linux\Arch Linux\System Builds\archlinux-2021.05.01-x86_64.iso'
# I disable dynamic memory, secure boot then reconfigure the boot options::
Set-VM -Name 'LAB-UXC0001' -StaticMemory
$VMDVDDrive = Get-VMDvdDrive -VMName 'LAB-UXC0001'
Set-VMFirmware -VMName 'LAB-UXC0001' -EnableSecureBoot Off -FirstBootDevice $VMDVDDrive
Verify the PGP signatures as per the official instructions
- Boot the OS from the liveCD and select the first boot option:
- This should lead to the default shell:
- Change console keyboard layout:
loadkeys uk
- I am using a UFI capable device so verify efivarfs variables are available:
Note: We will need to also verify the memory size the system is booted with, i.e 64bit.
ls -l /sys/firmware/efi/efivars
cat /sys/firmware/efi/fw_platform_size
- I obtained IP addressing via DHCP so verify this device has connectivity to build the distribution:
ip addr show
- Configure the NTP client to sync from an NTP source and configure the time zone:
timedatectl set-timezone Europe/London
timedatectl set-ntp true
- The partitioning and sizing is based on a 6GiB .VHDX disk. The partitioning Partition the disk as follows:
Disk | Size |
---|---|
/dev/sda | 6GiB |
Device | Partition Table |
---|---|
/dev/sda | GPT |
Partition # | Sectors | Partition Type | Size |
---|---|---|---|
1 | 2048 - 411647 | EFI Filesystem | 200M |
2 | 411648 - 12582878 | Linux Filesystem | 5.8GiB |
- Set the disk partiton table as GPT:
fdisk /dev/sda
: g
- Create the EFI partition:
: n
: 1
# Confirm default start sectors and then for end sectors:
: +200M
# Set the filesystem type to EFI Filesystem:
: t
: 1
- Create the Linux partition:
# Create the next partition and confirm the default start and end sectors:
: n
- Write the changes to disk:
: w
- Format the partitions as follows:
Partition # | File system |
---|---|
1 | FAT32 |
2 | Ext4 |
- Create the EFI file system:
mkfs.fat -F32 /dev/sda1
- Create the Linux ext4 file system:
mkfs.ext4 /dev/sda2
- Mount the file systems we've just created:
- Mount the root partition:
mount /dev/sda2 /mnt
- Create and mount the EFI partition
# Create the directory:
mkdir /mnt/boot
# Mount the partition:
mount /dev/sda1 /mnt/boot
- Now install the distribution to the /mnt directory:
# synchronise databases
pacman -Syy
# Install Arch Linux:
pacstrap /mnt linux linux-firmware base
- Create the fstab file and update the file with the file systems configured:
genfstab -U /mnt >> /mnt/etc/fstab
- Change root into the new system:
arch-chroot /mnt
- Update the hardware clock from the system time:
# Create symlink from the zoneinfo location to the /etc/localtime:
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
# Update the hw clock:
hwclock --systohc
- Allocate the swap file space, set the permissions and create the swap file:
# Allocate the space:
fallocate -l 2GB /swapfile
# Set the permissions to the directory:
chmod 600 /swapfile
# Create the swapfile
mkswap /swapfile
- Enable swapping with the swapfile:
swapon /swapfile
- Install a text editor like vi:
pacman --noconfirm -S vi
- Update fstab with the new swapfile:
vi /etc/fstab
# Add the below line:
/swapfile none swap defaults 0 0
- Generate the correct locale, mine is en_GB.UTF-8 UTF-8:
# Uncomment the locate from /etc/locale.gen:
en_GB.UTF-8 UTF-8
# Generate the locale:
locale-gen
- Create the /etc/locale.conf locale config file and set the variable:
vi /etc/locale.conf
# Add in:
LANG=en_GB.UTF-8
- Update the virtual console config file with the keymaps:
vi /etc/vconsole.conf
# Add in:
KEYMAP=uk
- Update the hosts file:
vi /etc/hosts
# Add in
127.0.0.1 localhost
::1 localhost
127.0.1.1 LAB-UXC0001.localdomain LAB-UXC0001
- Set the hostname of the machine:
vi /etc/hostname
# Add in:
LAB-UXC0001
- Reset the root password:
passwd
- Install and configure the GRUB bootloader:
# Install the grub package:
pacman -S grub efibootmgr --noconfirm
# Install the x86_64 version of GRUB:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# Create the GRUB config file:
grub-mkconfig -o /boot/grub/grub.cfg
- Install Network Manager so that the interface configurations will be brought up once booted into the new system:
# First database sync:
pacman -Sy
# Install networkmanager
pacman -S --noconfirm networkmanager
# Enable daemon at start:
systemctl enable NetworkManager
- Unmount the current partitions:
exit
umount -R /mnt
- Reboot into the new system and discard the liveCD:
reboot
GRUB should be the next presented prompt, followed by the console:
- After first boot, install the integration tools package:
pacman -S --noconfirm hyperv