Install Arch Linux from Scratch
This activity puts into practice the concepts from the Linux Server Planning and Configuration lecture. Where Ubuntu’s installer handles partitioning, bootloader installation, user creation, and networking automatically, Arch Linux makes you do each step by hand. That is precisely the point: by the end of this exercise, you will have directly touched every layer of a Linux system that most distributions hide behind a setup wizard.
What You Will Need
Section titled “What You Will Need”- A laptop with a hypervisor installed (VirtualBox, UTM, or similar)
- The Arch Linux ISO image, downloaded from archlinux.org or the OSU Open Source Lab mirror
- About 2 GB of free disk space for the VM
- An internet connection
Create the Virtual Machine
Section titled “Create the Virtual Machine”-
Create a new VM with these settings:
- Type: Linux
- Version: Arch Linux (64-bit)
- Memory: 1024 MB (1 GB)
- Hard disk: Create a virtual hard disk, VDI format, dynamically allocated, 8 GB
-
Before booting, open Settings and adjust:
- System > Motherboard: Uncheck Floppy from boot order. Check Enable EFI (special OSes only).
- System > Processor: Set to 2 CPUs.
- Display: Set video memory to 128 MB.
-
Under Storage, click the empty optical drive and select the Arch Linux ISO.
-
Create a new VM:
- Choose Emulate (Apple Silicon) or Virtualize (Intel).
- Operating System: Other.
- Select the Arch Linux ISO image.
-
Configure resources:
- Memory: 1024 MB
- CPU Cores: 2
- Drive size: 8 GB
-
No shared directory needed. Name the VM and save.
Boot into the Live Environment
Section titled “Boot into the Live Environment”-
Start the VM. Select Arch Linux install medium (x86_64, UEFI) from the boot menu. After about 30 seconds you will land at a root shell prompt.
-
Verify you have an internet connection (the VM’s NAT adapter piggybacks on your host’s network):
Terminal window ping -c 3 archlinux.orgIf this fails, verify that the VM’s network adapter is enabled and set to NAT.
Partition the Disk
Section titled “Partition the Disk”Lecture concept: This section exercises the Filesystem Layout and Disk Management concepts from the lecture. You will create the partition scheme that the lecture describes in the context of /boot/efi, swap, and the root filesystem.
We will create three partitions using GPT: an EFI System Partition, a swap partition, and a root partition.
-
Launch the partitioning tool:
Terminal window gdisk /dev/sda -
Create the EFI System Partition. Type
nfor a new partition. Accept the default partition number (1) and default first sector. For the last sector, type+300M. When prompted for the hex code, enteref00(EFI System Partition).Command (? for help): nPartition number (1-128, default 1):First sector (34-16777182, default = 2048) or {+-}size{KMGTP}:Last sector (...) or {+-}size{KMGTP}: +300MHex code or GUID (L to show codes, Enter = 8300): ef00 -
Create the swap partition. Type
nagain. Accept defaults for partition number (2) and first sector. For the last sector, type+400M. Hex code:8200(Linux swap). -
Create the root partition. Type
nagain. Accept all defaults (partition 3, default first sector, default last sector to use all remaining space). Accept the default hex code8300(Linux filesystem). -
Verify your work. Type
pto print the partition table. You should see something like:Number Start (sector) End (sector) Size Code Name1 2048 616447 300.0 MiB EF00 EFI system partition2 616448 1435647 400.0 MiB 8200 Linux swap3 1435648 16777182 7.3 GiB 8300 Linux filesystem -
Write the partition table. Type
wand confirm withy.
Format the Partitions
Section titled “Format the Partitions”Each partition needs a filesystem before it can hold data. This is what mkfs does, and it is the same concept as the mkfs.ext4 example from the lecture’s disk management section.
# FAT32 on the EFI partition (required by the UEFI specification)mkfs.fat -F32 /dev/sda1
# ext4 on the root partitionmkfs.ext4 -F /dev/sda3
# Initialize and activate swapmkswap /dev/sda2swapon /dev/sda2Mount the Filesystems
Section titled “Mount the Filesystems”Lecture concept: This mirrors the lecture’s discussion of mount points and /etc/fstab. You are manually doing what the “Mount Points” section describes.
# Mount the root partitionmount /dev/sda3 /mnt
# Create and mount the EFI partitionmkdir -p /mnt/boot/efimount /dev/sda1 /mnt/boot/efiInstall the Base System
Section titled “Install the Base System”This step downloads and installs the core Arch Linux packages into your mounted root partition. The pacstrap tool is Arch’s equivalent of running an installer, but it is transparent: you can see exactly which packages it installs.
pacstrap /mnt base linux vimThis installs about 120 packages including the Linux kernel itself. It will take a few minutes depending on your internet speed.
While it runs, generate the filesystem table so the installed system knows how to mount its own partitions at boot:
genfstab -U /mnt > /mnt/etc/fstabEnter the New System
Section titled “Enter the New System”To configure the installed system, you need to “pivot” into it using chroot (change root). This makes /mnt appear as / so that every command you run applies to the installed system, not the live environment.
arch-chroot /mntVerify you are inside the chroot:
pwd# Should output: /Configure Locale and Timezone
Section titled “Configure Locale and Timezone”-
Set the timezone (adjust if you are not on the US West Coast):
Terminal window cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtimedate -
Configure the locale. Open the locale configuration file:
Terminal window vim /etc/locale.genFind and uncomment these two lines (remove the leading
#):en_US.UTF-8 UTF-8en_US ISO-8859-1 -
Generate the locale and set it as default:
Terminal window locale-genecho LANG=en_US.UTF-8 > /etc/locale.confexport LANG=en_US.UTF-8
Install the Bootloader
Section titled “Install the Bootloader”Lecture concept: This section directly exercises the Boot Process section from the lecture. You are installing GRUB2 (the bootloader the lecture describes) and configuring it to chainload from UEFI firmware.
-
Install GRUB and supporting EFI tools:
Terminal window pacman -S grub efibootmgr dosfstools mtools -
Install GRUB to the EFI partition:
Terminal window grub-install --target=x86_64-efi --bootloader-id=arch --recheck -
Generate the GRUB configuration:
Terminal window grub-mkconfig -o /boot/grub/grub.cfg
Configure sudo and Create a User
Section titled “Configure sudo and Create a User”Lecture concept: This section exercises the User and Group Management section from the lecture. You will use useradd, configure the wheel group via visudo, and see the same -m, -G, and -s flags the lecture demonstrates.
-
Install sudo:
Terminal window pacman -S sudo -
Open the sudoers file (never edit it directly, always use
visudo):Terminal window visudoFind and uncomment this line:
%wheel ALL=(ALL) ALLThis grants sudo access to all members of the
wheelgroup, the same concept as Ubuntu’ssudogroup that the lecture describes. -
Create a regular user with a home directory, bash shell, and wheel group membership:
Terminal window useradd -m -G wheel -s /bin/bash archuser -
Set the password:
Terminal window passwd archuser
Reboot into Your New System
Section titled “Reboot into Your New System”-
Exit the chroot:
Terminal window exit -
Eject the ISO from the VM’s virtual optical drive (use your hypervisor’s UI).
-
Reboot:
Terminal window reboot
After a few seconds, GRUB should appear, select Arch Linux, and drop you at a login prompt. Log in as archuser with the password you set.
Configure Networking
Section titled “Configure Networking”Lecture concept: This section exercises the Network Configuration Basics section from the lecture. Where the lecture uses Netplan (Ubuntu’s tool), Arch uses systemd-networkd directly. The underlying concepts are the same: identify the interface, configure an address source (DHCP or static), enable the service.
-
Set a hostname (the lecture covers this with
hostnamectl):Terminal window sudo vim /etc/hostnameType a single word (e.g.,
archbox) and save the file. -
Configure
/etc/hosts:Terminal window sudo vim /etc/hostsAdd these lines:
127.0.0.1 localhost127.0.1.1 archbox.localdomain archbox -
Find your network interface name:
Terminal window ip linkYou will see
lo(loopback) and one other interface, likelyenp0s3or similar. Note the name. -
Create a systemd-networkd configuration file:
Terminal window sudo vim /etc/systemd/network/20-wired.networkAdd the following (substitute your interface name if it differs):
[Match]Name=enp0s3[Network]DHCP=yes -
Enable and start the network service:
Terminal window sudo systemctl enable --now systemd-networkd -
Verify you received an IP address:
Terminal window ip addr showLook for an
inetaddress on your interface (e.g.,10.0.2.15/24). -
Configure DNS so you can resolve domain names:
Terminal window sudo vim /etc/resolv.confAdd:
nameserver 8.8.8.8nameserver 8.8.4.4 -
Test your connection:
Terminal window ping -c 3 archlinux.org
Verify Your Understanding
Section titled “Verify Your Understanding”You have now manually performed every step that an Ubuntu installer does automatically. Take a moment to reflect on these connections:
| What you did in this activity | Lecture section it maps to |
|---|---|
| Created GPT partitions with gdisk | Filesystem Layout and Disk Management |
Formatted with mkfs.ext4, mkfs.fat | Filesystem Layout and Disk Management |
Generated /etc/fstab with genfstab | Mount Points |
| Installed GRUB to the EFI partition | The Boot Process |
Created a user with useradd -m -G -s | User and Group Management |
Configured wheel group via visudo | Privilege Escalation with sudo |
Installed packages with pacman | Package Management |
Enabled services with systemctl enable --now | Systemd Services |
Configured hostname and /etc/hosts | Hostname and /etc/hosts |
| Set up DHCP via systemd-networkd | Network Configuration Basics |
Consider the following questions:
- Partitioning: Why does the EFI System Partition use FAT32 instead of ext4? What would happen if you formatted it as ext4?
- Boot process: The lecture describes four stages (firmware, bootloader, kernel, systemd). Which steps in this activity correspond to each stage?
- Package management: Arch uses
pacmanwhere Ubuntu usesapt. What are the equivalent commands forapt update,apt install, andapt upgradein pacman? - Users: The lecture warns that forgetting the
-aflag withusermod -Greplaces all supplementary groups. Why did we not need the-aflag when we useduseradd -Gto create the user?
Cleanup
Section titled “Cleanup”When you are finished, shut down the VM:
sudo shutdown -h nowYou can delete the VM if you no longer need it, or keep it as a sandbox for experimenting with Linux commands from future lectures.