Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Created February 14, 2018 00:44
Show Gist options
  • Save waffle2k/6634bbf55ec221f2067eacd2ca3e6f48 to your computer and use it in GitHub Desktop.
Save waffle2k/6634bbf55ec221f2067eacd2ca3e6f48 to your computer and use it in GitHub Desktop.

Installing ARCH linux

https://gist.github.com/broedli/5604637d5855bef68f3e https://gist.github.com/mattiaslundberg/8620837

No fancy things

Setup the network

wifi-menu systemctl start sshd passwd

Login from remote machine

gdisk /dev/sda n , 128 , [ENTER] , +64M , EF00 n , 127 , [ENTER] , +500M, 8300 n , 2 , [ENTER] , +8G , 8200 n , [ENTER] , [ENTER] , [ENTER] , [ENTER]

Create the EFI partition

mkfs.vfat -F32 -n "EFI" /dev/sda128

create the swap

mkswap -L SWAP /dev/sda2 swapon /dev/sda2

Create the outer partition

cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda1

cryptsetup luksOpen /dev/sda1 luks pvcreate /dev/mapper/luks vgcreate vg0 /dev/mapper/luks

lvcreate -l +100%FREE vg0 --name root mkfs.ext4 /dev/mapper/vg0-root

mount /dev/mapper/vg0-root /mnt mkdir /mnt/boot mount /dev/sda127 /mnt/boot mkdir /mnt/boot/efi mount /dev/sda128 /mnt/boot/efi

pacstrap /mnt base base-devel grub-efi-x86_64 zsh vim git efibootmgr dialog wpa_supplicant

genfstab -pU /mnt >> /mnt/etc/fstab

arch-chroot /mnt /bin/bash

Set the hostname

echo MYHOSTNAME > /etc/hostname

Update locale

echo LANG=en_US.UTF-8 >> /etc/locale.conf echo LANGUAGE=en_US >> /etc/locale.conf echo LC_ALL=C >> /etc/locale.conf

Configure mkinitcpio with modules needed for the initrd image

vim /etc/mkinitcpio.conf

Add 'ext4' to MODULES

Add 'encrypt' and 'lvm2' to HOOKS before filesystems

Regenerate initrd image

mkinitcpio -p linux

Setup grub

grub-install In /etc/default/grub edit the line GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdX3:luks:allow-discards" then run: grub-mkconfig -o /boot/grub/grub.cfg

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug

Exit new system and go into the cd shell

exit

Unmount all partitions

umount -R /mnt swapoff -a

---->8---->8---->8---->8---->8---->8---->8

Setting up the btrfs volume instead of LVM/ext4 within LUKS

cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda1

cryptsetup luksOpen /dev/sda1 luks

mkfs.btrfs -KL "Arch Linux" /dev/mapper/luks

mkdir -p /mnt/btrfs-root mount -o ssd,discard,noatime,compress=lzo /dev/mapper/luks /mnt/btrfs-root mkdir -p /mnt/btrfs-root/__snapshot cd /mnt/btrfs-root && btrfs subvolume create __active && cd __active btrfs subvolume create system && btrfs subvolume create home btrfs subvolume create system/rootvol && btrfs subvolume create system/var && btrfs subvolume create system/opt

mkdir -p /mnt/btrfs-active && cd /mnt/btrfs-active mount -o ssd,discard,noatime,compress=lzo,nodev,subvol=__active/system/rootvol /dev/mapper/luks /mnt/btrfs-active mkdir -p /mnt/btrfs-active/{home,opt,var,boot,boot/efi} mount -o ssd,discard,noatime,compress=lzo,nosuid,nodev,subvol=__active/home /dev/mapper/luks /mnt/btrfs-active/home mount -o ssd,discard,noatime,compress=lzo,nosuid,nodev,subvol=__active/system/opt /dev/mapper/luks /mnt/btrfs-active/opt mount -o ssd,discard,noatime,compress=lzo,nosuid,nodev,noexec,subvol=__active/system/var /dev/mapper/luks /mnt/btrfs-active/var

mount /dev/sda127 /mnt/btrfs-active/boot mount /dev/sda128 /mnt/btrfs-active/boot/efi

pacstrap /mnt/btrfs-active base base-devel efibootmgr grub-efi-x86_64 cryptsetup btrfs-progs openssh rsync bash-completion curl wget vim networkmanager

genfstab -pU /mnt/btrfs-active >> /mnt/btrfs-active/etc/fstab

arch-chroot /mnt/btrfs-active /bin/bash

ln -sf /usr/share/zoneinfo/PST8PDT /etc/localtime hwclock --systohc --utc --adjfile /etc/adjtime

sed -i 's/HOOKS="base udev autodetect modconf block filesystems keyboard fsck"/HOOKS="base udev autodetect modconf block keyboard keymap encrypt filesystems btrfs"/g' /etc/mkinitcpio.conf sed -i 's,BINARIES="",BINARIES="/usr/bin/btrfsck",g' /etc/mkinitcpio.conf

mkinitcpio -p linux

mkdir -p /boot/efi && mount /dev/sda128 /boot/efi

edit /etc/default/grub:

GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda1:luks:allow-discards" grub-mkconfig -o /boot/grub/grub.cfg

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment