Format the micro sd card with two FAT32 partitions.
I use FAT32 as the root partition as Mac does not support ext4, but we reformat that partition later anyway. This just means it sets up the partition table correctly.
diskutil partitionDisk disk2 MBR \
"MS-DOS FAT32" RPIBOOT 256MB \
"MS-DOS FAT32" RPIROOT R- Uncompress the Alpine tar.gz contents directly in to the boot partition by running:
cd /Volumes/RPIBOOT
tar -xzf ~/Downloads/alpine.tar.gz- Eject the sd card
- Move the sd card in to the RPI
- Turn on the PI
- Login as root. No password is required.
- Run setup-alpine
- Select the keyboard layout: gb
- Select the keyboard variant: gb-extd
- Enter hostname. e.g. pimaster
- Choose eth0 as the network interface
- Choose dhcp sa the IP address
- Skip setup of the wifi interface by entering "done"
- Skip manual configuration by entering "n"
- Enter a new root password
- Confirm the new root password
- Enter the timezone: Europe/London
- Select none as http/ftp proxy
- Accept chrony as the ntp client
- Enter 1 (dl-cdn.alpinelinux.org) as the mirror server
- Accept openssh as the SSH server
- Accept none as disk to use
- Accept the sd card as location to store configs
- Accept the sd card as the apk cache directory
- Run
apk add e2fsprogs dosfstools vim
lbu commid -d
reboot- Login as root, using the new password used during installation
- Run
# Prepare the root disk
mkfs.ext4 /dev/mmcblk0p2
# Prepare the root mount
mkdir /stage
mount /dev/mmcblk0p2 /stage
# Prepare the boot mount
mkdir /stage/boot
mount -o remount,rw /meda/mmcblk0p1
mount --bind /media/mmcblk0p1 /stage/boot
# Install Alpine to the root disk
setup-disk -o /media/mmcblk0p1/$(hostname).apkovl.tar.gz /stage
# [optional] Remove unnecessary devices from fstab on new disk
sed -i '/cdrom/d' /stage/etc/fstab
sed -i '/usbdisk/d' /stage/etc/fstab
sed -i '/floppy/d' /stage/etc/fstab
reboot- Format the micro sd card with a single FAT32 partition, labelling it RPIBOOT.
As we'll be using a separate mSATA drive over USB, the entire sd card is used for boot and thus only a single partition is formatted.
diskutil partitionDisk disk2 MBR \
"MS-DOS FAT32" RPIBOOT R- Uncompress the Alpine tar.gz contents directly in to the partition by running:
cd /Volumes/RPIBOOT
tar -xzf ~/Downloads/alpine.tar.gz- Eject the sd card
- Move the sd card in to the RPI
- Turn on the PI
- Login as root. No password is required.
- Run setup-alpine
- Select the keyboard layout: gb
- Select the keyboard variant: gb-extd
- Enter hostname. e.g. pi1
- Choose eth0 as the network interface
- Choose dhcp sa the IP address
- Skip setup of the wifi interface by entering "done"
- Skip manual configuration by entering "n"
- Enter a new root password
- Confirm the new root password
- Enter the timezone: Europe/London
- Select none as http/ftp proxy
- Accept chrony as the ntp client
- Enter 1 (dl-cdn.alpinelinux.org) as the mirror server
- Accept openssh as the SSH server
- Accept none as disk to use
- Accept the sd card as location to store configs
- Accept the sd card as the apk cache directory
- Run
apk add e2fsprogs dosfstools vim
lbu commid -d
reboot- Login as root, using the new password used during installation
- If no partition table has been created for the mSATA drive, run:
fdisk /dev/sda1. Type n
2. Type p
3. Type 1
4. Accept the start position
5. Accept the end position
6. Type w
- Run
# Prepare the root disk
mkfs.ext4 /dev/sda1
# Prepare the root mount
mkdir /stage
mount /dev/sda1 /stage
# Prepare the boot mount
mkdir /stage/boot
mount -o remount,rw /meda/mmcblk0p1
mount --bind /media/mmcblk0p1 /stage/boot
# Install Alpine to the root disk
setup-disk -o /media/mmcblk0p1/$(hostname).apkovl.tar.gz /stage
# [optional] Remove unnecessary devices from fstab on new disk
sed -i '/cdrom/d' /stage/etc/fstab
sed -i '/usbdisk/d' /stage/etc/fstab
sed -i '/floppy/d' /stage/etc/fstab
reboot- Run
# Remove the local apk repository setup during diskless install
sed -i '/mmcblk0p1/d' /etc/apk/repositories
# Cleanup the boot partition of files no longer required
rm -rf /boot/apks /boot/cache /boot/boot /boot/overlays /boot/*.apkovl.tar.gz
# Setup an admin user with sudo access
apk add sudo
adduser -g "<Users name>" -G wheel <username>
# Add Python (for running Ansible)
apk add python3- Run visudo and uncomment the line:
%wheel ALL=(ALL) NOPASSWD: ALL
- Run
apk update
apk upgrade
rebootCreate the inventory file
cp hosts.ini.example hosts.iniModify the hosts.ini file, listing hosts that should be managed.
ansible-playbook --limit workers master.yml