Skip to content

Instantly share code, notes, and snippets.

@stpr-dev
Forked from heppu/ARCH_INSTALL.MD
Created August 2, 2018 18:04
Show Gist options
  • Save stpr-dev/b117bb08a8516a9615d7d7606fae7bd9 to your computer and use it in GitHub Desktop.
Save stpr-dev/b117bb08a8516a9615d7d7606fae7bd9 to your computer and use it in GitHub Desktop.

Revisions

  1. @heppu heppu revised this gist May 24, 2018. No changes.
  2. @heppu heppu revised this gist Dec 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -157,7 +157,7 @@ locale-gen
    bootctl --path=/boot install
    ```

    Edit /etc/mkinitcpio.con
    Edit /etc/mkinitcpio.conf

    ```
    MODULES="ext4"
  3. @heppu heppu revised this gist Dec 4, 2017. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -95,9 +95,6 @@ swapon /dev/mapper/vg0-swap

    mkdir /mnt/boot
    mount /dev/sdX1 /mnt/boot

    mkdir /mnt/home
    mount /dev/mapper/vg0-home /mnt/home
    ```

    # Install base system
  4. @heppu heppu revised this gist Dec 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ I will create only swap and root partitions, but here you can create home, var a
    ```bash
    mkfs.vfat -F32 /dev/sda1

    cryptsetup luksFormat /dev/sda2
    cryptsetup -v luksFormat /dev/sda2
    cryptsetup luksOpen /dev/sda2 luks

    pvcreate /dev/mapper/luks
  5. @heppu heppu revised this gist Dec 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ I will create only swap and root partitions, but here you can create home, var a
    ```bash
    mkfs.vfat -F32 /dev/sda1

    cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/sda2
    cryptsetup luksFormat /dev/sda2
    cryptsetup luksOpen /dev/sda2 luks

    pvcreate /dev/mapper/luks
  6. @heppu heppu revised this gist Dec 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -74,7 +74,7 @@ Command (? for help): w

    # Format, encrypt and mount partitions

    I will create only swap and root partitions, but here you can create separaameamete home, var and other partitions if you wish.
    I will create only swap and root partitions, but here you can create home, var and other partitions if you wish.

    ```bash
    mkfs.vfat -F32 /dev/sda1
  7. @heppu heppu revised this gist Jan 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -181,7 +181,7 @@ Create /boot/loader/entries/arch.conf
    title Arch Linux
    linux /vmlinuz-linux
    initrd /initramfs-linux.img
    options cryptdevice=UUID=<YOUR-BOOT-PARTITION-UUID>:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet
    options cryptdevice=UUID=<YOUR-PARTITION-UUID>:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet
    ```

    Edit /boot/loader/loader.conf
  8. @heppu heppu created this gist Dec 29, 2016.
    202 changes: 202 additions & 0 deletions ARCH_INSTALL.MD
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,202 @@
    # Create bootable USB

    ```bash
    dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync
    ```

    # Boot from USB and set prepare system

    ```bash
    loadkeys <your-keymap>
    timedatectl set-ntp true
    ```

    # Connect to wifi

    ```bash
    wifi-menu
    ```

    # Partition the disk with gdisk

    We will create 2 partitions, one for boot partition and one for LUKS encrypted partition

    ```bash
    gdisk /dev/sda
    ```

    ```
    GPT fdisk (gdisk) version 1.0.1
    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present
    Found valid GPT with protective MBR; using GPT.
    Command (? for help): o
    This option deletes all partitions and creates a new protective MBR.
    Proceed? (Y/N): Y
    Command (? for help): n
    Partition number (1-128, default 1):
    First sector (34-242187466, default = 2048) or {+-}size{KMGTP}:
    Last sector (2048-242187466, default = 242187466) or {+-}size{KMGTP}: +512M
    Current type is 'Linux filesystem'
    Hex code or GUID (L to show codes, Enter = 8300): EF00
    Changed type of partition to 'EFI System'
    Command (? for help): n
    Partition number (2-128, default 2):
    First sector (34-242187466, default = 1050624) or {+-}size{KMGTP}:
    Last sector (1050624-242187466, default = 242187466) or {+-}size{KMGTP}:
    Current type is 'Linux filesystem'
    Hex code or GUID (L to show codes, Enter = 8300):
    Changed type of partition to 'Linux filesystem'
    Command (? for help): p
    Disk /dev/sda: 242187500 sectors, 115.5 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 9FB9AC2C-8F29-41AE-8D61-21EA9E0B4C2A
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 242187466
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 2014 sectors (1007.0 KiB)
    Number Start (sector) End (sector) Size Code Name
    1 2048 1050623 512.0 MiB EF00 EFI System
    2 1050624 242187466 115.0 GiB 8300 Linux filesystem
    Command (? for help): w
    ```

    # Format, encrypt and mount partitions

    I will create only swap and root partitions, but here you can create separaameamete home, var and other partitions if you wish.

    ```bash
    mkfs.vfat -F32 /dev/sda1

    cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/sda2
    cryptsetup luksOpen /dev/sda2 luks

    pvcreate /dev/mapper/luks
    vgcreate vg0 /dev/mapper/luks
    lvcreate -L 4G vg0 -n swap
    lvcreate -l +100%FREE vg0 -n root

    mkfs.ext4 /dev/mapper/vg0-root
    mkswap /dev/mapper/vg0-swap

    mount /dev/mapper/vg0-root /mnt
    swapon /dev/mapper/vg0-swap

    mkdir /mnt/boot
    mount /dev/sdX1 /mnt/boot

    mkdir /mnt/home
    mount /dev/mapper/vg0-home /mnt/home
    ```

    # Install base system

    ```bash
    pacstrap /mnt base base-devel
    ```

    # Generate fstab

    ```bash
    genfstab -pU /mnt >> /mnt/etc/fstab

    cat /mnt/etc/fstab
    #
    # /etc/fstab: static file system information
    #
    # <file system> <dir> <type> <options> <dump> <pass>
    # /dev/mapper/vg0-root
    UUID=44bc2285-0443-44d6-8208-e914638ee1b1 / ext4 rw,noatime,data=ordered 0 1

    # /dev/sda1
    UUID=AEF3-11A1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2

    # /dev/mapper/vg0-swap
    UUID=708a05f7-633c-4f0f-a16b-3abce7def965 none swap defaults 0 0

    ```
    If you have SSD change relatime on all non-boot partitions to noatime.

    # chroot into new system and prepare it

    ```bash
    arch-chroot /mnt

    ln -s /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
    hwclock --systohc

    echo <your-hostname> > /etc/hostname

    pacman -S fish
    pacman -S dialog wpa_supplicant

    passwd
    useradd -m -G wheel -s /usr/bin/fish <username>
    passwd <username>

    ```
    # Set locales
    Uncomment en_US.UTF-8 UTF-8 and other needed localizations in /etc/locale.gen
    ```bash
    echo LANG=en_US.UTF-8 > /etc/locale.conf
    echo KEYMAP=<your-keymap> > /etc/vconsole.conf
    locale-gen
    ```

    # mkinitcpio

    ```bash
    bootctl --path=/boot install
    ```

    Edit /etc/mkinitcpio.con

    ```
    MODULES="ext4"
    .
    .
    .
    HOOKS="base udev autodetect modconf block keymap encrypt lvm2 resume filesystems keyboard fsck"
    ```

    ```bash

    ```
    # Configure bootloader

    Create /boot/loader/entries/arch.conf

    ```
    title Arch Linux
    linux /vmlinuz-linux
    initrd /initramfs-linux.img
    options cryptdevice=UUID=<YOUR-BOOT-PARTITION-UUID>:lvm:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet
    ```

    Edit /boot/loader/loader.conf

    ```
    timeout 0
    default arch
    editor 0
    ```

    # Finish installation and boot to new system

    ```bash
    mkinitcpio -p linux
    exit
    umount -R /mnt
    reboot
    ```