Metal to KDE the Speaksthegeek method (includes encryption and btrfs magic)

Installing ArchLinux bare-metal to KDE

This is how I install Arch #linux, not saying it’s perfect but It “works for me” ™
i may have missed a step if so comment and I can fix it :grin:

Method

download an ISO from Archlinux.org and then make a bootable media with it
after booting from the media.

ping google.com # test the internet is up and working

if not sorry, it’s not an issue I’ve had as I use wired networks where possible. #paranoid

root@archiso ~ # ls /usr/share/kbd/keymaps/**/*.map.gz # list keymaps
root@archiso ~ # loadkeyuk # loads the UK keymap for the keyboard replace with your keymap

#check you’re on an EFI system

root@archiso ~ # ls /sys/firmware/efi/efivars

if there’s a ton of output, then you’re safe to go

root@archiso ~ # cfdisk /dev/sdX #select your disk, replacing X

Partition disk

select GPT

create an EFI partition of 50mb and set the type to EFI

create a boot partition of 2GB. (yes large I know but I also put Arch ISO in there for rescue reasons)

create system partition of either rest of disk

save changes and exit

set up the encryptions

use the same password if you wish. systemd will then automagically unlock all other drives with the same password #protip

root@archiso ~ # cryptsetup luksFormat --type luks1 /dev/sda2
root@archiso ~ # cryptsetup luksFormat /dev/sda3

mount encrypted drives Names aren’t important e.g cryptroot

root@archiso ~ # cryptsetup luksOpen /dev/sda2 cryptboot
root@archiso ~ # cryptsetup luksOpen /dev/sda3 cryptroot

format the efi

root@archiso ~ # mkfs.fat -F32 /dev/sda1

format everything else

root@archiso ~ # mkfs.btrfs -L cryptroot /dev/mapper/cryptroot
root@archiso ~ # mkfs.btrfs -L cryptboot /dev/mapper/cryptboot

mount and configure btrfs subvolumes

root@archiso ~ # mount /dev/mapper/cryptroot /mnt

root@archiso ~ # btrfs subvolume create /mnt/@root
root@archiso ~ # btrfs subvolume create /mnt/@var
root@archiso ~ # btrfs subvolume create /mnt/@home
root@archiso ~ # btrfs subvolume create /mnt/@snapshots

mount the btrfs volumes

root@archiso ~ # umount /mnt
root@archiso ~ # mount -o noatime,compress=lzo,space_cache,subvol=@root /dev/mapper/cryptroot /mnt
root@archiso ~ # mkdir /mnt/{boot,var,home,.snapshots}
root@archiso ~ # mount -o noatime,compress=lzo,space_cache,subvol=@var /dev/mapper/cryptroot /mnt/var
root@archiso ~ # mount -o noatime,compress=lzo,space_cache,subvol=@home /dev/mapper/cryptroot /mnt/home
root@archiso ~ # mount -o noatime,compress=lzo,space_cache,subvol=@snapshots /dev/mapper/cryptroot /mnt/.snapshots

mount everything else

root@archiso ~ # mount /dev/mapper/cryptboot /mnt/boot
root@archiso ~ # mkdir /mnt/boot/efi
root@archiso ~ # mount /dev/sda1 /mnt/boot/efi

pacstrap the system

root@archiso ~ # pacstrap /mnt base linux linux-firmware btrfs-progs networkmanager nano openssh

generate a fstab

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

chroot in to the new system

arch-chroot /mnt

set the time zone and hwclock

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc

edit and configure /etc/locale.gen /etc/locale.conf /etc/vconsole.conf and hostname

nano /etc/locale.gen #uncomment your locale and the en_US.UTF-8 ones

locale-gen

echo “LANG=en_GB.UTF-8” >> /etc/locale.conf # replace en_GB.UTF-8 with your locale

echo “KEYMAP=uk” >> /etc/vconsole.conf # replace uk with your keymap

set up hostname

echo “hostname” > /etc/hostname

Add matching entries to hosts

root@archiso ~ # nano /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 hostname.localdomain hostname

enable network manager for a network on boot.

root@archiso ~ # systemctl enable NetworkManager

#edit and configure mkinitcpio.conf

root@archiso ~ # nano /etc/mkinitcpio.conf

replace HOOKS line with

HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt filesystems fsck)

replace the

