Skip to content

Instantly share code, notes, and snippets.

@b1-88er
Forked from heppu/ARCH_INSTALL.MD
Last active December 20, 2020 23:57
Show Gist options
  • Save b1-88er/c0b6300022331197241d8f9b8396bf80 to your computer and use it in GitHub Desktop.
Save b1-88er/c0b6300022331197241d8f9b8396bf80 to your computer and use it in GitHub Desktop.
Installing Arch with GPT, dm-crypt, LUKS and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
timedatectl set-ntp true

Partition the disk with gdisk

We will create 2 partitions, one for boot partition and one for LUKS encrypted partition

gdisk /dev/nvme0n1
  #o (Create a new empty GUID partition table (GPT))
  #Proceed? Y
  #n (Add a new partition)
  #Partition number 1
  #First sector (default)
  #Last sector +512M
  #Hex code EF00
  #n (Add a new partition)
  #Partition number 2
  #First sector (default)
  #Last sector (press Enter to use remaining disk)
  #Hex code 8300
  #w
  #Y

Format, encrypt and mount partitions

I will create only swap and root partitions, but here you can create home, var and other partitions if you wish.

cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 luks
mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/mapper/luks
mount /dev/mapper/luks /mnt

mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

Install base system

pacman -S arch-install-scripts archlinux-keyring manjaro-keyring
sudo manjaro-architect
# install bspwm full 

Generate fstab

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

If you have SSD change relatime on all non-boot partitions to noatime.

chroot into new system and prepare it

arch-chroot /mnt

echo x270 > /etc/hostname
ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime 
hwclock --systohc
vim /etc/locale.gen  #uncomment en_US.UTF-8
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf 
passwd

useradd -m -G wheel -s /usr/bin/zsh ed
# sudo without password
echo "ed ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# auto login, real protection is at the LUKS partition level
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
sudo cat <<EOF > /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM
EOF

mkinitcpio

bootctl --path=/boot install

Edit /etc/mkinitcpio.conf

MODULES="ext4"
.
.
.
HOOKS="base udev autodetect modconf block keymap encrypt resume filesystems keyboard fsck"

Configure bootloader

  blkid -s PARTUUID -o value /dev/nvme1n1p2 >> /boot/loader/entries/arch.conf

  vim /boot/loader/entries/arch.conf

  title Arch Linux
  linux /vmlinuz-linux
  initrd /intel-ucode.img
  initrd /initramfs-linux.img
  options cryptdevice=PARTUUID=<PARTUUID>:cryptroot root=/dev/mapper/luks rw

Edit /boot/loader/loader.conf

timeout 0
default arch
editor 0

Finish installation and boot to new system

mkinitcpio -p linux
exit
umount -R /mnt
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment