Last active
September 10, 2017 13:16
-
-
Save rkage/7057de494849352df11438f0eaade4db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install ARCH Linux with UEFI and (optionally) encrypted file-system | |
| # The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
| # Integrate tips from here https://eatpeppershothot.blogspot.ca/2016/12/kernel-boot-parameters-for-grub-and.html | |
| # Create GPT disk label and create partitions | |
| parted --script /dev/sdX \ | |
| mklabel gpt \ | |
| mkpart ESP fat32 1MiB 100MiB \ | |
| set 1 boot on \ | |
| name 1 EFI \ | |
| mkpart primary 100MiB 100% \ | |
| name 2 ArchLinux | |
| # Validate Partitions | |
| parted /dev/sdX print | |
| # Make ESP filesystem | |
| mkfs.vfat -F32 /dev/sdX1 | |
| # Optional - Encryption Setup for /dev/sdX2 for LVM on LuKS | |
| # Setup the encryption of the system | |
| cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --use-random luksFormat /dev/sdX2 | |
| cryptsetup luksOpen /dev/sdX3 luks | |
| # Create LVM partitions | |
| # This creates one partions for boot and root, modify if /home or other partitions should be on separate partitions | |
| pvcreate /dev/sdX2 | |
| vgcreate rootvg /dev/sdX2 | |
| lvcreate --size 500M rootvg --name boot | |
| lvcreate --size 8G rootvg --name swap | |
| lvcreate -l +100%FREE rootvg --name root | |
| # Create filesystems on encrypted partitions | |
| mkfs.ext2 /dev/mapper/rootvg-boot | |
| mkfs.ext4 /dev/mapper/rootvg-root | |
| mkswap /dev/mapper/rootvg-swap | |
| # Mount the new system | |
| mount /dev/mapper/rootvg-root /mnt | |
| swapon /dev/mapper/rootvg-swap | |
| mkdir /mnt/boot | |
| mount /dev/mapper/rootvg-boot /mnt/boot | |
| mkdir /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 | |
| # 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 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/Canada/Eastern /etc/localtime | |
| hwclock --systohc --utc | |
| # Set the hostname | |
| echo MYHOSTNAME > /etc/hostname | |
| # Update locale | |
| echo LANG=en_CA.UTF-8 >> /etc/locale.conf | |
| echo LANGUAGE=en_CA >> /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 | |
| # 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