#!/bin/sh [ "$(id -un)" = "root" ] || { echo "User must be root"; exit 1; } : "${DEVICE:?DEVICE must be set}" exit # Dont run as script # Use virt-manager for spinning up a virtual machine. Do this without the # assistance of an LLM. This defeats the purpose entirely. If you decide to get # help from an LLM, just skip this exercise instead as it will be of no use. # Reference: # - https://wiki.archlinux.org/title/Installation_guide # Some usefull commands: # - lsblk # - fdisk -l # - mkfs.* (ext4 in our case) # What is a qcow2 file? # Where are qcow2 files stored by default? # How would you share your qcow2 file with someone? # First, set the keymap (temporary) loadkeys sv-latin1 # For sshd: # Figure out where the config for sshd is located # Edit it, make sure 'PermitRootLogin' is set to yes, and is uncommented # Figure out how to reload the sshd daemon with the new config (hint: systemctl) # Figure out what your local ip is # We dont want efi boot, if /sys/firmware/efi exists, this means we have booted # in efi mode # ls /sys/firmware/efi && echo "ERROR: Booted in UEFI" && exit 1 [ -d /sys/firmware/efi ] || { echo "ERROR: Booted in UEFI"; exit 1; } # Often /dev/vda in a kvm machine # What are disk partitions? What are block devices? # ${DEVICE}1 -> /boot (512M) # ${DEVICE}2 -> / fdisk ${DEVICE} # o # n p 1 +512M # n p 2 # a 1 # w # Check with # fdisk -l # lsblk # Format the new partition with the ext4 file system mkfs.ext4 ${DEVICE}1 mkfs.ext4 ${DEVICE}2 # What does mounting mean? mount ${DEVICE}2 /mnt mkdir /mnt/boot mount ${DEVICE}1 /mnt/boot # What does pacstrap do? What are all those packages? # This command does a lot of the heavy lifting pacstrap /mnt base linux linux-firmware grub # What is fstab? Why do we need it? genfstab -U /mnt >> /mnt/etc/fstab # Inspect it,see what the new fstab looks like # Everything from now on is in chroot # What is a chroot? arch-chroot /mnt ln -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime hwclock --systohc # Or timedatectl echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "LANG=en_US.UTF-8" > /etc/locale.conf locale-gen echo "KEYMAP=sv-latin1" > /etc/vconsole.conf # What is /etc/hostname? # What is /etc/hosts? echo "arch" > /etc/hostname cat < /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 archbox.local arch EOF # Set the root password for the chroot passwd root # Generate our initramfs mkinitcpio -P # Like dracut -f in fedora # What is grub? Why do we specify a device here? What is actually installed? grub-install ${DEVICE} grub-mkconfig -o /boot/grub/grub.cfg # What is DHCP? pacman -S dhcpcd # What is systemctl? systemctl enable dhcpcd # What is openssh? pacman -S openssh # What is sshd? systemctl enable sshd exit # Exit the chroot # What does umount do? umount -R /mnt # Not strictly necessary # Our disk now contains a fully-featured linux system # Virt-namager will remove our boot iso, and boot into our new system reboot # We used ext4 for both root and boot partitions. What other filesystems are available in linux? # Why did we use two partitions? What other partitions are common? # We did not use a swap partition. What is a swap partition? # Fedora does not use a swap partition. What does it use instead, and how does it differ?