Arch Linux Installation from Scratch | Comprehensive guide on installing Arch Linux
This guide provides a comprehensive walkthrough for installing Arch Linux from a live disk, configuring GRUB as the bootloader, and selecting the recommended filesystem. Beginning with booting from the live disk, users are guided through partitioning, mounting, and installing the base system. Configuration steps cover timezone, localization, network settings, and the installation of GRUB.
<details id="toc-wrapper" style="border: 1px solid var(--primary-color, #444444); padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 0.25em;">
<summary style="cursor: pointer; font-weight: 600;">Table of Contents</summary>
<nav id="TOC" role="doc-toc" style="margin-top: 0.75rem; text-align: left;">
<ul>
<li><a href="#prepare-installation-media" id="toc-prepare-installation-media"><span class="toc-section-number">1</span> Prepare Installation Media</a></li>
<li><a href="#verify-boot-and-network" id="toc-verify-boot-and-network"><span class="toc-section-number">2</span> Verify Boot and Network</a></li>
<li><a href="#update-system-clock" id="toc-update-system-clock"><span class="toc-section-number">3</span> Update System Clock</a></li>
<li><a href="#partition-the-disk" id="toc-partition-the-disk"><span class="toc-section-number">4</span> Partition the Disk</a></li>
<li><a href="#install-base-system" id="toc-install-base-system"><span class="toc-section-number">5</span> Install Base System</a></li>
<li><a href="#chroot-into-installed-system" id="toc-chroot-into-installed-system"><span class="toc-section-number">6</span> Chroot into Installed System</a></li>
<li><a href="#timezone-clock" id="toc-timezone-clock"><span class="toc-section-number">7</span> Timezone & Clock</a></li>
<li><a href="#localization" id="toc-localization"><span class="toc-section-number">8</span> Localization</a></li>
<li><a href="#hostname-networking" id="toc-hostname-networking"><span class="toc-section-number">9</span> Hostname & Networking</a></li>
<li><a href="#set-root-password" id="toc-set-root-password"><span class="toc-section-number">10</span> Set Root Password</a></li>
<li><a href="#install-grub-bootloader" id="toc-install-grub-bootloader"><span class="toc-section-number">11</span> Install GRUB Bootloader</a></li>
<li><a href="#create-a-user" id="toc-create-a-user"><span class="toc-section-number">12</span> Create a User</a></li>
<li><a href="#reboot" id="toc-reboot"><span class="toc-section-number">13</span> Reboot</a></li>
<li><a href="#post-installation-setup" id="toc-post-installation-setup"><span class="toc-section-number">14</span> Post-Installation Setup</a></li>
</ul>
</nav>
</details>
<h1 data-number="1" id="prepare-installation-media"><span class="header-section-number">1</span> Prepare Installation Media</h1>
<ol type="1">
<li>Download the latest Arch Linux ISO: <a href="https://archlinux.org/download/" class="uri">https://archlinux.org/download/</a></li>
<li>Create a bootable USB (macOS/Linux example using <code>dd</code>):</li>
</ol>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sudo</span> dd if=archlinux-YYYY.MM.DD-x86_64.iso of=/dev/sdX bs=4M status=progress oflag=sync</span></code></pre></div>
<ol start="3" type="1">
<li>Boot your system from the USB and select <strong>UEFI mode</strong>.</li>
</ol>
<h1 data-number="2" id="verify-boot-and-network"><span class="header-section-number">2</span> Verify Boot and Network</h1>
<ol type="1">
<li>Verify UEFI boot:</li>
</ol>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ls</span> /sys/firmware/efi/efivars</span></code></pre></div>
<ol start="2" type="1">
<li>Verify internet connection:</li>
</ol>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ping</span> <span class="at">-c</span> 3 archlinux.org</span></code></pre></div>
<ol start="3" type="1">
<li>Connect to Wi-Fi using <code>iwctl</code>:</li>
</ol>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">iwctl</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">device</span> list</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="ex">station</span> <span class="op"><</span>device<span class="op">></span> scan</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="ex">station</span> <span class="op"><</span>device<span class="op">></span> get-networks</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">station</span> <span class="op"><</span>device<span class="op">></span> connect <span class="op"><</span>SSID<span class="op">></span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="bu">exit</span></span></code></pre></div>
<h1 data-number="3" id="update-system-clock"><span class="header-section-number">3</span> Update System Clock</h1>
<div class="sourceCode" id="cb5"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">timedatectl</span> set-ntp true</span></code></pre></div>
<h1 data-number="4" id="partition-the-disk"><span class="header-section-number">4</span> Partition the Disk</h1>
<p>List disks:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">lsblk</span></span></code></pre></div>
<p>Partition with <code>cfdisk</code>:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">cfdisk</span> /dev/sda</span></code></pre></div>
<blockquote>
<p><strong>Note:</strong> Device names vary — SATA drives use <code>/dev/sda</code>, NVMe drives use <code>/dev/nvme0n1</code>.</p>
</blockquote>
<p>Example partition scheme:</p>
<table>
<thead>
<tr class="header">
<th>Partition</th>
<th>Size</th>
<th>Type</th>
<th>Format</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>/dev/sda1</td>
<td>512 MB</td>
<td>EFI</td>
<td>FAT32</td>
</tr>
<tr class="even">
<td>/dev/sda2</td>
<td>20–50 GB</td>
<td>Root</td>
<td>ext4</td>
</tr>
<tr class="odd">
<td>/dev/sda3</td>
<td>Remaining</td>
<td>Home</td>
<td>ext4</td>
</tr>
<tr class="even">
<td>/dev/sda4</td>
<td>Swap</td>
<td>Swap</td>
<td>swap</td>
</tr>
</tbody>
</table>
<p>Format partitions:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">mkfs.fat</span> <span class="at">-F32</span> /dev/sda1</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">mkfs.ext4</span> /dev/sda2</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">mkfs.ext4</span> /dev/sda3</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="ex">mkswap</span> /dev/sda4</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a><span class="ex">swapon</span> /dev/sda4</span></code></pre></div>
<p>Mount partitions:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mount</span> /dev/sda2 /mnt</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">mkdir</span> /mnt/boot</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="fu">mount</span> /dev/sda1 /mnt/boot</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="fu">mkdir</span> /mnt/home</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="fu">mount</span> /dev/sda3 /mnt/home</span></code></pre></div>
<h1 data-number="5" id="install-base-system"><span class="header-section-number">5</span> Install Base System</h1>
<div class="sourceCode" id="cb10"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">pacstrap</span> /mnt base linux-lts linux-firmware base-devel vim sudo git e2fsprogs iwd openssh man-db man-pages texinfo</span></code></pre></div>
<p>Generate filesystem table:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">genfstab</span> <span class="at">-U</span> /mnt <span class="op">>></span> /mnt/etc/fstab</span></code></pre></div>
<h1 data-number="6" id="chroot-into-installed-system"><span class="header-section-number">6</span> Chroot into Installed System</h1>
<div class="sourceCode" id="cb12"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">arch-chroot</span> /mnt</span></code></pre></div>
<h1 data-number="7" id="timezone-clock"><span class="header-section-number">7</span> Timezone & Clock</h1>
<div class="sourceCode" id="cb13"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ln</span> <span class="at">-sf</span> /usr/share/zoneinfo/Region/City /etc/localtime</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="ex">hwclock</span> <span class="at">--systohc</span></span></code></pre></div>
<h1 data-number="8" id="localization"><span class="header-section-number">8</span> Localization</h1>
<p>Edit <code>/etc/locale.gen</code> and uncomment:</p>
<pre class="text"><code>en_US.UTF-8 UTF-8</code></pre>
<p>Generate locales:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">locale-gen</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">"LANG=en_US.UTF-8"</span> <span class="op">></span> /etc/locale.conf</span></code></pre></div>
<p>Set keyboard layout:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">"KEYMAP=us"</span> <span class="op">></span> /etc/vconsole.conf</span></code></pre></div>
<h1 data-number="9" id="hostname-networking"><span class="header-section-number">9</span> Hostname & Networking</h1>
<div class="sourceCode" id="cb17"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">"myhostname"</span> <span class="op">></span> /etc/hostname</span></code></pre></div>
<p>Add hosts entries:</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> <span class="op">>></span> /etc/hosts <span class="op"><<EOF</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="st">127.0.0.1 localhost</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="st">::1 localhost</span></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="st">127.0.1.1 myhostname.localdomain myhostname</span></span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a><span class="op">EOF</span></span></code></pre></div>
<p>Enable networking services:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">systemctl</span> enable iwd</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="ex">systemctl</span> enable sshd</span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="ex">systemctl</span> enable systemd-resolved</span></code></pre></div>
<h1 data-number="10" id="set-root-password"><span class="header-section-number">10</span> Set Root Password</h1>
<div class="sourceCode" id="cb20"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="fu">passwd</span></span></code></pre></div>
<h1 data-number="11" id="install-grub-bootloader"><span class="header-section-number">11</span> Install GRUB Bootloader</h1>
<div class="sourceCode" id="cb21"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">pacman</span> <span class="at">-S</span> grub efibootmgr</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="ex">grub-install</span> <span class="at">--target</span><span class="op">=</span>x86_64-efi <span class="at">--efi-directory</span><span class="op">=</span>/boot <span class="at">--bootloader-id</span><span class="op">=</span>GRUB</span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a><span class="ex">grub-mkconfig</span> <span class="at">-o</span> /boot/grub/grub.cfg</span></code></pre></div>
<h1 data-number="12" id="create-a-user"><span class="header-section-number">12</span> Create a User</h1>
<div class="sourceCode" id="cb22"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="ex">useradd</span> <span class="at">-m</span> <span class="at">-G</span> wheel <span class="at">-s</span> /usr/bin/zsh nana</span>
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a><span class="fu">passwd</span> nana</span></code></pre></div>
<p>Edit sudoers:</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="ex">visudo</span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a><span class="co"># Uncomment: %wheel ALL=(ALL) ALL</span></span></code></pre></div>
<h1 data-number="13" id="reboot"><span class="header-section-number">13</span> Reboot</h1>
<p>Exit chroot, unmount, and reboot:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="bu">exit</span></span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a><span class="fu">umount</span> <span class="at">-R</span> /mnt</span>
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a><span class="ex">reboot</span></span></code></pre></div>
<p>Remove the USB and boot into your fresh Arch Linux installation.</p>
<h1 data-number="14" id="post-installation-setup"><span class="header-section-number">14</span> Post-Installation Setup</h1>
<ol type="1">
<li>Log in as your user.</li>
<li>Install Paru (AUR helper):</li>
</ol>
<div class="sourceCode" id="cb25"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> clone https://aur.archlinux.org/paru.git</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> paru</span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a><span class="ex">makepkg</span> <span class="at">-si</span></span></code></pre></div>
<ol start="3" type="1">
<li>Create standard directories:</li>
</ol>
<div class="sourceCode" id="cb26"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mkdir</span> <span class="at">-p</span> ~/Applications ~/Documents ~/Desktop ~/Downloads</span></code></pre></div>
<ol start="4" type="1">
<li>Setup SSH keys (choice of ed25519 or rsa):</li>
</ol>
<div class="sourceCode" id="cb27"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ssh-keygen</span> <span class="at">-t</span> ed25519 <span class="at">-C</span> <span class="st">"you@example.com"</span> <span class="at">-f</span> ~/.ssh/id_ed25519 <span class="at">-N</span> <span class="st">""</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="fu">ssh-keygen</span> <span class="at">-t</span> rsa <span class="at">-b</span> 4096 <span class="at">-C</span> <span class="st">"you@example.com"</span> <span class="at">-f</span> ~/.ssh/id_rsa <span class="at">-N</span> <span class="st">""</span></span></code></pre></div>
<ol start="5" type="1">
<li>Add user to audio group:</li>
</ol>
<div class="sourceCode" id="cb28"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a><span class="ex">usermod</span> <span class="at">-aG</span> audio nana</span></code></pre></div>
<ol start="6" type="1">
<li>List fonts:</li>
</ol>
<div class="sourceCode" id="cb29"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="ex">fc-list</span></span></code></pre></div>
<ol start="7" type="1">
<li>Setup Bluetooth:</li>
</ol>
<div class="sourceCode" id="cb30"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="ex">bluetoothctl</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="ex">power</span> on</span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a><span class="ex">discoverable</span> on</span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a><span class="ex">pairable</span> on</span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a><span class="ex">scan</span> on</span>
<span id="cb30-6"><a href="#cb30-6" aria-hidden="true" tabindex="-1"></a><span class="ex">pair</span> <span class="op"><</span>MAC<span class="op">></span></span>
<span id="cb30-7"><a href="#cb30-7" aria-hidden="true" tabindex="-1"></a><span class="ex">trust</span> <span class="op"><</span>MAC<span class="op">></span></span>
<span id="cb30-8"><a href="#cb30-8" aria-hidden="true" tabindex="-1"></a><span class="ex">connect</span> <span class="op"><</span>MAC<span class="op">></span></span></code></pre></div>
<p>Your minimal Arch Linux system is now installed and ready for further customization.</p>
Comments
No comments yet
Be the first to comment!