How to install Arch Linux
August 21, 2022(August 23, 2023)
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.
# file
archlinux-_version_-x86_64.iso
Verify md5 checksum #
Calculate MD5 checksum of ISO file.
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
:
ls /sys/firmware/efi
# config_table efivars fw_platform_size fw_vendor runtime runtime-map systab
Partition the disks #
-
Check install device:
lsblk | grep -v 'rom\|loop\|airoot' # NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT # sda 8:0 0 8G 0 disk
-
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
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
-
Format partitions
Format partitions as vfat and btrfs:mkfs.vfat -F32 /dev/sda1 mkfs.btrfs /dev/sda2
-
Mount the file systems
Mount the root volume to mnt:mount /dev/sda2 /mnt mkdir /mnt/boot mount /dev/sda1 /mnt/boot
Install essential packages and packages I use #
- For Server
pacstrap -K /mnt base base-devel linux linux-headers linux-firmware btrfs-progs vim
- For Desktop Environment
pacstrap -K /mnt base base-devel linux linux-headers linux-firmware btrfs-progs vim networkmanager
Configure the system #
Fstab #
Generate an fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
Chroot #
Change root into the new system:
arch-chroot /mnt
Timezone #
Set the time zone to Tokyo:
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
Run hwclock to generate /etc/adjtime
:
hwclock --systohc
Localization #
-
Edit
/etc/locale.gen
and uncomment en_US.UTF-8 UTF-8 and ja_JP.UTF-8.UTF-8. -
Generate the locales by running:
locale-gen
-
Set the LANG variable in
/etc/locale.conf
echo LANG=en_US.UTF-8 > /etc/locale.conf
Hostname #
Set hostname.
echo "exsample hostname" > /etc/hostname
Initramfs #
Creatie a new initramfs:
mkinitcpio -P
Root password #
Set the root password:
passwd
Boot loader #
I use systemd-boot.
-
add systemd-boot.
bootctl install
-
configure systemd-boot.
Edit/boot/loader/loader.conf
as follows.default arch.conf timeout 4 console-mode max editor no
-
Check the PARTUUID of /dev/sda2 and add it to
/boot/loader/entries/arch.conf
.blkid -o export /dev/sda2 | grep ^PARTUUID >> /boot/loader/entries/arch.conf
-
Add boot entry.
Edit/boot/loader/entries/arch.conf
as follows.title Arch Linux linux /vmlinuz-linux initrd /initramfs-linux.img options root=PARTUUID="PARTUUID of /dev/sda2" rw
-
Enable micro code update.
Install ucode.# 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
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
title Arch Linux linux /vmlinuz-linux initrd /amd-ucode.img initrd /initramfs-linux.img options root=PARTUUID="PARTUUID of /dev/sda2" rw
- For intel CPU
Reboot #
Reboot:
exit
umount -R /mnt
reboot