How to Build Your Own Operating System
Arch Linux embraces minimalism, allowing users to build any functionality they desire. This guide walks you through setting up your own Arch Linux system on a physical machine.
Preparation
You’ll need: a computer, a USB drive (or any removable storage device), an internet connection, and basic research skills.
- Regardless of the installation image you choose, even for offline setups, I recommend having an internet connection to ensure kernel and tool updates. If you’re experienced, you can decide otherwise.
- For Wi-Fi, ensure the network name is in English, as the tty environment cannot display non-ASCII characters, which will appear as unreadable blocks.
- If you plan to dual-boot on the same drive, allocate sufficient disk space for Arch Linux—at least 100GB is recommended for future software installations. Ensure the EFI partition is at least 256MB or create an additional mount point.
- Check if your Windows 10 partition uses BitLocker encryption. Obtain the recovery key in advance and disable Fast Startup in the power settings!
Before proceeding, carefully read and research anything you don’t understand. Operate cautiously, back up regularly—data is priceless.
Creating the Installation Media
- Download the installation image only from the official Arch Linux download page. Note that Arch Linux is a rolling-release distribution.
- If you want to compile your own kernel, refer to the Kernel/Traditional compilation guide.
- For the official installation image, I recommend using Ventoy to create a bootable USB.
Base Installation
1. Booting from the Arch Linux Media
Power off, insert the USB drive, and start the computer. Enter the BIOS, select the USB as the boot device, choose the first option, and press Enter to access the Arch Linux installation environment.
2. UEFI Check
systemctl stop reflector.service
# Disable automatic mirror updates, as geographic network conditions may cause issues.ls /sys/firmware/efi/efivars
# If a list of EFI variables is displayed, the system is booted in UEFI mode. Most machines in 2025 use UEFI.3. Network Setup
Arch Linux installation requires an internet connection. Offline installation is more complex; see the Offline installation guide.
For wired connections, plug in the Ethernet cable, check if the interface LED blinks, and wait a few seconds for the connection to establish.
In a campus network, authentication may be required via an upstream router. Refer to the nbtverify project.
For Wi-Fi, use
iwctlto connect.
lspci -k | grep Network
# Check if the wireless adapter is working. Skip this if you’re sure it’s functional.Verify if the kernel has loaded the wireless driver.
You should see something like:
00:14.3 Network controller: Intel Corporation Wi-Fi 6 AX201 (rev 20).If nothing appears, check if the wireless connection is disabled (blocked: yes).
rfkill list
# The wireless adapter is usually named wlan0.ip link set wlan0 up
# If you see an error like “Operation not possible due to RF-kill,” run:
rfkill Unblock wifi# Connect to Wi-Fi using iwctl
iwctl # Enter interactive mode
device list # List wireless devices, e.g., wlan0
station wlan0 scan # Scan for networks
station wlan0 get-networks # List available Wi-Fi networks
station wlan0 connect wifi-name # Connect to the network. Non-ASCII names are not supported. Enter the password when prompted.
exit # Exit after connecting
ping www.google.com # Test network connectivityFor network configuration issues, refer to Network configuration/Wireless.
5. Sync System Clock
timedatectl set-ntp true # Sync system time with network time
timedatectl status # Check service status6. Update Mirror List (Optional for U.S. Users)
vim /etc/pacman.d/mirrorlist # Edit the mirror list if needed
Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch # Kernel.org mirror
Server = https://mirrors.mit.edu/archlinux/$repo/os/$arch # MIT mirror
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch # Rackspace mirror7. Create Btrfs Partitions
Check Disk Information
lsblkReview the current partition layout. Carefully identify the target disk for Arch Linux installation.
Disk naming conventions:
- SATA drives:
sda,sdb,sdc… Partitions:sda1,sda2, etc. - NVMe drives:
nvme0n1,nvme1n1… Partitions:nvme0n1p1,nvme0n1p2, etc.
This example uses a SATA disk. Replace
/dev/sdxwith your actual disk.
cfdisk /dev/sdxYou should see a user-friendly TUI partitioning interface. 😄
Partitioning Steps
1. Create Swap Partition
- Use arrow keys to select Free space.
- Press
[New], press Enter, and enter the size (recommended: 60%–100% of RAM). - Press
[Type]and select Linux swap.
2. Create Root Partition (for Btrfs)
- Select the remaining Free space, press
[New], and press Enter. - Enter the size (default: use all remaining space).
- Keep the type as the default Linux filesystem.
3. Write Partition Table
- Select
[Write], typeyes, and press Enter.⚠️ Note: Changes won’t take effect until written!
Format Partitions
Recheck Disks
fdisk -lFormat EFI Partition (if creating a new one)
mkfs.fat -F32 /dev/sdxn💡 For dual-boot users, you can reuse the Windows EFI partition without formatting, but ensure it has enough space. See Dual boot with Windows.
Format Swap Partition
mkswap /dev/sdxnFormat Btrfs Partition
mkfs.btrfs -L myArch /dev/sdxnCreate and Mount Btrfs Subvolumes
mount -t btrfs -o compress=zstd /dev/sdxn /mnt
# Create subvolumes
btrfs subvolume create /mnt/@ # Root subvolume
btrfs subvolume create /mnt/@home # /home subvolume
umount /mnt⚠️ Final Reminder
- Double-check all commands and operations!
- Mistakes can lead to data loss, especially deleting Windows partitions 😥.
8. Mount Partitions, Starting with Root
mount -t btrfs -o subvol=/@,compress=zstd /dev/sdxn /mnt # Mount / directory
mkdir /mnt/home # Create /home directory
mount -t btrfs -o subvol=/@home,compress=zstd /dev/sdxn /mnt/home # Mount /home directory
mkdir -p /mnt/boot # Create /boot directory
mount /dev/sdxn /mnt/boot # Mount /boot directory
swapon /dev/sdxn # Enable swap partitiondf -h # Check mounts
free -h # Verify swap partition mount9. Install the System
pacstrap /mnt base base-devel linux linux-firmware btrfs-progs
# Install btrfs-progs if using Btrfspacman -S archlinux-keyring
# If you encounter GPG key errors, it may be due to an outdated image. Update archlinux-keyring to resolve.pacstrap /mnt networkmanager vim sudo zsh zsh-completions
# Install essential functional packages with pacstrap10. Generate fstab File
Generate fstab to define disk partitions, based on current mounts.
genfstab -U /mnt > /mnt/etc/fstab11. Enter the New System
arch-chroot /mnt
# Lost code highlighting? Don’t worry—you’ve successfully chrooted!12. Set Hostname and Time Zone
vim /etc/hostname
# Choose a hostname (avoid special characters or spaces to prevent issues; omitting a hostname can cause GUI apps to fail unexpectedly).vim /etc/hosts
# Edit the hosts fileAdd the following (replace myarch with your hostname, use tabs for alignment):
127.0.0.1 localhost
::1 localhost
127.0.1.1 myarch.localdomain myarchln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
# Create a symlink for the New York time zone (adjust as needed)ls /usr/share/zoneinfo/
# Check available time zones and update the command above if needed13. Hardware Clock Setup
hwclock --systohc
# Sync system time to hardware clock14. Set Locale
vim /etc/locale.gen
# Edit /etc/locale.gen, uncomment en_US.UTF-8 UTF-8
# This determines the language and character set for softwarelocale-gen
# Generate localeecho 'LANG=en_US.UTF-8' > /etc/locale.conf
# Set locale.conf15. Set Root Password
passwd root
# Password input is hidden—not a keyboard issue! 😄16. Install Microcode
pacman -S intel-ucode # For Intel CPUs
pacman -S amd-ucode # For AMD CPUs17. Install Grub Bootloader
pacman -S grub efibootmgr os-prober
# grub is the bootloader, efibootmgr writes boot entries to NVRAM, os-prober enables Windows 10 detectiongrub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH
# Install grub to the EFI partitionvim /etc/default/grub
# Edit boot parameters# Change "loglevel=3 quiet" to "loglevel=5 nowatchdog"
# Add at the end: GRUB_DISABLE_OS_PROBER=false- Remove the
quietparameter from GRUB_CMDLINE_LINUX_DEFAULT. - Change
loglevelfrom 3 to 5 for better error debugging. - Add
nowatchdogto improve boot/shutdown speed. - Enable
os-proberfor Windows 10 detection.
grub-mkconfig -o /boot/grub/grub.cfg
# Generate grub configuration file
# If Windows 10 is detected, you’ll see output like: “Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi done”
# If Windows is on another disk, re-mount and rerun this command after booting.See Arch Wiki for all parameters.
18. Complete Installation
exit # Return to the installation environment
umount -R /mnt # Unmount new partitions
reboot # RebootLog in with the root account after reboot.
systemctl enable --now NetworkManager # Enable and start NetworkManager service
ping www.google.com # Test network connectivityFor Wi-Fi:
nmcli dev wifi list # List nearby Wi-Fi networks
nmcli dev wifi connect "Wi-Fi SSID" password "network password" # Connect to a Wi-Fi networknmtui
# I prefer nmtui—it’s user-friendly! 😄pacman -S fastfetch
fastfetch
# Install fastfetch to check system info
# Time for the classic neofetch moment! 😄shutdown 0
shutdown -h now
poweroff
# All three commands shut down the system. 😄 Shut down properly, as power policies aren’t configured yet.Congratulations 🎉
You’ve successfully installed a minimal, non-graphical Arch Linux system!
A graphical interface guide will be included in the next update, but as always: read the manual!
This guide is a starting point, hoping to inspire more enthusiasts to join the tech community!
Related: NBTCA
- 📧 NBTCA Email: contact@nbtca.com
- 🌐 NBTCA GitHub: https://github.com/nbtca