Skip to content

Instantly share code, notes, and snippets.

@KevCui
Forked from mattiaslundberg/arch-linux-install
Last active September 30, 2017 20:27
Show Gist options
  • Save KevCui/ed75a4faac5c77a61a6f3cbd49ff7f0d to your computer and use it in GitHub Desktop.
Save KevCui/ed75a4faac5c77a61a6f3cbd49ff7f0d to your computer and use it in GitHub Desktop.
Minimal instructions for installing arch linux on an UEFI system
# Install ARCH Linux
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/download/
# Make USB flash installation media https://wiki.archlinux.org/index.php/USB_flash_installation_media
dd bs=4M if=/path/to/archlinux.iso of=/dev/sdX status=progress && sync
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# This assumes a wifi only system...
wifi-menu
# Create partitions
cgdisk /dev/sdX
1 100MB EFI partition # Hex code ef00
2 250MB Boot partition # Hex code 8300
3 100% size partiton # Hex code 8300
mkfs.vfat -F32 /dev/sdX1
mkfs.ext2 /dev/sdX2
mkfs.ext4 /dev/sdX3
# Mount the new system
mount /dev/sdX3 /mnt # /mnt is the installed system
mkdir -p /mnt/boot
mount /dev/sdX2 /mnt/boot
mkdir -p /mnt/boot/efi
mount /dev/sdX1 /mnt/boot/efi
# Install the system also includes stuff needed for starting wifi when first booting into the newly installed system
pacstrap /mnt base base-devel grub-efi-x86_64 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
# Set the hostname
echo MYHOSTNAME > /etc/hostname
# Update locale
# Uncomment en_US.UTF-8 UTF-8 and other needed localizations in /etc/locale.gen, and generate them with:
locale-gen
# Set language
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
# Change keyboard layout
echo "KEYMAP=colemak" > /etc/vconsole.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
# 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
# Not able to boot into arch? If it's an acer laptop, then...
# (Hint from https://askubuntu.com/questions/597213/bootable-device-not-found-after-clean-install-of-ubuntu-14-04-uefi)
# Go to BIOS and make sure:
Security: set supervisor password
Boot - BootMode: UEFI
Boot - SecureBoot: enabled
Security - Select an UEFI file as trusted for executing
Choose HDD0 -> EFI -> <arch> -> grubx64.efi -> name it whatever
Save changes and exit BIOS
Restart laptop
# It's just the beginning of a long journey.
# Take a break and have a :coffee:
# Then work on post-installation to setup favorite configurations...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment