Forked from mattiaslundberg/arch-linux-install
Last active
February 23, 2019 07:15
-
-
Save jbhanks/4d081679ddbde2f04dab94e8acf46eea to your computer and use it in GitHub Desktop.
My variation on installing Arch
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 encrypted file-system and UEFI | |
| # 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/ | |
| # Copy to a usb-drive | |
| dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
| # Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
| #verify boot mode | |
| ls /sys/firmware/efi/efivars | |
| #set up internet | |
| ping archlinux.org | |
| #update system clock | |
| timedatectl set-ntp true | |
| # parted --align optimal /dev/sda | |
| (parted) mklabel gpt | |
| (parted) mkpart ESP fat32 1MiB 513MiB | |
| (parted) set 1 boot on | |
| (parted) name 1 efi | |
| (parted) mkpart primary 513MiB 800MiB | |
| (parted) name 2 boot | |
| (parted) mkpart primary 800MiB 100% | |
| (parted) name 3 lvm-partition | |
| (parted) print | |
| (parted) quit | |
| parted /dev/sda set 3 lvm on | |
| parted /dev/sda print | |
| pvcreate /dev/sda3 | |
| vgcreate arch-lvm /dev/sda3 | |
| lvcreate -n arch-root -L 50G arch-lvm | |
| lvcreate -n arch-swap -L 16G arch-lvm | |
| lvcreate -n arch-home -l 100%FREE arch-lvm | |
| lvs | |
| mkfs.fat -F32 /dev/sda1 | |
| mkfs.ext2 /dev/sda2 | |
| mkfs.ext4 -L root /dev/arch-lvm/arch-root | |
| mkfs.ext4 -L home /dev/arch-lvm/arch-home | |
| mkswap /dev/arch-lvm/arch-swap | |
| swapon /dev/arch-lvm/arch-swap | |
| mount /dev/arch-lvm/arch-root /mnt | |
| mkdir /mnt/{home,boot} | |
| mount /dev/sda2 /mnt/boot | |
| mkdir /mnt/boot/efi | |
| mount /dev/sda1 /mnt/boot/efi | |
| mount /dev/arch-lvm/arch-home /mnt/home | |
| pacstrap /mnt base base-devel efibootmgr nano git zsh xfce4 xfce4-goodies firefox lm-sensors nvme-cli \ | |
| hddtemp psensor tree tmux lsscsi --noconfirm | |
| # 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/Europe/Stockholm /etc/localtime | |
| hwclock --systohc --utc | |
| # Set the hostname | |
| echo MYHOSTNAME > /etc/hostname | |
| # Update locale | |
| 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 | |
| # 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