Arch Linux's wiki has a great installation guide, but some find it very daunting and hard-to-read. This article is a summary of all the commands in that wiki page, as of time of writing.
This is not a replacement for the the official Installation Guide. Consider this more like a refresher course!
Next: Let's get started.
(Skip this step if you're not dual-booting Windows or MacOS.) Before you create your ext4
(Linux) partition, you'll need make space for it. Resize your current OS's partition down at least 60GB less to give you some space to create your Linux partition.
Windows users, Follow this guide to resize your partition in Windows using the built-in Disk Management.
MacOS users, Follow this guide in using Disk Utility.app to resize your partition.
You can download the latest ArchLinux ISO from the Arch Linux Downloads page. To create these USB disks, you can use dd in Linux, RUFUS in Windows, or dd in MacOS.
Boot into your USB disk. It should land you onto a bash prompt. When you see this, it's time to get started!
[root@archiso /]#
Next: Let's type in a few commands.
If you're using different keyboard layout, change it now using loadkeys
. See kbd for a list of available layouts.
# (Skip this step if you're using the qwerty layout!)
loadkeys dvorak
Check if the /sys/firmware/efi/efivars
path exists. If it is, you're using UEFI
mode. If not, you're using Legacy
mode. Most modern devices are using UEFI mode, and this guide assumes you're in UEFI mode.
# See if this path exists
ls /sys/firmware/efi/efivars
Next: Let's connect to the Internet.
You will be installing packages from the Arch package repository over the Internet. For that, you'll need to be online.
Try going online by typing wifi-menu
. (If this didn't work, have a look at other ways of getting online.)
wifi-menu
After all that, ensure that you're finally online.
# Check if you're online now
ping 8.8.8.8
Next: Update your system clock.
This will update your system clock through the Internet via NTP (Network Time Protocol).
# Update your system time
timedatectl set-ntp true
Next: Partition your disk.
You'll need 2 partitions on your computer. You'll need an EFI partition
, which you already have (and can be reused) if you already have another OS installed. You'll also need an ext4 partition
for Arch Linux to be installed to.
I recommend using cfdisk
for this. See Partition the disks (wiki.archlinux.org) for more info.
# Create your ext4 partition using 'cfdisk'
cfdisk /dev/sda
You'll need to create an ext4
partition. You'll also need an efi
partition, but you probably have that already if you have an OS installed before all this.
Unlike other guides, I recommend not setting up a swap partition, and using systemd-swap instead (we'll set that up later on).
Format any ext4 partitions you made using mkfs.ext4
. Be sure to replace sda1
with the actual partition.
# Format a partition as ext4
mkfs.ext4 /dev/sda1
# ^^^^
Next: Let's mount the partitions you just made.
After creating your partitions, you'll now need to mount it so we can write to it.
Mount the root partition to /mnt
. This is the ext4 partition that'll be installing Linux into.
mount /dev/sda1 /mnt
# ^^^^
Mount the EFI partition to /mnt/boot
. This is where the bootloader will be installed.
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
# ^^^^
Next: Time to actually install Arch Linux.
Edit your mirror list, and move the geographically-closest location to you up the list. Don't skip this step! It'll likely be the difference between a 45-minute install and a 5-minute install.
# Find your closest country, and bring it up
vi /etc/pacman.d/mirrorlist
Install packages using pacstrap
. This will take a while!
# Make some coffee while this is happening
pacstrap /mnt base
Generate the list of partitions (/etc/fstab
) to be mounted at boot time. This will be based on what partitions are already mounted right now.
# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
Next: Let's enter the system.
We're going to "enter" the new system you just mounted using chroot! Use arch-chroot
to "enter" the new file system. This will make root path (/
) be what's in the new partition (until you exit
).
# ~Enter the system~
arch-chroot /mnt
Next: Let's configure the rest of the stuff.
See tzdata for a list of available timezones.
# Set your timezone (eg, Asia/Manila)
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
# ^^^^^^^^^^^
# Update time config (/etc/adjclock)
hwclock --systohc
Set your default locale. For most of us, that would be en_US.UTF-8
, but feel free to change that.
# Uncomment `en_US.UTF-8 UTF-8` in this file
vi /etc/locale.gen
Edit the /etc/locale.conf
file and add the locale as LANG=<the locale>
. After this, type, locale-gen
.
vi /etc/locale.conf
LANG=en_US.UTF-8
# Generate locale config (/etc/locale.gen)
locale-gen
(Optional) If you use a different keyboard layout, make it persist on boot.
# Skip this step if you're not using
# an alternate keyboard layout.
echo "KEYMAP=dvorak" > /etc/vconsole.conf
Next: Set your system's hostname
It's time to pick a name for your machine. Pick a hostname and update /etc/hostname
.
echo "myhostname" > /etc/hostname
# ^^^^^^^^^^
# change this to whatever
# you feel like using
Update /etc/hosts
with your new hostname. (Be sure to change myhostname
to your chosen hostname.)
vi /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
Change your password using passwd
. This is not your main user's password.
passwd
Next: Let's install a boot loader.
You'll need a boot loader in your EFI partition. Think of this as a small program whose sole purpose is to kickstart your Linux session. There are many different boot loaders, but GRUB would be a good one to start with.
Let's install grub into /boot
. Be sure to read the Arch wiki, instructions may be different for your system!
# Install packages
pacman -S grub efibootmgr
# Install GRUB to EFI
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# Update Grub config
grub-mkconfig -o /boot/grub/grub.cfg
Next: Let's create the user you'll be logging in with.
(This section is not listed in the Arch official installation guide, but I highly recommended this for most users.)
You'll need a user that you'll be logging in with for your day-to-day. (Be sure to change yourname
to whatever you feel like using.)
# Create the user
useradd -Nm -g users -G wheel,sys yourname
# ^^^^^^^^
Set a password using passwd
.
passwd yourname
New password: ····
Retype new password: ····
passwd: password updated successfully
You'll want to add them to some other groups too.
usermod -a -G \
audio,input,video,network,rfkill \
yourname
# ^^^^^^^^
Next: Let's install sudo.
The sudo utility lets your everyday user run system admin tasks. Sudo is not part of the Arch Linux base
package, so we'll need to install that separately.
(This section is not listed in the Arch official installation guide, but I highly recommended this for most users.)
Add and configure the sudo
package to grant your user some superuser rights.
# Install sudo
pacman -S sudo
Use visudo
to edit the sudo config to add the wheel
group to it. This allows all users in that group to use sudo. (You did add your user to wheel
, right?)
# Update config
EDITOR=vi visudo
# Then add this line to the end of the file:
%wheel ALL=(ALL) ALL
Next: Install some packages.
(This section is not listed in the Arch official installation guide, but I highly recommended this for most users.)
Install some networking tools, so we may be able to go online later. NetworkManager is used by most desktop environments to manage network connections, and can be used in the console as well via nmtui
.
# Install NetworkManager to manage your networks
pacman -S networkmanager
systemctl enable NetworkManager
Next: Your mostly done! Lets do a few more things.
Congratulations, you now have a working Arch Linux installation. At this point, exit
out of the chroot, and reboot
. Be sure to remove the USB drive as you're rebooting, and you may need to go to your BIOS's boot order menu.
exit
reboot
From here, I recommend proceeding to the After Installing Arch Linux guide. A basic Arch Linux installation doesn't have a user, swap, a desktop environment, sudo, and many other facilities we may be taking for granted.