Skip to content

Instantly share code, notes, and snippets.

@NickMcSweeney
Last active March 27, 2024 17:35
Show Gist options
  • Save NickMcSweeney/20040dce0374386989e48df5e829c7af to your computer and use it in GitHub Desktop.
Save NickMcSweeney/20040dce0374386989e48df5e829c7af to your computer and use it in GitHub Desktop.
Instructions for setting up fresh Arch linux install

Arch Linux Guide

gpt format, with UEFI boot system and encrypted root

Notes

This will work for SD card instalaition as well as a standard install. To install on an SD card the boot and efi partitions must remain on the main hard drive. Replace /dev/sdX with /dev/mmcblk0 for the root partition using /dev/mmcblk0p1 in place of /dev/sdX3.

Other Resources

Download arch to usb & boot

  • use rufus for writing iso to usb

Connect to wifi

  • wifi-menu

Echo terminal sequences to current terminal

  • setterm -blength 0

Partition Disk

  • List all disk partitions fdisk -l
  • make sure to check disk file type for gpt
  • (Optional) clear disk drive shred --verbose --random-source=/dev/urandom --iterations=3 /dev/sdX
  • Edit disk partition of choice cfdisk /dev/sdX
Partition Size Type Use
/dev/sdX1 256MB EFI System Partition /boot/efi
/dev/sdX2 512MB Linux filesystem /boot
/dev/sdX3 8GB+ Linux filesystem /

Configuring LUKS Encryption

  • load dm-crypt modprobe dm-crypt
  • load dm-mod modprobe dm-mod
  • encrypt root cryptsetup luksFormat -v -s 512 -h sha512 /dev/sdX3
    • ... enter password x2
  • open root as alias (luks_root) cryptsetup open /dev/sdX3 luks_root
  • root now at /dev/mapper/luks_root

Format partitions

  • format /boot/efi mkfs.vfat -n "EFI System Partition" /dev/sdX1
  • format /boot mkfs.ext4 -L boot /dev/sdX2
  • format / (root) mkfs.ext4 -L root /dev/mapper/luks_root

Mount partitions

  • mount root to /mnt mount /dev/mapper/luks_root /mnt
  • create /boot and mount
    • mkdir /mnt/boot
    • mount /dev/sdX2 /mnt/boot
  • create and mount efi partition in /boot
    • mkdir /mnt/boot/efi
    • mount /dev/sdX1 /mnt/boot/efi

Install Arch Linux

  • install to /mnt pacstrap -i /mnt base base-devel efibootmgr grub

Generate fstab file

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

Configure Arch Linux

System info
  • chroot in arch-chroot /mnt
  • set password passwd
  • add real user
    • useradd -m -g users -G wheel MYUSERNAME
    • passwd MYUSERNAME
  • add sudo privaleges group wheel
    • nano /etc/sudoers
    • uncomment %wheel ALL=(ALL) ALL
  • edit local nano /etc/locale.gen
  • remove # from language (en_US.UTF-8)
    • ...save
  • set locale, run:
    • locale-gen
    • echo LANG=YOUR_LOCALE > /etc/locale.conf --> echo LANG=en_US.UTF-8 > /etc/locale.conf
    • export LANG=YOUR_LOCALE --> export LANG=en_US.UTF-8
  • set timezone ln -sf /usr/share/zoneinfo/YOUR_REGION/YOUR_CIT /etc/localtime --> ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
  • set clock hwclock --systohc --utc
  • set hostname echo YOUR_HOSTNAME > /etc/hostname
  • edit hosts nano /etc/hosts
  • add to file:
127.0.0.1   localhost your_hostname
::1         localhost your_hostname
  • ...save

System Configuration

  • update Pacman pacman -Syu
  • install dialog so you can access wifi-menu after booting into OS pacman -S dialog
  • install os-prober and ntfs-3g so grub will automatically identify other OS's on your system wen generating a boot menu
    • pacman -S os-prober ntfs-3g
    • os-prober
  • edit grub nano /etc/default/grub
    • set GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdx3:luks_root"
    • uncomment (#) GRUB_ENABLE_CRYPTODISK=y
    • ..save
  • Now edit /etc/mkinitcpio.conf nano /etc/mkinitcpio.conf
    • add ext4 mmc_core mmc_block sdhci sdhci-pci to MODULES
    • In the HOOKS section, add encrypt and lvm2 after block
    • ...save
  • generate initramfs mkinitcpio -p linux
  • install GRUB grub-install --target=x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi --bootloader-id=ArchLinux
  • generate GRUB configuration grub-mkconfig -o /boot/grub/grub.cfg and grub-mkconfig -o /boot/efi/EFI/ArchLinux/grub.cfg

Close and reboot

  • and then exit exit
  • unmount all umount -R /mnt
  • and reboot reboot

Setup basic OS features

  • log back in as root user
  • connect to internet with wifi-menu
  • Install GUI
    • I like GNOME, so: pacman -S gnome

Optional
  • update repo database & install Pakku
    • get git pacman -S git
    • open to Downloads (or anywere really)
    • run git clone https://aur.archlinux.org/pakku.git
    • open pakku foled cd pakku
    • install pakku makepkg -si
    • you can delete the pakku repo now cd .. and then rm -rf pakku
  • Optional gnome install
    • gnome-extra has a buch of packages I don't like
    • these are individual packages from gnome-extra I do like
    • pacman -S gnome-nettool gnome-tweaks gnome-usage gnome-weather nautilus-sendto pacman-contrib
  • Applications I like to have
    • pacman -S atom gimp vlc libreoffice-fresh firefox thunderbird pidgin

  • Start/enable system applications
    • systemctl enable NetworkManager.service
    • systemctl enable paccache.timer
    • systemctl enable gdm.service
  • restart system with reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment