an arch install has several phases:
- 1. preparing the installation medium
- 2. booting from the installation medium
- 3. booting from the computer's hard disk for the first time
as the arch installation process changes every so often, be sure to check out
the official up-to-date guide:
the official up-to-date guide:
there's also a guided install process for arch called `archinstall`.
it's especially useful for when you have a fresh complete hard drive to boot from.
it's especially useful for when you have a fresh complete hard drive to boot from.
$ pacman -S archinstall $ archinstall
0. general advisory
there are some things that make installing linux easier.
the first is having linux-compatible parts.
- the problem is, if you're installing linux,
- it's often on hardware you already have.
- i don't imagine many people go out and pick
- a computer that's compatible with linux on their first installation.
- the network card for this is especially important.
i would just google to see if someone else can vouch for your network card.
- the graphics card is also important.
AMD graphics cards have historically good support on linux,- as they even have an open source GPU driver.
- install proprietary (non-open source) drivers, like the official Nvidia driver.
the second is having a fresh computer to work with.
- that way you don't have to worry about carefully installing both linux and windows.
with a fresh computer, you can completely format and destroy the filesystems on the disk.
formatting filesystems takes a good amount of care, caution, and attention to detail.
the third is having backups.
- especially if you're not in the position to have a fresh computer to work on,
- you can back up your important files.
- this is a good practice to do generally.
the fourth is having an ethernet cable.
- having to deal with connecting to the internet with iwctl is not especially difficult,
- but being able to avoid it is pleasant and preferable.
1. preparing the installation medium
i usually prepare the install medium from windows.
i go to the arch website and click the magnet link for the torrent.
i go to the arch website and click the magnet link for the torrent.
- you can also use the http direct download, especially if you have fast (i.e. gigabit) internet,
should finish in a jiffy
once i have the arch .iso downloaded, i put it onto a flash drive.
arch itself is only a gig-ish, so you don't need a very big flash drive.
if you have a laptop with only usb-c ports (macbook pro or xps), you might need a dongle.
usb install is the one i'm familiar with and i believe it's easier than the others.
arch itself is only a gig-ish, so you don't need a very big flash drive.
if you have a laptop with only usb-c ports (macbook pro or xps), you might need a dongle.
usb install is the one i'm familiar with and i believe it's easier than the others.
- there's also net-boot installation and some other stuff i haven't tried.
i use rufus on windows to put the arch .iso on the flash drive.
i think it prompts you whether you want to make your flash drive rewritable
make sure you wait for rufus to finish, as far as i remember it says "START" when it's done,
i think it prompts you whether you want to make your flash drive rewritable
- or not using like DD mode or something.
make sure you wait for rufus to finish, as far as i remember it says "START" when it's done,
- which is rather unfortunate UX design.
- link: https://rufus.ie/en/
- as of the time of writing, the current version is 3.17
once it's done, reboot your computer and go to step 2
2. booting from the installation medium
a windows computer, especially laptops, will have annoying boot stuff,
- such as disabling secure boot in the bios.
- TODO reference the XPS 13 install log
here are the official notes for installation when dualbooting with windows
on boot, do a piano scale on the function keys to see which one gives you your boot menu.
- use a "one-time" boot menu option if it gives it to you, or simply a "boot menu".
- if you configure the BIOS to boot from the flash drive every time,
- you'll have to unplug it or rearrange it after you install.
- some computers can't boot from a USB, if they have particularly locked down bootloaders/ boot menus.
- i have no idea how to install linux on those. good luck. maybe try the network boot thing?
- most computers should be fine though.
- i have no idea how to install linux on those. good luck. maybe try the network boot thing?
from the arch live install boot menu, i pick
- "Arch Linux install medium (x86_64, BIOS)"
- which is the default option. it might say "UEFI" at the end, but "BIOS" is what it shows in qemu.
- in either case, the default option should be fine.
once we've booted the arch install medium, it should show a command line with the user "root".
now we actually begin installing.
now we actually begin installing.
if you've experience with other unix/linux installations,
- they usually come with a "live" iso that lets you try out the OS,
- then installs a fresh version onto your disk.
right now, as you've booted from the USB, the USB itself is the filesystem root or "/".
- unlike windows that has drive "C:" and "D:", there is one ultimate filesystem root in linux
that everything else falls under.
- flash drives are often found under the /mnt/ folder instead of adding another root.
to make another disk a child/subfolder of this one, we can use the "mount" command.
there are some files and folders on linux that represent the system's view of its devices and the
- world around it.
- e.g.: "/sys" for the system
- these are called "pseudo"-filesystems
- there is also "/dev" for devices, but this is the default place devices are listed
- this is where we'll find the disks to mount onto the live USB filesystem.
- this is where we'll find the disks to mount onto the live USB filesystem.
let's run pre-setup commands to get us started.
the arch wiki tells us to set the console keyboard layout and to verify the boot mode.
the arch wiki tells us to set the console keyboard layout and to verify the boot mode.
- i'm going to assume you're using a US keyboard layout, and that's default.
$ ls /usr/share/kbd/keymaps/**/*.map.gz # see available layouts $ loadkeys de-latin1 # if you've a german keyboard, i guess $ ls /sys/firmware/efi/efivars # to check that we've booted using EUFI, $ # has better DPI, but not sure why else we'd care
so by now, we've actually booted.
here are the things we have to do:
here are the things we have to do:
- 2.1. ethernet or iwctl: connect to the internet
- 2.2. genfstab: format filesystem and disk layout
- 2.3. pacstrap: bootstrap the package manager
- 2.4. configure the system
2.1. ethernet or iwctl: connect to the internet
if you have an ethernet cable plugged in, skip this step. check that your internet works with
$ ping google.com
otherwise, you'll need to connect to wifi.
arch linux used to have wifi-menu, which i preferred a bit,
but they have iwctl now.
arch linux used to have wifi-menu, which i preferred a bit,
but they have iwctl now.
TODO maybe explain how to use iwctl, but i need to figure it out first.
- i used wifi-menu last time
once we've connected to the internet, we can also fix the time
$ timedatectl set-ntp true # sync the time with the internet $ timedatectl status # check status $ date # check date
2.2. genfstab: format filesystem and disk layout
so what we're going to do is clear out some space, chop up the space we have,
- and stack them together into a filesystem tree.
- the space will exist on disk devices.
- we'll chop up the disk devices into partitions.
- then stack them together using mount and mkfs.
to figure out what disks and devices you have, run
$ fdisk -l
if you have an nvme ssd, it'll say something like "/dev/nvme0n1"
if you have a traditional hard disk, it'll say something like "/dev/sda" or "/dev/sdb"
if you have a traditional hard disk, it'll say something like "/dev/sda" or "/dev/sdb"
to clear out some space and chop it up,
- we need to repartition the disks.
- we can use the `cfdisk` command to do that,
- but first, let's get some background
the way we deal with partition will be to:
- 1. format it with the right filesystem
- 2. ensure we have a place in the USB filesystem for it
- 3. mount it
we'll require two partitions, and i recommend adding a home partition and a swap partition as well:
- a root partition, will be "/", at least 40 gigs, maybe more for android studio
- a boot section, we'll mount at "/boot/", at least 512 megs == half a gigs
- a home partition, we'll mount at /home, the rest of the space
- a swap partition, not mounted, at least the size of your RAM, so that you can hibernate to SWAP
- i don't have an opinion on whether swap is necessary beyond this article:
- you can have no swap if you really don't have that much space
- you can have no swap if you really don't have that much space
- hibernate, vs suspend, takes no power for your computer/laptop
- allows you to switch operating systems on a computer and resume right where you left off
- TODO write a tutorial for the bootloader modification you need to allow it to do that
- allows you to switch operating systems on a computer and resume right where you left off
i recommend having a home partition so
- if you have different linux distributions (arch, ubuntu, fedora) you can reuse
the same files for your projects, documents, and user settings.
- if you have to reinstall linux, you don't have to reinstall a backup, so as
long as you're careful
to make the partitions, use `cfdisk`.
- you can also use fdisk
but cfdisk is graphical and a bit easier
- label the partitions using the right labels: Linux home, Linux Swap, Linux root, EFI
because it's easier to find later
- you can also use GNU Parted, but cfdisk is very easy
TODO explanation for how to use cfdisk
- it's pretty self-explanatory, just make sure you really check the partitions
are correct before you _write_ to the disk.
- all modifications before you write will not modify your disk,
you're just writing the plan that will happen when you commit to it.
once we have partitions of the correct size,
- we need to format them with the right filesystem
let's assume we have a completely clear disk on a computer with
- a 1000GB nvme drive,
- and 32 gigs of ram.
# /dev/nvme0n1p1 512 megs "EFI System" # /dev/nvme0n1p2 40.5 gigs "Linux root" or "Linux filesystem" # /dev/nvme0n1p3 the rest "Linux home" # /dev/nvme0n1p4 [SWAP] "Linux swap"
we can verify the paritions using "fdisk -l"
let's format them with the right filesystems.
$ mkfs.fat -F32 /dev/nvmen1p1 # for the EFI System $ mkswap /dev/nvme0n1p4 # for the swap file $ mkfs.ext4 /dev/nvme0n1p2 # for linux root $ mkfs.ext4 /dev/nvme0n1p3 # and home
for creating and mounting filesystems
for `mkfs.fat -F32`
for `mkfs.fat -F32`
now let's mount them up:
- we're going to build the "root" of our computer's linux install _under_ the live system's /mnt folder, so
when booting from the USB, it'll say ""
- to mount a partition, there has to be a folder for it.
$ mount /dev/nvme0n1p2 /mnt $ mkdir /mnt/boot $ mount /dev/nvme0n1p1 /mnt/boot $ mkdir /mnt/home $ mount /dev/nvme0n0p3 /mnt/home
now we're going to save that filesystem
- and its mounting points to a "filesystem table"
- so that it boots correctly when we boot from the disk instead of the USB
$ mkdir /mnt/etc $ genfstab -U /mnt >> /mnt/etc/fstab
2.3. pacstrap: bootstrap the package manager
we're gonna provide our system with a primitive set of packages to let it boot
- up and be reasonable.
- but you can also add whatever tools you know you'll need basically every time
- you use the machine.
$ pacstrap /mnt
so here are the packages you need:
- `base base-devel linux linux-headers linux-firmware`
here are the packages i normally install:
- `gnome-shell gnome-terminal gdm networkmanager emacs nano man-db man-pages git`
i use gnome as a "safe" backup and then i pull my fork of dwm using git later.
you also need a bootloader:
- one of:
- grub
syslinux
systemd-boot
refind-efi
- if choosing refind-efi, you can just directly load the arch linux kernel
because it's EFISTUB compatible
if i'm just booting arch linux, i use systemd-boot.
if i'm dual booting or booting multiple linuxes, i use refind-efi.
if i'm dual booting or booting multiple linuxes, i use refind-efi.
to set up refind-efi, run:
$ refind-install --usedefault /dev/nvme0n1p1
2.4. configure the system
we're going to change our root from the USB to the disk,
- actually running under the real installation's filesystem
$ arch-chroot /mnt
set timezone, e.g.
$ timedatectl set-timezone US/Central $ timedatectl set-ntp true
$ ln -sf /usr/share/zoneinfo/US/Central /etc/localtime
sync hardware clock to system
$ hwclock --systohc
set the locale to en_US.UTF-8
$ nano /etc/locale.gen
$ locale-gen $ echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
for some reason, we need this
- to get gnome-terminal working outside of gnome,
- for dwm for example.
$ echo 'LANG=en_US.UTF-8' >> /etc/default/locale
pick your computer's name
$ echo 'arkaz-prime' >> /etc/hostname
$ nano /etc/hosts | 127.0.0.1 localhost | ::1 localhost | 127.0.1.1 arkaz-prime.localdomain arkaz-prime +-------------------------------------------------
set the password for the root user
$ passwd
i've had an issue with internet when i boot for the first time,
- so i check my network driver and set it up before i go when it doesn't work.
- mount everything, and arch-chroot if it doesn't work.
$ nano /etc/systemd/network/enp0s3.network | [Match] | name=en* | [Network] | DHCP=yes +--------------
$ systemctl restart systemd-networkd $ systemctl enable systemd-networkd
$ nano /etc/resolv.conf | nameserver 8.8.8.8 | nameserver 8.8.4.4 +--------------------
3. first reboot: booting from the computer's hard disk for the first time
moment of truth.
make sure you're not booting from the installation media.
make sure you're not booting from the installation media.
you'll wanna do the piano roll on the function keys again.
if you set it to default boot from USB in your BIOS,
if you set it to default boot from USB in your BIOS,
- maybe keep that for a bit until we're sure our computer isn't broken.
once we've selected the right OS from our bootloader, log in with:
"user: root"
and the password you made with `passwd`
"user: root"
and the password you made with `passwd`
let's check the internet works
$ ping 8.8.8.8 $ dhcpcd $ ping google.com
the live system uses reflector to sort the mirrors by download speed.
we can do that too:
we can do that too:
$ pacman -S reflector $ reflector
the old method uses something from pacman-contrib
$ pacman -S pacman-contrib $ pushd /etc/pacman.d/ $ cp mirrorlist mirrorlist.backup $ rankmirrors -n 6 mirrorlist.backup > mirrorlist $ popd
once we've got the computer working fair and square, let's do some:
- 3.1. user setup
- 3.2. graphics driver setup
- 3.3. yay: aur helper
3.1. user setup
add the user "kasra" and make him an admin user
$ groupadd wheel $ useradd -m -G wheel -c "Kasra Sadeghi" kasra $ passwd kasra
look for a line that looks like this, and uncomment it
$ visudo | # %wheel ALL=(ALL) ALL +------v- uncomment -v------- | %wheel ALL=(ALL) ALL +----------------------------
3.2. graphics driver setup
for an AMD gpu:
$ pacman -S mesa glu xf86-video-amdgpu
- not this one: https://wiki.archlinux.org/title/ATI
- mesa is the opengl part of radeon stuff
FAQ what are xf86-video-amdgpu and mesa?
- xf86-video-amdgpu is the DDX driver, which provides 2D acceleration in Xorg
for vulkan and video encoding support, install:
$ pacman -S vulkan-radeon libva-mesa-driver mesa-vdpau
- libva is also for video decompression? different API called VA API
- apparently only vdpau works for nvidia, but va-api works for everyone else and seems a bit better
- only va-api works for chrome and firefox, both work for API
- only va-api works for chrome and firefox, both work for API
- FAQ reddit thread says vulkan-radeon > amdvlk
mesa is "An open-source implementation of the OpenGL specification"
FAQ a reddit thread that says you don't need amdgpu, mesa is fine
FAQ a reddit thread that says to use xf86-video-vesa as a fallback
to check that the right graphics driver is loaded:
$ lspci -k | grep -EA3 'VGA|3D|Display'
for an Nvidia gpu that's more recent that the GTX 930:
$ pacman -S nvidia
3.3. aur helper
there are some tools that automatically search and install stuff
- from the arch user repository (AUR).
i use one called `yay`.
$ git clone https://aur.archlinux.org/yay-bin.git $ cd yay-bin $ makepkg -si $ cd .. $ rm -rf yay-bin # optional, may want it to repull and fix yay if it breaks $ yay # system update/upgrade $ yay -S google-chrome # proprietary web browser
get a colorful yay output, uncomment these lines
$ nano /etc/pacman.conf | Color | ILoveCandy +---------------------
download some final packages, like
$ yay -S gnome-tweaks mlocate
download dotfiles
$ git clone git@github.com:user/.emacs.d
closing thoughts
installing arch is kinda hard, but it's (in my experience) the easiest to use
- linux distribution while it's set up.
- to configure my own packages for, and has most packages i care about.
i've never had my computer become inoperable or had a service i was running
- crash because of an update, and even severe problems can be found by either
- googling the exact message or by checking out the official arch linux news.
- make sure to look out for: "update(s) require manual intervention" !