Skip to content

Instantly share code, notes, and snippets.

@shift
Last active May 16, 2019 11:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shift/25aa5209e74fc5ad698e9ef8585a3508 to your computer and use it in GitHub Desktop.
Save shift/25aa5209e74fc5ad698e9ef8585a3508 to your computer and use it in GitHub Desktop.
ArchLinux for Dell XPS 13 9370 4K 16GB/512GB NVME
# This assumes a wifi only system...
wifi-menu
# Grab latest mirror list for Germany sorted by speed IPv4 only.
curl -o /etc/pacman.d/mirrorlist https://www.archlinux.org/mirrorlist/?country=DE&protocol=https&ip_version=4&use_mirror_status=on
sed -i 's/\#Server/Server/g' /etc/pacman.d/mirrorlist
# Create partitions
cgdisk /dev/nvme0n1
1 512MB EFI partition # Hex code ef00
2 512MB Boot partition # Hex code 8300
3 100% size partiton # (to be encrypted) Hex code 8300
mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext2 /dev/nvme0n1p2
# Setup the encryption of the system
cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/nvme0n1p3
cryptsetup luksOpen /dev/nvme0n1p3 luks
# Create encrypted partitions
# This creates one partions for root, modify if /home or other partitions should be on separate partitions
pvcreate /dev/mapper/luks
vgcreate vg0 /dev/mapper/luks
lvcreate --size 16G vg0 --name swap
lvcreate --size 256G vg0 --name root
lvcreate -l +100%FREE vg0 --name home
# Create filesystems on encrypted partitions
mkfs.ext4 /dev/mapper/vg0-root
mkfs.ext4 /dev/mapper/vg0-home
mkswap /dev/mapper/vg0-swap
# Mount the new system
mount /dev/mapper/vg0-root /mnt # /mnt is the installed system
swapon /dev/mapper/vg0-swap # Not needed but a good thing to test
mkdir /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
mkdir /mnt/home
mount /dev/mapper/vg0-home /mnt/home
# 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 zsh vim git efibootmgr dialog wpa_supplicant
# '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/Europe/Berlin /etc/localtime
hwclock --systohc --utc
# Set the hostname
echo arch001 > /etc/hostname
# Update locale
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
echo en_US ISO-8859-1 >> /etc/locale.gen
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
echo LC_ALL=C >> /etc/locale.conf
# 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 MYUSERNAME
# Edit /etc/suders uncomment
# %wheel ALL=(ALL) ALL
su - USERNAME
# Install yaourt
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si
cd ..
# Install plymouth
yaourt -S plymouth
exit
# Configure mkinitcpio with modules needed for the initrd image
vim /etc/mkinitcpio.conf
# MODULES=(ext4 i915)
# HOOKS=(base udev plymouth autodetect modconf block plymouth-encrypt lvm2 resume filesystems keyboard fsck)
# Regenerate initrd image
mkinitcpio -p linux
# systemd-boot
bootctl --path=/boot/efi install
# Create boot entry
# Grab UUID for LUKS partition with:
# echo $(blkid | grep nvme0n1p3 | cut -d '"' -f 2)
# Replace <<UUID_HERE>> below with output
cat <<EOF
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=<<UUID_HERE>>:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root mem_sleep_default=deep rw quiet splash
EOF > /boot/efi/loader/entries/arch.conf
cat <<EOF
default arch
timeout 0
editor 0
EOF > /boot/efi/loader/loader.conf
cat <<EOF
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Updating systemd-boot...
When = PostTransaction
Exec = /usr/bin/bootctl --path=/boot/efi update
EOF > /etc/pacman.d/hooks/systemd-boot.hook
# 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