Skip to content
Search

ArchLinux:Installation

lastmod 2020-12-03created 2020-03-0853 edits

Notes on how to install Arch Linux.

USB media

In macOS

First, you need to identify the USB device. Open /Applications/Utilities/Terminal and list all storage devices with the command:

$ diskutil list

Your USB device will appear as something like /dev/disk2 (external, physical). Verify that this is the device you want to erase by checking its name and size and then use its identifier for the commands below instead of /dev/diskX.

A USB device is normally auto-mounted in macOS, and you have to unmount (not eject) it before block-writing to it with dd. In Terminal, do:

$ diskutil unmountDisk /dev/diskX

Now copy the ISO image file to the device. The dd command is similar to its Linux counterpart, but notice the 'r' before 'disk' for raw mode which makes the transfer much faster:

Note

BSD-derived [[dd], which includes macOS's default dd, uses lower-case m suffix. This differs from GNU dd, used elsewhere in this article.

$ sudo -H -s
# dd if=path/to/arch.iso of=/dev/rdiskX bs=1m

This command will run silently. To view progress, send SIGINFO by pressing Ctrl+t. Note diskX here should not include the s1 suffix, or else the USB device will only be bootable in UEFI mode and not legacy. After completion, macOS may complain that "The disk you inserted was not readable by this computer". Select 'Ignore'. The USB device will be bootable.

USB Booting

For reference, the installation was done on an ACER Swift3 SF314-42 R7 Scene Stealer.

After entering the BIOS setup page with F2, the settings were as follows.

  • Boot > Secure Boot > DIsabled
  • Boot priority order:
    1. USB CDROM
    2. USB HDD
    3. UEFI_SHELL

Installation

Check UEFI.

Wireless network setup

Connect to the network using iwd. See that page for related information.

$ systemctl start iwd.service
$ iwctl
[iwd]# device list
[iwd]# station <device-name> scan
[iwd]# station <device-name> get-networks

[iwd]# station <device-name> connect <ssid>
## or
[iwd]# station <device-name> connect-hidden <ssid>

[iwd]# station <device-name> show
[iwd]# quit
$ ifconfig

Setting the system time

Set the time by referring to the timedatectl page. In short,

$ timedatectl set-timezone Asia/Seoul
$ timedatectl set-ntp true
$ timedatectl status

Disk partitioning

See Disk partitioning. For an example, see DiskPartitioning:Example:UEFI_with_GPT.

Formatting the partitions

Once the partitions are created, each one must be formatted with an appropriate file system. If the partitions are laid out as in DiskPartitioning:Example:UEFI_with_GPT, format them as follows.

To avoid potential problems with other operating systems, format the EFI partition as FAT32. See Unified Extensible Firmware Interface#Format the partition for details.

$ mkfs.fat -F32 /dev/sda1

Format the partition that will hold the OS data as ext4 as follows.

$ mkfs.ext4 /dev/sda2

If you created a swap partition, initialize it with mkswap and swapon.

$ mkswap /dev/sda3
$ swapon /dev/sda3

Mounting the partitions

Mount the root partition on /mnt.

$ mount /dev/sda2 /mnt

Mount the system partition on /mnt/boot.

$ mkdir /mnt/boot
$ mount /dev/sda1 /mnt/boot

Later, genfstab will be used to detect the mounted file systems and swap space.

Installing

Mirror servers can be edited in /etc/pacman.d/mirrorlist. On the live system, all servers are selected and sorted by their sync status and speed at the time the installation image was built. Servers higher in the list are given priority. Because pacstrap copies this mirror list file to the new system during installation, it is worth editing it properly.

Install the base, linux, and linux-firmware package groups with pacstrap.

$ pacstrap /mnt base linux linux-firmware

Additional packages can be appended as extra arguments. Alternatively, they can be installed with the pacman command after the chroot step.

System configuration

fstab

Generate the fstab file with the following command. Use the -U option to use UUIDs, or the -L option for labels.

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

Check the generated /mnt/etc/fstab file.

chroot

Change ROOT to the new system.

$ arch-chroot /mnt

Installing additional packages

Install a few handy packages with pacman.

Before installing, update the repository information.

$ pacman -Syu

Text editors vim, neovim:

$ pacman -S vim neovim

man for package documentation:

$ pacman -S man man-db man-pages texinfo

sudo for administrator privileges:

$ pacman -S sudo

iwd for wireless network connections:

$ pacman -S iwd

Time zone

Set the time zone. Use the /usr/share/zoneinfo/지역명/도시명 file (region/city). For Asia/Seoul, apply it as follows.

$ ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

Set the hardware clock to UTC using hwclock.

$ hwclock --systohc --utc

Check that the /etc/adjtime file was created. See hwclock(8).

Localization

In the /etc/locale.gen file, find en_US.UTF-8 UTF-8 and any other localization you need, uncomment them, and run locale-gen.

$ vim /etc/locale.gen

## 수정 후 ...
$ locale-gen

Language settings

Set the LANG variable, which controls the system-wide language setting.

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

See locale.conf(5).

Keyboard layout

Unless configured otherwise, the default is us. The list of available layouts can be checked as follows.

$ ls /usr/share/kbd/keymaps/**/*.map.gz

To set the keymap, add the KEYMAP environment variable to the /etc/vconsole.conf file.

$ echo "KEYMAP=us" > /etc/vconsole.conf

Changing the layout

The layout can be changed with loadkeys(1). For example, for a German keyboard layout:

$ loadkeys de-latin1

Console fonts are in the /usr/share/kbd/consolefonts/ directory. They can be changed with setfont(8).

Hostname

Edit hostname(5). (It seems hostnamectl(1) can be used.. <- needs checking)

$ echo "호스트명" > /etc/hostname

Then update hosts(5).

$ vim /etc/hosts

Update the list as follows.

127.0.0.1   localhost.localdomain   localhost
::1     localhost.localdomain   localhost
127.0.1.1   호스트명.localdomain    호스트명

See Hostname.

Administrator setup

Set the administrator password.

$ passwd

Configure sudo using visudo.

Find the following section.

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

Then uncomment it as follows and save.

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

User setup

Add a new user.

$ useradd -m -g users -G wheel -s /bin/bash [사용자명]

The options mean the following.

  • -m: create a home directory named after the user.
  • -g [그룹명] (group name): lowercase g means the primary group. The list of groups is in /etc/group.
  • -G: set additional groups.
    • power is a group that is no longer used. Don't use it.
    • sotrage is an additional group used before systemd absorbed it. Don't use it.
    • wheel is the administrator group for using programs such as sudo and su.
  • -s [쉘 실행파일 경로] (shell executable path): choose the default shell program to use

Set the user's password.

$ passwd [사용자명]

Installing the boot loader

Install the GRUB and efibootmgr packages.

$ pacman -S grub efibootmgr

Install GRUB.

$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --recheck

If the installation succeeds, the following message is printed.

Installing for x86_64-efi platform.
Instrallation finished. No error reported.

You can change the default settings by checking the /etc/default/grub file. The boot file is generated from this file.

$ grub-mkconfig -o /boot/grub/grub.cfg

If it is generated successfully, the following message is printed.

Generating grub configuration file ...
Found linux image: /boost/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done

Exit and reboot

Exit the chroot environment.

$ exit

Unmount the mounted devices.

$ umount /mnt/boot
$ umount /mnt

Or add the Recursive option as below.

$ umount -R /mnt

Then reboot.

$ reboot

Wireless network configuration

For DNS management, start systemd-resolved, which iwd uses by default.

$ systemctl start systemd-resolved.service
$ systemctl enable systemd-resolved.service

Edit /etc/iwd/main.conf, the configuration file of iwd, as follows.

[General]
EnableNetworkConfiguration=true

Then start iwd.

$ systemctl start iwd.service
$ systemctl enable iwd.service

Once you complete the connection with iwctl as above, the configuration file for that SSID is saved in the /var/lib/iwd/ directory.

Check that an IP was assigned correctly with the command below.

$ ip addr

Then check that the external network connection works.

$ ping www.google.com

Recommendations

For further tasks such as system administration guidance, GUI environment setup, sound, and touchpad, see the general recommendations.

Also see the list of applications that may be of interest.

Next: ArchLinux:Setup

See also

Favorite site

References


  1. Arch_Linux_Installation_Guide-W._H._Jeon.pdf ↩

author Zer0 sitemap