---
# System prepended metadata

title: Arch Linux Installation & Configuration

---

# Arch Linux Installation & Configuration

## Pre-installation

Verify the boot mode

```
# ls /sys/firmware/efi/efivars
```

Connect to the internet

```
# iwctl
```

Update the system clock

```
# timedatectl set-ntp true
```

Partition the disks
```
# gdisk /dev/sda
```

|Partition		    |Partition type	  |Size			  |
|---------------------------|---------------------|-----------------------|
|`/dev/efi_system_partition`|EFI system partition |550MiB		  |
|`/dev/swap_partition`	    |Linux swap		  |2GiB			  |
|`/dev/root_partition`	    |Linux x86-64 root (/)|Remainder of the device|

Format the partitions

```
# mkfs.ext4 /dev/root_partition
# mkswap /dev/swap_partition
# mkfs.fat -F 32 /dev/efi_system_partition
```

Mount the file systems

```
# mount /dev/root_partition /mnt
# mount --mkdir /dev/efi_system_partition /mnt/boot
# swapon /dev/swap_partition
```

## Installation

Add mirrors to `/etc/pacman.d/mirrorlist`.

```
Server = https://archlinux.cs.nycu.edu.tw/$repo/os/$arch
Server = https://shadow.ind.ntou.edu.tw/archlinux/$repo/os/$arch
Server = https://mirror.archlinux.tw/ArchLinux/$repo/os/$arch
```

Install packages (only `base` `linux` `linux-firmware` are essential)

```
# pacstrap /mnt base linux linux-firmware vi sudo networkmanager git xmonad xmonad-contrib xorg-server xorg-xinit rxvt-unicode intel-ucode firefox adobe-source-han-sans-otc-fonts fcitx5-im fcitx5-chewing
```

## Configuration

Fstab

```
# genfstab -U /mnt >> /mnt/etc/fstab
```

Chroot
```
# arch-chroot /mnt
```

Time zone
```
# ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
# hwclock --systohc
```

### Localization

Edit `/etc/locale.gen` and uncomment `en_US.UTF-8 UTF-8` and needed locales. Generate the locales by running:

```
# locale-gen
```

Create the `locale.conf` file, and set the LANG variable: 

```
(/etc/locale.conf)
LANG=en_US.UTF-8
```

### Network configuration


```
/etc/hostname
-------------
myhostname
```

```
/etc/hosts
---------------------------
127.0.0.1        localhost
::1              localhost
127.0.1.1        myhostname
```

Root password

```
# passwd
```

Boot loader

```
# bootctl install
```

run `blkid /dev/root_partition` to get the number after `PARTUUID="`.
```
# vi /boot/loader/entries/arch.conf
```
```
/boot/loader/entries/arch.conf
-----------------------------------
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=PARTUUID=your_partuuid_code
```
```
# vi /boot/loader/loader.conf
```
```
/boot/loader/loader.conf
------------------------
default arch.conf
timeout 0
console-mode max
editor no
```

### Reboot

Exit the chroot environment by pressing `Ctrl+d`.

```
# umount -R /mnt
# reboot
```

Add user

```
# useradd -m -G wheel user_name
# passwd user_name
```

Add user to sudoers

```
# visudo
```

Uncomment the line of `# %wheel ALL=(ALL:ALL) ALL`