How to Set Up a Minimal Arch Linux Installation
Categories:
6 minute read
Arch Linux is a lightweight and flexible Linux distribution that is highly customizable. Unlike other mainstream distributions, Arch Linux provides the user with complete control over the installation process, allowing for a minimal system that can be expanded as needed. Setting up a minimal Arch Linux installation can be an educational and rewarding experience for those interested in learning more about Linux internals, system administration, and custom setups. This guide will walk you through the steps to perform a minimal installation of Arch Linux on your system.
Prerequisites
Before we dive into the installation process, make sure you have the following prerequisites:
- A computer with a compatible x86_64 architecture (Intel or AMD processors).
- A USB drive (at least 2 GB) for the Arch Linux installation media.
- A stable internet connection (for downloading packages).
- A basic understanding of Linux commands, especially using the terminal.
You can perform the installation on a physical machine or a virtual machine (VM) using a tool like VirtualBox or VMware.
Step 1: Download the Arch Linux ISO
The first step is to download the Arch Linux installation ISO. You can obtain the latest version of the Arch Linux ISO image from the official website:
Choose a mirror close to your location and download the archlinux-x86_64.iso file. After downloading the ISO, you can write it to a USB drive using tools like Rufus (on Windows) or dd (on Linux).
Step 2: Boot from the Installation Media
Once you have prepared the bootable USB drive, insert it into the target machine and restart the system. Access the boot menu by pressing the appropriate key during the startup (usually F12, F2, or Esc, depending on the manufacturer). Select the USB drive as the boot device.
The system should boot into the Arch Linux live environment. Once booted, you will be presented with a command line interface (CLI), where you can begin the installation process.
Step 3: Set Up Keyboard Layout
The default keyboard layout on Arch Linux is US QWERTY. If you are using a different layout, you can change it by using the loadkeys command. For example, to set the layout to German, you would run:
loadkeys de
You can check the available layouts with the following command:
ls /usr/share/kbd/keymaps/i386/qwerty/
Step 4: Verify Internet Connection
Arch Linux requires an active internet connection for package installation. If you’re using Ethernet, the connection should be automatically established. However, if you’re using Wi-Fi, you’ll need to configure the wireless interface.
To check if you’re connected to the internet, you can use the following command:
ping -c 3 archlinux.org
If the connection fails, you can connect to a Wi-Fi network using iwctl (for iwd). Here’s how:
- Type
iwctlto enter the interactive mode. - Use the
device listcommand to list available Wi-Fi devices. - Scan for available networks with the
station device scancommand. - Connect to a network using
station device connect SSID, replacing “device” with your network interface and “SSID” with the name of your Wi-Fi network.
Once connected, exit iwctl by typing exit.
Step 5: Update the System Clock
Before proceeding, it is essential to ensure that your system clock is accurate. This can be done with the following command:
timedatectl set-ntp true
This will enable Network Time Protocol (NTP) to keep your system clock synchronized.
Step 6: Partition the Disk
The next step is to partition the disk. Arch Linux does not have an installer that automates this process, so you’ll need to do it manually. For the sake of simplicity, we will assume you’re using a single disk setup, but feel free to adapt the steps to your needs.
List the available storage devices with:
lsblk
You should see something like /dev/sda or /dev/nvme0n1, depending on your system’s storage device.
To partition the disk, use the fdisk tool:
fdisk /dev/sda
Here are some common steps:
- Create a new partition table by typing
gfor GPT (recommended for modern systems). - Create partitions using the
ncommand. You typically need at least two partitions: one for the root filesystem (/) and one for swap. - Set partition types by typing
tfor the root partition (type83for Linux). - After creating partitions, type
wto write the changes.
Step 7: Format the Partitions
Now that you have created the partitions, the next step is to format them. For example, let’s assume you created the following partitions:
/dev/sda1for the root (/) filesystem./dev/sda2for swap.
To format the root partition with the ext4 filesystem, run:
mkfs.ext4 /dev/sda1
If you created a swap partition, you can enable it with:
mkswap /dev/sda2
swapon /dev/sda2
Step 8: Mount the Filesystems
Now, mount the root partition to /mnt:
mount /dev/sda1 /mnt
If you have additional partitions, like a separate boot partition, mount them as well:
mount /dev/sdaX /mnt/boot
Replace /dev/sdaX with the appropriate partition name.
Step 9: Install the Base System
With the partitions mounted, it’s time to install the base system. Arch Linux provides a package called base that contains the essential packages needed to run a minimal Arch installation.
Run the following command to install the base system:
pacstrap /mnt base linux linux-firmware
This command will install the basic Arch system, including the Linux kernel and necessary firmware.
Step 10: Configure the System
Once the installation completes, you can proceed to configure your system.
Generate fstab:
The fstab file is used to define how partitions should be mounted. Generate it with the following command:
genfstab -U /mnt >> /mnt/etc/fstabChroot into the system:
Change root into the newly installed system:
arch-chroot /mntSet the timezone:
Set the system timezone using
ln:ln -sf /usr/share/zoneinfo/Region/City /etc/localtimeReplace
Region/Citywith your actual timezone, such asAmerica/New_York.Sync the hardware clock:
Run the following command to sync the hardware clock with the system time:
hwclock --systohcSet the locale:
Uncomment your locale in
/etc/locale.gen:nano /etc/locale.genUncomment a line that corresponds to your region, such as
en_US.UTF-8 UTF-8, and then generate the locale:locale-genSet the hostname:
Set the hostname for your system:
echo "myhostname" > /etc/hostnameConfigure the hosts file:
Edit
/etc/hoststo add an entry for localhost:nano /etc/hostsAdd the following lines:
127.0.0.1 localhost ::1 localhost 127.0.1.1 myhostname.localdomain myhostnameSet the root password:
Set the root password by running:
passwd
Step 11: Install and Configure a Bootloader
Now, install a bootloader to boot your Arch Linux system. GRUB is a popular choice for bootloaders.
To install GRUB:
pacman -S grub
Install GRUB to the disk:
grub-install --target=i386-pc /dev/sda
For UEFI systems, use this command instead:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
Generate the GRUB configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
Step 12: Reboot and Test the System
Exit the chroot environment:
exit
Unmount the partitions:
umount -R /mnt
Finally, reboot the system:
reboot
Remove the installation media, and your Arch Linux system should boot into the login prompt.
Conclusion
You have now set up a minimal Arch Linux installation. From here, you can begin to customize your system to suit your needs, such as installing a desktop environment, configuring network settings, and adding additional software packages. The Arch Wiki is an excellent resource for further customization and troubleshooting.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.