Skip to content

Instantly share code, notes, and snippets.

@kevinwright
Last active December 24, 2015 23:49
Show Gist options
  • Select an option

  • Save kevinwright/6882736 to your computer and use it in GitHub Desktop.

Select an option

Save kevinwright/6882736 to your computer and use it in GitHub Desktop.
Arch install script for a minimal BIOS-based (as opposed to EFI) system. Gets as far as the first boot with network configured, and no users or packages installed beyond those necessary to complete the installation.

Phase 0: Enable ssh service

systemctl start sshd
passwd
ip addr

From this point on, SSH into the (dhcp-assigned) IP - it makes it easier to copy/paste

Phase 1: Prepare System

Setup Installation Locale

loadkeys uk
setfont Lat2-Terminus16
sed -i 's/#en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/g' /etc/locale.gen
sed -i 's/en_US.UTF-8 UTF-8/#en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
export LANG=en_GB.UTF-8

Partition & Format

Set up just a boot and root partition, no swap partition, not using LVM Under a VM environment this allows memory to be overprovisioned so the hypervisor can handle swapping. It's also possible to use a swap file or simply not bother with swap at all

sgdisk -o -n 1:0:+512M -n 2:0:0 -c 1:Boot -c 2:Root -p /dev/sda

Format using:

  • fat32 for the boot partion; It's a requirement to EFI, so I'm standardising around this config
  • btrfs for the root; It's stable enough now, fast, and has some nice optimisations for samba 4
mkfs.vfat -F32 /dev/sda1
mkfs.btrfs /dev/sda2

and mount

mount /dev/sda2 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot

Install

pacstrap /mnt base

time passes...

genfstab -U -p /mnt >> /mnt/etc/fstab

Now check the file:

nano /mnt/etc/fstab

Phase 2: Setup System

chroot

arch-chroot /mnt

Locale

Redo locale again. Last time was for the installation environment, this is for the system being installed.

sed -i 's/#en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/g' /etc/locale.gen
sed -i 's/en_US.UTF-8 UTF-8/#en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
export LANG=en_GB.UTF-8
loadkeys uk
setfont Lat2-Terminus16
echo -e "KEYMAP=uk\nFONT=Lat2-Terminus16\n" > /etc/vconsole.conf

timezone

ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
hwclock --systohc --utc

hostname

echo MY_HOST_NAME > /etc/hostname

net (DHCP)

We could just us a minimal DHCP configuration via systemctl enable dhcpd.service, but that solution doesn't seem to play nicely and correctly handle service/mount order at boot time when using netdev for a remote mounted filesystem. Hence the use of netctl:

cd /etc/netctl
cp examples/ethernet-dhcp local-net
nano local-net

Edit to look like this:

Description='Local Network'
Interface=ens32
Connection=ethernet
IP=dhcp
IP6=stateless

Enable it

netctl enable local-net

net (Static IP)

cd /etc/netctl
cp examples/ethernet-static local-net
nano local-net

Make it something like this: (networks and names changed to protect the innocent)

Description='Local Network'
Interface=ens32
Connection=ethernet
IP=static
IP6=stateless
Address=('192.168.69.3/24')
Gateway='192.168.69.1'
DNS=('192.168.69.2')
DNSDomain='my.lan'

Then enable!

netctl enable local-net

init ramdisk

mkinitcpio -p linux

set password

passwd

bootloader

Syslinux and GPT support

pacman -S syslinux
pacman -S gptfdisk
syslinux-install_update -i -a -m

The default syslinux config assumes a swap partition will be used and that root will be on /dev/sda3. Update this to our config with root on /dev/sda2.

sed -i 's:/dev/sda3:/dev/sda2:g' /boot/syslinux/syslinux.cfg

exit

exit
umount /mnt/{boot,home,}
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment