Skip to content

Instantly share code, notes, and snippets.

@Razz

Razz/arch.md Secret

Last active December 22, 2016 02:53
Show Gist options
  • Save Razz/5b93313bc8aba8ea2b5783bdd29a4379 to your computer and use it in GitHub Desktop.
Save Razz/5b93313bc8aba8ea2b5783bdd29a4379 to your computer and use it in GitHub Desktop.
install arch
  • Unlock FileVault
  • Part your Drive

OSX

diskutil list

disutil unmount /dev/diskX

sudo dd if=/path/to/arch.iso of=/dev/rdiskX bs=4M status=progress //Dont forget the r in rdisk

This assumes a wifi only system...

wifi-menu -o

find the device

fisdk -l // We'll assume /dev/sda4, so sub that for yours

make fs

mkfs.ext2 /dev/sda4

Setup the encryption of the system

cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/sda4

cryptsetup luksOpen /dev/sdX3 arch

Create encrypted partitions

pvcreate /dev/mapper/arch

vgcreate arch /dev/mapper/arch

lvcreate --size 1024M arch --name swap

lvcreate --size 500M arch --name boot

lvcreate -l +100%FREE arch --name root

double check everything is mapped

ls /dev/mapper/

Create filesystems on encrypted partitions

mkfs.ext4 /dev/mapper/arch-root -m 1 -L ROOT

mkswap /dev/mapper/arch-swap -L SWAP

Mount the new system

mount /dev/mapper/arch-root /mnt # /mnt is the installed system

mkdir /mnt/boot

mount /dev/mapper/arch-boot /mnt/boot

mkdir /mnt/boot/efi

mount /dev/sda1 /mnt/boot/efi

swapon /dev/mapper/arch-swap # Not needed but a good thing to test

Install the system also includes stuff needed for starting wifi when first booting into the newly installed system Unless vim and zsh are desired these can be removed from the command

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

'install' fstab

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

Make /tmp a ramdisk (add the following line to /mnt/etc/fstab)

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

(Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD))

Enter the new system

arch-chroot /mnt /bin/bash

Setup system clock

ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Set the hostname

echo BUTTBLOOD > /etc/hostname

Update locale

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

###edit /etc/locale.gen and uncomment en_US.UTF-8 locale-gen -a

Set password for root

passwd

Add real user remove -s flag if you don't whish to use zsh

useradd -m -g users -G wheel -s /bin/zsh MYUSERNAME

passwd MYUSERNAM

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

Exit new system and go into the cd shell

exit

Unmount all partitions

umount -R /mnt

swapoff -a

Reboot into the new system, don't forget to remove the cd/usb

reboot

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