Arch Linux Core Setup Guide (Terminal-Only)
A complete, minimal, and terminal-based guide to setting up the Arch Linux operating system from scratch.
This guide walks you through installing, securing, and configuring Arch Linux until the system is fully bootable, stable, and ready to be used or extended. It includes base installation, post-install configuration, script automation, and essential system hardening.
It ends when your system is fully installed, secured, and customized in the terminal, ready for GUI setup or headless usage.
It does not cover GUI or window manager setup (e.g., Hyprland, KDE, etc.). That should be handled in a separate post-install customization script or guide.
đ Designed to complement (but simplify) the official Arch Wiki.
đ GUI and desktop configuration should live in a separate script or guide, which this guide helps prepare for.
Note: The install script referenced during this guide was unfortunately deleted by a git push --force
. The only part that remains is the partition automation script shown here. (Yes, I know, lesson learned the hard way :D)
Table of Contents
- Introduction
- Installer Script Overview
- Preparing the Live ISO Environment
- Network Setup, SSH Keys & Running the Auto Installer
- Manual Partitioning
- Running the Installer (Without Auto-Partitioning)
- Post-Installation Configuration: Understanding the Installer Script
- Updating an Existing Arch Installation
Introduction
This guide walks you through setting up a fully functional, secure, and minimal Arch Linux system using only the terminal. It focuses on the core OS, from booting into the live ISO, to installing the base system, to running a post-install script that customizes and hardens your setup.
By the end of this guide, you will have a clean and stable Arch Linux environment, without a GUI, thatâs ready to use, SSH into, or expand with your own scripts (like adding Hyprland, KDE, etc.).
Key Concepts:
- Terminal-only setup: Every step is done in the terminal, from disk formatting to user creation, no GUI is involved.
- Script-friendly design: Post-install tasks (like user setup, localization, hardening) are modular and handled via a customizable script.
- Secure and minimal: The final system has no bloat, follows best practices (e.g., disabled root login), and is ready for remote or local usage.
- Ready for next steps: Once complete, your system can be extended with GUI layers or development tools via your own automation.
Installer Script Overview
This section outlines the layout and logic of the install.sh
script, which automates the installation of your custom OS in a few minutes with a single command. It can also be reused as a backup or recovery tool to recreate your setup from scratch.
Purpose
The script:
- Installs your entire custom Linux OS with one command:
./install.sh
- Can be used repeatedly to restore the same setup on different machines or after wiping a system
- Is written to run in a live ISO environment (e.g. Arch ISO)
Layout
The script is organized into simple, clear sections inside a single file:
Variable Setup
Defines important variables like drive name, mount points, username, hostname, locale, etc.Partitioning
Automatically wipes the disk, creates partitions (EFI, root, optionally swap), and formats them.Mounting
Mounts the new partitions to prepare for installation.Base Installation
Installs the base system, kernel, essential packages, and enables network tools.Chroot Setup
Useschroot
to switch into the newly installed system and continue setup inside it.System Configuration
Sets up locale, timezone, hostname, fstab, users, passwords, sudo access, and bootloader.Package Installation
Installs any extra packages, dotfiles, DE or WM, drivers, and tools you usually use.Cleanup and Finish
Unmounts everything, optionally removes install files, and reboots into the new system.
Why This Layout?
- Everything is in one script, so itâs fast and easy to edit or maintain
- Minimal manual steps, ideal for fast reinstalls or new hardware setups
Preparing the Live ISO Environment
Getting the ISO file
To boot Arch Linux, first download the official .iso
image.
For security and ease of use, torrent download is recommended:
- Download torrent: https://archlinux.org/releng/releases/2025.04.01/torrent/
- Magnet link (copy-paste into your torrent client): magnet:?xt=urn:btih:f0d8c74420b1f845c9b892e44cf595f79b56687b&dn=archlinux-2025.04.01-x86_64.iso
Flashing the ISO to a Drive
Once you have the ISO, flash it to an external drive. Any USB drive larger than 2GB will work.
Use your preferred flashing tool â Rufus is recommended on Windows for simplicity.
After flashing, the drive should be ready to boot.
BIOS Configuration & Booting
Before booting into Arch, configure your BIOS:
- Reset BIOS to defaults (disables Secure Boot and other restrictions).
- Switch storage mode from RAID to AHCI.
- Plug in your bootable drive.
- Boot and select the Arch drive (usually listed under the Windows boot option).
Failing to switch to AHCI will prevent your drive from being detected later.
Disconnecting External Drive
At this point, your Arch system is fully running in RAM, and you no longer need the bootable USB stick. Once the system has booted and you see the prompt root@archiso
, you can safely disconnect the bootable USB drive.
Network Setup, SSH Keys & Running the Auto Installer
You need internet access to proceed.
Check your interfaces:
1
ip link
Find your Wi-Fi interface (usually wlan0
or similar). Then connect to Wi-Fi:
1
iwctl
Inside the iwctl prompt:
1
2
3
station wlan0 scan
station wlan0 get-networks
station wlan0 connect YourNetworkName
Then exit iwctl and verify the connection:
1
ping archlinux.org
If you see responses, youâre online.
SSH Keys Setup
This section is for cloning private repositories from GitHub. If you are cloning a public repository, you can install git and clone it directly without any extra steps.
For private repositories, youâll need SSH keys for authentication. Here is a guide on how to set up SSH keys for GitHub.
Most users, like myself, want to customize their setup in a private repository. To do this, you must use some sort of signing keys. In this case, weâll use GitHub SSH keys. Hereâs the process:
- Create SSH keys on another computer:
- Use
ssh-keygen
to generate a new SSH key pair. - Add the public key to your GitHub account.
- Use
- Transfer the SSH keys to a USB stick:
- After generating the keys, copy the
.ssh
directory from your other computer to a USB drive.
- After generating the keys, copy the
Once youâve set up the USB with your SSH keys, proceed as follows.
First, install git:
1
pacman -Sy git
Then list devices to check whatâs connected:
1
ls /dev/
Now plug in your external drive containing the SSH keys. Run the same command again:
1
ls /dev/
You should see a new entry like sdb
or sda
. Identify the correct partition (e.g. sdb1
or sda1
), then mount it:
1
mount /dev/sdb1 /mnt
Replace
sdb1
with the actual partition name from your device.
Once mounted, copy your SSH folder to root:
1
cp -r /mnt/.ssh /root/
Adjust the path if your
.ssh
folder is stored deeper inside.
Now you should be able to clone private GitHub repositories. Verify with:
1
ssh -T git@github.com
If you get a permission error, fix it with:
1
2
chmod 700 /root/.ssh/id_rsa
chmod 600 /root/.ssh
This ensures proper security permissions for the SSH keys.
Note: This setup runs in RAM and wonât persist unless you also copy the SSH keys again after
chroot
. Donât skip that later step!
However, the automatic script will handle this for you, but itâs still important to note!
IMPORTANT:
Unplug your USB key after copying the SSH keys.
If you leave it in, the system might accidentally mount the OS onto the USB, which you do not want.
Run the Default Installer (Automating Partitioning)
If you want to automate the disk partitioning and full installation (recommended for most users), you can now clone the installer and run it::
1
2
3
git clone git@github.com:CatLover01/LocalWorkspace.git
cd LocalWorkspace
./install.sh -default
Donât forget the
default
flag, it tells the script to use the standard automated partitioning and install flow.
From here, just follow what the installer prompts, and youâre done!
Prefer Manual Partitioning?
If youâd rather manually handle partitioning, continue to the next step.
Manual Partitioning
First, check if your disk is visible:
1
fdisk -l
If your main drive isnât listed, youâre likely still in RAID mode. Go back to BIOS and switch to AHCI, then try again.
To begin partitioning the disk:
1
fdisk /dev/sdX
Replace /dev/sdX
with your actual disk name (e.g. nvme0n1
). This should be the main drive where you want to install Linux. Itâs usually the largest one and appears at the top level of the disk tree (not a partition like nvme0n1p1
, nvme0n1p2
, etc.).
If you want a completely fresh install, itâs usually best to delete all existing partitions on the target drive. Be sure youâve backed up anything important before doing this. All data on the drive will be permanently erased.
To delete all partitions, use the following inside fdisk
:
1
2
3
4
5
d
<Enter>
d
<Enter>
d
Repeat for each partition number until the drive is empty.
Now create your new partitions:
Create EFI (ESP) partition
1 2 3 4 5 6
n <Enter> <Enter> +1G t Select partition type: <EFI System>
(Optional but recommended) Create Swap partition
1 2 3 4 5 6 7
n <Enter> <Enter> +8G t <Enter> Select partition type: <Linux swap>
Create Root partition
/
1 2 3 4 5 6 7
n <Enter> <Enter> <Enter> (uses all remaining space) t <Enter> Select partition type: <Linux filesystem>
Finally, write changes and exit:
1
w
Formatting Partitions
Now that your partitions are created, we need to format them with the correct file systems.
Format the Root Partition
This is where your Linux system will be installed. Weâll use the Btrfs file system, which is recommened over the good old Ext4.
1
mkfs.btrfs /dev/sdX3
Replace
sdX3
with the actual partition for your root (usually the last one you created, e.g.nvme0n1p3
).
Format the Swap Partition (if created)
This partition is used for extra memory if your RAM gets full.
1
mkswap /dev/sdX2
Again, replace
sdX2
with your actual swap partition (e.g.nvme0n1p2
).
Format the EFI System Partition
This is needed for booting on modern (UEFI) systems. It must be FAT32.
1
mkfs.fat -F 32 /dev/sdX1
Only do this if you just created it which is the case if you are moving from Windows to Arch.
If youâre dual booting with Windows or another OS, formatting this can break their boot loaders.
Mounting File Systems
Once formatted, we need to mount the partitions so the installer knows where to put the system.
Mount Root to /mnt
1
mount /dev/sdX3 /mnt
Mount the EFI System Partition to /mnt/boot
1
mount --mkdir /dev/sdX1 /mnt/boot
If your system is using UEFI, this step is required.
BIOS systems donât need an EFI partition.
Enable Swap
1
swapon /dev/sdX2
This turns on the swap space so your system can use it right away.
Once all of these are mounted, we can proceed to run our custom installer in the next step!
Running the Installer (Without Auto-Partitioning)
Clone your workspace:
1
2
git clone git@github.com:CatLover01/LocalWorkspace.git
cd LocalWorkspace
Then run the installer without the default
flag:
1
./install.sh
Since you already prepared your partitions manually, this mode will not erase or reformat any disks. It will use your current mount points and proceed with installation safely.
Once it starts, just follow the prompts, and your system will be set up using your custom layout!
Post-Installation Configuration: Understanding the Installer Script
This is just a list of everything that run in my installer, step by step in this order
Base System
Just run this one-liner:
1
pacstrap -K /mnt base linux linux-firmware
This command installs:
base
: The essential core of Arch Linuxlinux
: The Linux kernellinux-firmware
: Needed firmware for your hardware
fstab
After installing the system, partitioning and formatting the drives, we need to configure the system to automatically mount them on every reboot. The /etc/fstab
file is used to define how and where the drives are mounted.
We can generate this file using the following command, which will automatically detect the UUIDs (or labels) of the partitions and their filesystem types:
1
genfstab -U /mnt >> /mnt/etc/fstab
-U
: This flag tells the command to use UUIDs for the entries, ensuring that the correct drives are mounted even if their order changes./mnt
: This is the root directory of the newly installed Arch system (mounted earlier)./mnt/etc/fstab
: This writes the generated mount entries to thefstab
file in the new system.
After running this command, double-check the /mnt/etc/fstab
file to ensure there are no errors or inconsistencies. If needed, you can manually edit this file to adjust mount options or add additional drives (not recommended).
Chroot
Now that the file systems are mounted and ready, itâs time to chroot into the new system. chroot
(short for âchange rootâ) allows you to enter the new systemâs environment as if it were the root of your filesystem. This is important for configuring the system with proper context as we begin the next stages of setup.
To switch into the new system, use the following command:
1
arch-chroot /mnt
This command mounts your newly installed systemâs root directory (/mnt
) and makes it the root of your current environment, giving you full access to configure the system as though you had just booted into it. While inside the chroot
environment, all commands will be applied directly to the new system, so proceed carefully and make sure youâve completed the next steps before exiting the chroot.
Time
To check your current system time, use the following command:
1
timedatectl status
This will display the current time, time zone, and whether your system clock is synchronized with a time server.
If the time is incorrect and needs to be adjusted, you can set your systemâs time zone and sync the hardware clock with these commands:
1
2
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
In the command above, replace Region/City
with your actual time zone. For example, if youâre in Eastern Canada, use:
1
ln -sf /usr/share/zoneinfo/Canada/Eastern /etc/localtime
Note: The
hwclock
command is useful to sync your systemâs time with the hardware clock, ensuring accurate timekeeping across boots. It sets the hardware clock to the system time, preventing drift across reboots.
Localization
Localization defines your systemâs language and keyboard settings. Arch defaults to English, which is fine for minimal setups, but if you need another language or keyboard layout (like AZERTY, Dvorak, etc.), itâs best to configure that in the install script later on.
For now, weâll just do the basic setup to make the system bootable. Full customization (like switching languages or layouts) will be handled later in the install script.
Run:
1
locale-gen
Then create the following file with:
1
2
3
pacman -S nano
nano /etc/locale.conf
LANG=en_US.UTF-8
Network Configuration
Now set your hostname, this is your computerâs name on the network. Itâs what youâll see in the shell prompt and use for SSH connections, etc.
Edit the hostname file:
1
nano /etc/hostname
â Type your custom hostname (e.g. myarchbox
) and save.
Now configure the hosts file:
1
nano /etc/hosts
â Add the following lines (replace yourhostname
with what you chose above):
1
2
3
127.0.0.1 localhost
::1 localhost
127.0.1.1 yourhostname.localdomain yourhostname
This ensures that your system can resolve its own name and that others can access it via the hostname. Youâll now be able to SSH into the machine or reference it using yourhostname
.
To ensure your network connection persists across reboots, install and enable NetworkManager:
1
pacman -S networkmanager
Then enable it to start on boot:
1
systemctl enable NetworkManager
With this setup, your network will be consistently managed, and youâll have reliable connectivity.
Initramfs
The initramfs (initial RAM filesystem) is a temporary root filesystem that gets loaded into memory at boot before your actual system mounts. It includes essential drivers and tools needed to access the root disk.
To generate it:
1
mkinitcpio -P
Thatâs it, it will automatically include hooks and modules from your config (like encryption or file systems) and prepare the image for booting.
Root Password
Youâll need to set a root password for the initial login. This is only required for the first time you log in, just to allow you to create your main user account and configure sudo access.
Simply set up the root password by running:
1
passwd
â Enter a temporary password that youâll remember for this one-time use.
Once you run your install.sh
script, it will automatically create your main user, configure sudo
access, and disable root login altogether for better security. After that, youâll only use your main user account for elevated commands via sudo
.
Boot Loader
For the boot loader, I recommend using GRUB. Itâs the most stable and flexible option, supporting nearly every possible configuration, unlike some other boot loaders that may not work in certain cases.
To install GRUB, run:
1
pacman -S grub efibootmgr
Next, install GRUB to the EFI system partition:
1
grub-install --target=x86_64-efi --efi-directory=/boot/ --bootloader-id=GRUB
Then, generate the GRUB configuration file:
1
grub-mkconfig -o /boot/grub/grub.cfg
Updating an Existing Arch Installation
If you already have Arch Linux installed and want to update or test changes made to a script, follow these steps:
Plug in your bootable USB drive and reboot your system: reboot
As the system reboots, press F12 (or the key for your boot menu) multiple times to access the bootloader.
From the bootloader menu, select your external bootable drive.
Once the system loads into the Arch ISO, youâll see: You are in Arch ISO!
root@archiso ~ #
Unplug the external bootable drive, the operating system is now running entirely in RAM.
Proceed with network setup, then follow the steps for mounting.
Before Continuing: [Optional but Recommended] Remove Old Data Without Reformatting
If you want to clean the root partition (/mnt
) but donât need to reformat it, run:
1
rm -rf /mnt/* /mnt/.* 2>/dev/null
Warning: Be very careful when using this command. It will remove everything inside
/mnt
, but will not reformat the partition or modify its file system. Only run this command if youâre sure that/mnt
is the correct root partition to clean.
Once youâve finished cleaning (or skipped this step), continue to the next step: Running the Installer
This workflow ensures that you can quickly test changes without needing to repeat partitioning, as the live environment resets every boot.
Partition Automation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
automate_partitioning() {
echo "Starting the automating drive and partition process"
fdisk -l
echo "What drive do you want to format the partitions to?:"
read -r drive
# Partitioning using fdisk
(
echo d # Delete third partition
echo
echo d # Delete second partition
echo
echo d # Delete last partition
# Creating the EFI partition
echo n
echo
echo
echo +1G
echo t
echo 1
# Creating the Swap partition
echo n
echo
echo
echo +8G
echo t
echo
echo 19
# Creating the Root partition
echo n
echo
echo
echo # Use remaining space
echo t
echo
echo 20
echo w # Save and quit
) | fdisk /dev/$drive
# Formatting Partitions
mkfs.btrfs -f /dev/${drive}p3
mkswap /dev/${drive}p2
mkfs.fat -F 32 /dev/${drive}p1
# Mounting File Systems
mount /dev/${drive}p3 /mnt
mount --mkdir /dev/${drive}p1 /mnt/boot
swapon /dev/${drive}p2
echo "Automatic formatting was successful!"
}