Skip to main content

How to install Arch Linux

··3 mins·
Arch-Linux
Makoto Morinaga
Author
Makoto Morinaga
A personal notebook for tech notes, coding, and system experiments.
Table of Contents

This note is recorded when I install Arch Linux.

Pre-installation
#

Download Image
#

Visit the Download Page, download the ISO file and write down the MD5 checksum.

Verify md5 checksum
#

Calculate MD5 checksum of ISO file.

Terminal
md5sum archlinux-_version_.x86_64.txt

# 0e9943a96f8298abb0db5e64f76ad0be  archlinux-2022.08.05-x86_64.iso

Confirm that the md5 checksum I wrote down is the same as the md5 checksum I calculated.

Create Live USB
#

Create live USB according to USB flash installation medium.

Disable Secure Boot
#

Arch Linux installation images do not support Secure Boot.

Disable Secure Boot in Bios.

Installation
#

Boot the live environment
#

Boot the live environment with Live USB.

Verify the boot mode
#

To verify the boot mode, list the efivars directory. Proceed in UEFI mode, so make sure that the efivars directory exists under /sys/firmware/efi:

Terminal
ls /sys/firmware/efi

# config_table efivars fw_platform_size fw_vendor runtime runtime-map systab

Partition the disks
#

  1. Check install device:

    Terminal
    lsblk | grep -v 'rom\|loop\|airoot'
    
    # NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    # sda    8:0    0   8G  0 disk
  2. Create partitions The partition layout is as follows.

    Partition Size Format Mount point
    /dev/sda1 512M vfat /mnt/boot/
    /dev/sda2 Remainder of the device btrfs /mnt
    Terminal
    sgdisk -Z /dev/sda
    sgdisk -o /dev/sda
    sgdisk -n 1:0:+512M -t 1:ef00 /dev/sda
    sgdisk -n 2:0: -t 2:8300 /dev/sda
  3. Format partitions Format partitions as vfat and btrfs:

    Terminal
    mkfs.vfat -F32 /dev/sda1
    mkfs.btrfs /dev/sda2
  4. Mount the file systems Mount the root volume to /mnt:

    Terminal
    mount /dev/sda2 /mnt
    mkdir /mnt/boot
    mount /dev/sda1 /mnt/boot

Install essential packages and packages I use
#

  • For Server
    Terminal
    pacstrap -K /mnt base base-devel linux linux-headers linux-firmware btrfs-progs vim
  • For Desktop Environment
    Terminal
    pacstrap -K /mnt base base-devel linux linux-headers linux-firmware btrfs-progs vim networkmanager

Configure the system
#

Fstab
#

Generate an fstab file:

Terminal
genfstab -U /mnt >> /mnt/etc/fstab

Chroot
#

Change root into the new system:

Terminal
arch-chroot /mnt

Timezone
#

Set the time zone to Tokyo:

Terminal
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

Adjust hwclock:

Terminal
hwclock --systohc

Localization
#

  1. Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and ja_JP.UTF-8 UTF-8.

  2. Generate the locales by running:

    Terminal
    locale-gen
  3. Set the LANG variable in /etc/locale.conf:

    Terminal
    echo LANG=en_US.UTF-8 > /etc/locale.conf

Hostname
#

Set hostname:

Terminal
echo "exsample hostname" > /etc/hostname

Initramfs
#

Creatie a new initramfs:

Terminal
mkinitcpio -P

Root password
#

Set the root password:

Terminal
passwd

Boot loader
#

I use systemd-boot.

  1. add systemd-boot.

    Terminal
    bootctl install
  2. configure systemd-boot. Edit /boot/loader/loader.conf as follows:

    /boot/loader/loader.conf
    default arch.conf
    timeout 4
    console-mode max
    editor no
  3. Check the PARTUUID of /dev/sda2 and add it to /boot/loader/entries/arch.conf:

    /boot/loader/entries/arch.conf
    blkid -o export /dev/sda2 | grep ^PARTUUID >> /boot/loader/entries/arch.conf
  4. Add boot entry. Edit /boot/loader/entries/arch.conf as follows:

    /boot/loader/entries/arch.conf
    title Arch Linux
    linux /vmlinuz-linux
    initrd /initramfs-linux.img
    options root=PARTUUID="PARTUUID of /dev/sda2" rw
  5. Enable micro code update. Install ucode.

    Terminal
    # For intel CPU
    pacman -S intel-ucode
    # For amd CPU
    pacman -S amd-ucode

    Edit /boot/loader/entries/arch.conf as follows.

    • For intel CPU
      /boot/loader/entries/arch.conf
      title Arch Linux
      linux /vmlinuz-linux
      initrd /intel-ucode.img
      initrd /initramfs-linux.img
      options root=PARTUUID="PARTUUID of /dev/sda2" rw
    • For amd CPU
      /boot/loader/entries/arch.conf
      title Arch Linux
      linux /vmlinuz-linux
      initrd /amd-ucode.img
      initrd /initramfs-linux.img
      options root=PARTUUID="PARTUUID of /dev/sda2" rw

Reboot
#

Reboot:

Terminal
exit
umount -R /mnt
reboot

Related

Privacy Policy & Disclaimer
·1 min