This note summarizes the steps to install Arch Linux. I don’t intend to explain everything, and the wording is as concise as possible. Do tell me if you find anything no longer working now, or any link broken.
Partition and formatting
Download the Arch Linux ISO, and make a bootable USB. On Windows, we may use the application Rufus. On Mac, we have to format the USB first, and copy the ISO into it by using utility dd
.
Plug in the bootable USB, Then enter the firmware interface. Before the computer starts normally, there will be a notice like “Please press DEL or F2 to enter UEFI BIOS setting”. Do that immediately to enter a temporary zsh
shell, with prompt root@archiso ~ #
. From now on, a #
sign indicates the shell prompt.
List the disk blocks:
# lsblk
The largest block should be your hard disk, which is likely called sda
. A smaller one is the bootable USB we are using, and a still smaller one is the ROM.
To partition the hard disk, invoke the command line utility parted
:
# parted /dev/sda
Here, the prompt (parted)
will be shown for clarity. Create a partition table with the MSDOS (MBR) standard:
(parted) mklabel msdos
Meanwhile, UEFI/GPT partition is a newer standard, which not every motherboard supports. Partitioning commands for UEFI/GPT are similar.
My Lenovo Thinkpad currently used has 1TB, and we shall generously allocate 40GB for /
(the root directory except for the user’s home), 2GB for swap memory, and the rest for /home/
(the user’s home). Nowadays computers often have a large RAM (mine has 4GB), and 2GB of swap memory shall be more than enough.
Create partition for the root directory except for home:
(parted) mkpart primary ext4 1MiB 40GiB
Set the boot flag to be true:
(parted) set 1 boot on
Create the partition for swap memory:
(parted) mkpart primary linux-swap 40GiB 42GiB
Finally create the partition for the home, making up the rest of the hard disk:
(parted) mkpart primary ext4 42GiB 100%
In the steps above, if the requested partition can’t be made precisely as such, an alternative suggestion will be prompted. You might be asked again of the point of start and end, and of the file system. I just applied default for everything. You might also be warned that The resulting partition isn’t properly aligned for best performance
, which we may ignore.
Print a summary of each partition to double check:
(parted) print
My report has that sda1
is the root directory except home, sda2
the swap memory, sda3
the root’s home. Quit if everything looks fine:
(parted) quit
Format partitions intended for root directory:
# mkfs.ext4 /dev/sda1
Mount the root directory:
# mount /dev/sda1 /mnt
To mount the home, create the directory, then mount it:
# mkdir /mnt/home
# mount /dev/sda3 /mnt/home
Language and location
For the rest, temporarily take /mnt
to be the root directory, where Arch Linux will be installed:
# arch-chroot /mnt
I chose American English to be the default for system display, and install Chinese input methods. To do so, edit /etc/locale.gen
, and uncomment before the line en_US.UTF-8 UTF-8
and zh_TW.UTF-8 UTF-8
. Then, locale-gen
will generate necessary information for all languages enabled, and locale.conf
specifies system display:
# locale-gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
# export LANG=en_US.UTF-8
To type Chinese, I had to install the input method framework Ibus (package ibus
) and the input method Rime (package ibus-rime
). To initiate them at startup, add these lines into ~/.xinitrc
:
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
ibus-daemon -drx
Select the time zone:
# tzselect
In my case this is 4) Asia
, and 43) Taiwan
. To be sure, its very existence of this item is a reassurance.
Create a symlink from the shared directory to the system configuration directory:
# ln -s /usr/share/zoneinfo/Asia/Taiwan > /etc/localtime
Set the hardware clock:
# hwclock --systohc --utc
Setting up the Internet
Assuming a working connection, we set up DHCP (Dynamic Host Configuration Protocol):
# ip link
The first item in the output is, in my case:
1: lo:mtu 65536 qdisk noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Let the DHCP service start now, and whenever the system boots. Replace ______
with the name of wired device just seen above (mine is lo
):
# systemctl start dhcpcd@______.service
# systemctl enable dhcpcd@______.service
Replace Host-Name
with your host name:
# echo "Host-Name" > /etc/hostname
Set the root’s password:
# passwd
We may now leave the chroot
environment, unmount the corresponding partition, and schedule shutdown:
# exit
# umount -R /mnt
# shutdown
Unplug the USB, restart, and login as root
.
Essential packages
Now the internet connection is required, and it is best that you have ethernet automatically connected. Otherwise, you have to set it in command line, which isn’t covered here. Alternatively, you may use a Wifi (not covered here either). We may test the connection with ping
:
# ping -c 3 www.google.com
Edit the list of mirrors, so that closer servers are preferred (You may want to use nano
if you are unfamiliar with vi
):
# vi /etc/pacman.d/mirrorlist
Install the base packages, which will take quite a while, about twenty minutes in my case:
# pacstrap -i /mnt base base-devel
Generate and write the fstab
file, which specifies the mounted partitions:
# genfstab -U /mnt > /mnt/etc/fstab
Create a user account to be used on a daily basis, add the ID (mine is violapterin
) into the wheel group having sudo privileges, and set the password:
# useradd -m -G wheel,users -s /bin/bash violapterin
# passwd violapterin
Install package sudo
to get superuser privilege, then edit the sudoers
file. This file is special, so we have to specify the editor:
# EDITOR=vi visudo
Uncomment the line below by deleting the #
sign:
%wheel ALL=(ALL) ALL
Make stable repositories available to package manager Pacman. To do so, open /etc/pacman.conf
, and uncomment these lines:
[multilib]
Include = /etc/pacman.d/mirrorlist
Update pacman
, and install all refreshed packages (flags -Syu
means respectively installing packages, refreshing the database, and checking outdated packages):
# sudo pacman –Syu
Besides the official repository that Pacman uses, there is another Arch User Repository (AUR) maintained by community. We need other helpers to install AUR packages, including yay
, pakku
, pikaur
, and pacaur
. The flag -S
also means installation.
Desktop and the graphical interface
It remains to set up a desktop environment. We install the X-server xorg-server
and xorg-server-utils
. Check which graphic card the current system is using:
# lspci -v
Since my computer had an Intel GPU, I had to install xf86-video-intel
. As for desktop, I chose KDE, and installed packages plasma
and kde-applications
, which took nearly thirty minutes. Afterwards, we configure .xinitrc
that calls KDE on startup. Log in as the daily user’s account, and write this line:
# echo "exec startkd>" > ~/.xinitrc
Here .xinitrc
must be saved in the daily user’s home in order to be found. Even so, KDE will only be started after startx
command is run. To start KDE immediately after logged in, install package xorg-xinit
. Put these lines in ~/.bashrc
:
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
exec startx
fi
This means that we start the X server, if the display variable isn’t null, and if there is more than one terminal instance.
In the presence of a beautiful GUI, instead of the scary monochrome console, I am sure the readers will figure out the rest.
❧ March 17, 2017; revised June 24, 2021
References
❉ Arch Linux Wiki, ‹Installation Guide›
❉ Arch Linux Wiki, ‹List of applications›
❉ Arch Linux Wiki, ‹Desktop environment›