BINARIES=()
with
BINARIES=(btrfs cryptsetup)

install and configure grub

root@archiso ~ # pacman -S grub efibootmgr dosfstools
root@archiso ~ # nano /etc/default/grub

uncomment following line

GRUB_ENABLE_CRYPTODISK=y

get the UUID of the drive

root@archiso ~ # blkid /dev/sda3 >> /etc/default/grub

root@archiso ~ # nano /etc/default/grub

find the bottom line and edit the uuid and then cut and paste into the top of the file

so it looks like this your UUID will be different

GRUB_CMDLINE_LINUX=“rd.luks.name=0ee6e6ab-de57-47a7-b6f7-2a94f35f8bd8=cryptroot”

root@archiso ~ # grub-install
root@archiso ~ # grub-mkconfig -o /boot/grub/grub.cfg

configure the encrypted boot

root@archiso ~ # blkid /dev/sda2 >> /etc/crypttab

edit to look something like

cryptboot UUID=32432-4234-3290-43290-4382 none

set root password

root@archiso ~ # passwd

exit chroot and reboot

root@archiso ~ # exit
root@archiso ~ # umount -R /mnt

reboot & login and install Xorg and plasma

root@archiso ~ # pacman -Syu xorg-server plasma kde-applications sddm firefox

root@archiso ~ # pacman -Syu intel-ucode or amd-ucode
root@archiso ~ # systemctl enable --now cronie
root@archiso ~ # systemctl enable --now sshd # if you wanted sshd running

add a user e.g. thaddeus

root@archiso ~ # useradd thaddeus
root@archiso ~ # passwd thaddeus
root@archiso ~ # mkdir /home/thaddeus
root@archiso ~ # chown thaddeus:thaddeus -Rfv /home/thaddeus

reboot and login as your user

su - # root password here

root@archiso ~ # nano /etc/sudoers

edit the line

%root ALL=(ALL) ALL

to look like this but your user

%thaddeus ALL=(ALL) ALL

exit root back your user

next install trizen for aur packages

thaddeus@archiso ~ # git clone https://aur.archlinux.org/trizen.git
thaddeus@archiso ~ # cd trizen
thaddeus@archiso ~ # makepkg -si

Swap file - rather than a static one I like a automagical one that grows and srinks as required

thaddeus@archiso ~ # sudo su
root@archiso ~ # mkdir /home/swap
root@archiso ~ # chattr +C /home/swap/

edit /etc/systemd/swap.conf to suit your need but edit the location to /home/swap

swapfc_enabled=1
swapfc_path=/var/lib/systemd-swap/swapfc/
to
swapfc_path=/home/swap/

root@archiso ~ # systemctl enable --now systemd-swap

Now we can install and configure the btrfs magic

root@archiso ~ # trizen -Syu snapper
root@archiso ~ # trizen snap-pac-grub
root@archiso ~ # snapper create-config /

finishing bits

root@archiso ~ # yay grub-imageboot

copy your Archlinux iso to /boot/images

cp Downloads/achlinux.iso /boot/images/
root@archiso ~ # grub-mkconfig -o /boot/grub/grub.cf

root@archiso ~ # systemctl enable sddm

Finished, now go personalise your system.

root@archiso ~ # reboot

and jobs a good 'un

enjoy your new ArchLinux

2 Likes

Damn that’s a detailed guide! Makes me want to edit mine to be (a lot) more clear. Thanks for sharing this!

lol :smiley: no worries

I’m glad it’s clear I was so worried that It was nonsense .

I must’ve brushed right past this. This is absolutely BRILLIANT!

https://aur.archlinux.org/packages/grub-imageboot/ :smiley: is the magic but I think i missed that lol

You guys and UEFI. Im a poor ol man and not bright enough for UEFI. Im still on BIOS…:grin::grin::grin: As much as I seen all the commands to install Arch after what I went through Ill wait a week or so and maybe try it again…on BIOS…:grin:
Oh ya…Me fergot…NON UEFI goes to BIOS install automatic…

I wish I could. I have 2 macbooks that I run Arch on and there’s no way to do I bios install on those. Frustrating to say the least.

1 Like

if i get time (I’ve got a 2yr old daughter) I shall re write it for a bios boot.
I’ve got virtualbox working so shouldn’t be too trickey :slight_smile:

1 Like