Skip to content

Instantly share code, notes, and snippets.

@jeffsharpe
Last active November 13, 2015 01:05
Show Gist options
  • Save jeffsharpe/6a0859bb27eef2a3057f to your computer and use it in GitHub Desktop.
Save jeffsharpe/6a0859bb27eef2a3057f to your computer and use it in GitHub Desktop.
Arch Linux Installation Notes - GPT LVM on LUKS (single drive)
### Arch Linux Installation Notes
### GPT LVM on LUKS (single drive)
###
### These are my personal notes to install Arch. Its not a script, but step by step instructions. If using
### please be aware that every step should be considered before applying, to personalize your
### installations appropriately.
###
# installation
# setup networking
ping -c 3 www.google.ca
# eth connections just work or me, so…
wifi-menu # select and log in
ping -c 3 www.google.ca
# now to set up LVM on LUKS, GPT
modprobe dm-mod
# partition the disk
lsblk
gdisk /dev/sda
# I created 3 partitions on the single drive
# /dev/sda1 1007KB BIOS boot partition
# /dev/sda2 500MB linux filesystem
# /dev/sda3 remaining as Linux LVM
# set up single disk encryption (LVM on LUKs)
cryptsetup —verify-passphrase luksFormat /dev/sda3
cryptsetup open —type luks /dev/sda3 lvm
# now set up LVM (on a single disk)
pvcreate /dev/mapper/lvm
vgcreate system /dev/mapper/lvm
lvcreate -L 25G -n root system
lvcreate -L 16G -n swap system
lvcreate -L 25G -n var system
lvcreate -l 100%FREE -n home system
# format the new filesystems
mkfs.ext2 /dev/sda2
mkfs.ext4 /dev/mapper/system-root
mkfs.ext4 /dev/mapper/system-var
mkfs.ext4 /dev/mapper/system-home
mkswap /dev/mapper/system-swap
swapon /dev/mapper/system-swap
# mount the new filesystems
mount /dev/mapper/system-root /mnt
mkdir -p /mnt/boot /mnt/home /mnt/var
mount /dev/mapper/system-home /mnt/home
mount /dev/mapper/system-var /mnt/var
mount /dev/sda2 /mnt/boot
lsblk -f /dev/sda
# now pacstrap the system
# select a close mirror and move to the top of the file, save and close
vim /etc/pacman.d/mirrorlist
pacstrap -i /mnt base base-devel
# generate fstab
genfstab -U -p /mnt/ >> /mnt/etc/fstab
# confirm content
vim /mnt/etc/fstab
# chroot to the new filesystem
arch-chroot /mnt /bin/bash
export PS1="(CHROOT) $PS1"
# setup locales
# uncomment your locale and save
vi /etc/locale.gen
locale-gen
echo LANG=en_CA.UTF-8 > /etc/locale.conf
export LANG=en_CA.UTF-8
# set the tz and clock
ln -fs /usr/share/zoneinfo/Canada/Pacific /etc/localtime
hwclock —systohc —utc
# hostname
echo arod > /etc/hostname
# add ‘arod’ to the beginning of both localhost row aliases
vi /etc/hosts
# setup networking for next boot
pacman -S networkmanager
systemctl enable NetworkManager.service
# disable network services not needed
systemctl disable netctl.service
# create ramdisk
# on the HOOKS=“” line, add ‘encrypt lvm2’ between ‘block’ and ‘filesystems’
# on the MODULES=“” line, add ‘dm-mod’
vi /etc/mkinitcpio.conf
mkinitcpio -p linux
# set root password
passwd
# make sure vim is installed
pacman -S vim
# set up the boot loader
pacman -S grub
grub-install —target=i386-pc —recheck /dev/sda
# edit /etc/default/grub
# add to GRUB_PRELOAD_MODULES=“” at the end, add ‘lvm’
# add to GRUB_CMDLINE_LINUX=“” with ‘cryptdevice=/dev/sda3:system:allow-discards’
vim /etc/default/grub
# ignore any connection warnings
grub-mkconfig -o /boot/grub/grub.cfg
# exit and unmount and reboot
exit
umount -R /mnt
reboot
# remove your USB or CD
# fingers crossed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment