Getting Started with Arch Linux: A Beginner’s Guide to Mastering the Basics

ArchLinux

Getting Started with Arch Linux: A Beginner’s Guide to Mastering the Basics

Introduction

Ready to embark on the epic journey of installing Arch Linux? If you’re not yet sure what Linux is or why you’d choose Arch, check out our guide on “What is Linux and Arch Linux” to understand the basics before diving into the installation process.

Awesome! We’re going to do this with MBR (because old school is still cool), a single root partition (because simplicity is king), and we’ll top it off with Xorg and GNOME Shell (because who doesn’t like a shiny, modern desktop?).

Grab your favorite caffeinated beverage, because it’s time to get our hands dirty in the terminal. And remember: in the land of Arch Linux, every mistake is a learning experience!

Step 1: Prepare Your Installation Media

First things first—you’ll need to create a bootable USB drive with the Arch Linux ISO. If you’re on Windows, use something like Rufus; if you’re on Linux, you can use dd or a tool like Balena Etcher.

Download Archlinux

In Linux you can open terminal and use sudo fdisk -l. After install on your disk Arch Linux:

sudo dd bs=4M if=path/to/archlinux.iso of=/dev/sdX status=progress oflag=sync

Once you’ve got your USB ready, plug it in and reboot your computer. Boot from the USB drive to start the installation process.

Step 2: Set the Keyboard Layout

After booting into the Arch installation environment, set your keyboard layout if necessary. If you’re using a standard US keyboard, you can skip this step. Otherwise, use:

localectl list-keymaps
loadkeys your-keyboard-layout

Step 3: Connect to the Internet

Make sure you’re connected to the internet. If you’re using Ethernet, you’re probably already connected. If you’re using Wi-Fi, you’ll need to use iwctl to connect:

iwctl

Then, in the interactive prompt:

device list
station wlan0 scan
station wlan0 get-networks
station wlan0 connect your-network-name
exit

Replace wlan0 with your Wi-Fi device name and your-network-name with your Wi-Fi network name.

Check your connection with:

ping archlinux.org

Step 4: Partition the Disk with MBR

Now, let’s partition the disk. We’re going to use MBR, and for simplicity, we’ll create a single root partition that contains everything.

Start fdisk with:

fdisk /dev/sdX

Replace X with the letter corresponding to your drive (e.g., sda). For additional control, use fdisk -l.

  1. Select o for MBR when prompted.
  2. Create a new partition for the root:
    • Choose n.
    • Choose Primary.
  3. Press Enter twice to accept the default values for the first and last sector.

Exit fdisk when done.

Step 5: Format the Partition

Next, format the partition as ext4:

mkfs.ext4 /dev/sdX1

Replace X1 with your partition (e.g., sda1). For additional control, use fdisk -l.

Step 6: Mount the Partition

Now, mount the partition to /mnt:

mount /dev/sdX1 /mnt

Step 7: Install the Base System

Time to install the base system. Run:

pacstrap -K /mnt base base-devel linux linux-firmware gvim man

Step 8: Generate the fstab File

Generate an fstab file so your system knows where everything is:

genfstab -U /mnt >> /mnt/etc/fstab

For control, you can find your UUIDs:

blkid | grep sdX

You should see something like this /dev/sda1: UUID="0a8efcfd-4bad-406a-a13b-93112fc4bc45" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="bbb7fc8b-01"

Make sure the UUIDs match your partitions.

If you are a VIM expert, use vim /mnt/etc/fstab. You can read Getting Started with Vim. Otherwise use Nano:

nano /mnt/etc/fstab

Example:

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>

# /dev/sda1
UUID=0a8efcfd-4bad-406a-a13b-93112fc4bc45	/         	ext4      	rw,relatime	0 1

Step 9: Chroot into the New System

Change root into your newly installed system:

arch-chroot /mnt

Step 10: Set the Time Zone

Set your time zone:

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Replace Region/City with your actual time zone (e.g., America/New_York).

Sync the hardware clock:

hwclock --systohc

Step 11: Localization

Uncomment your locale in /etc/locale.gen, then generate the locales:

locale-gen

Create the locale configuration file:

echo "LANG=en_US.UTF-8" > /etc/locale.conf

Replace en_US.UTF-8 with your preferred locale.

Step 12: Network Configuration

Create a hostname file:

echo "myhostname" > /etc/hostname

Edit /etc/hosts to add the following:

nano /etc/hosts
127.0.0.1   localhost
::1         localhost
127.0.1.1   myhostname.localdomain myhostname

Replace myhostname with your chosen hostname.

Step 13: Set the Root Password

Set the root password:

passwd

Step 14: Install the Bootloader

Install GRUB for MBR:

pacman -S grub
grub-install --target=i386-pc /dev/sdX
vim /etc/default/grub

Modify the GRUB_DISABLE_OS_PROBER line in the file:

...
GRUB_DISABLE_OS_PROBER=false
...
grub-mkconfig -o /boot/grub/grub.cfg

Replace sdX with your disk (e.g., sda). For additional control, use fdisk -l.

Step 15: Users

useradd -m -G users,wheel,video -s /bin/bash admin
passwd admin

Step 16: Install Xorg and GNOME

Now, let’s install Xorg and GNOME, and other essential apps:

pacman -S gnome-shell gdm gnome-disk-utility archlinux-keyring alacritty xorg-xinit network-manager-applet dnsmasq ttf-dejavu ttf-droid wqy-zenhei noto-fonts-emoji sudo grub gst-libav ntfs-3g gnome-control-center git gnome-keyring gnome-applets wget rsync

Enable GDM, NetworkManager to start at boot:

systemctl enable gdm.service
systemctl enable NetworkManager.service

Step 17: Intel or AMD

pacman -S intel-ucode

or

pacman -S amd-ucode

Step 18: Choose Video Driver

pacman -S xf86-video-fbdev
pacman -S xf86-video-intel
pacman -S xf86-video-amdgpu
pacman -S xf86-video-ati
pacman -S xf86-video-vesa
pacman -S xf86-video-nouveau

You always can install all if you don’t know.

Step 19: Sudo add and Wayland off

nano /etc/sudoers
...
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
...
nano /etc/gdm/custom.conf
...
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
...

Step 20: Reboot and Enjoy

Exit the chroot environment, unmount the partitions, and reboot:

exit
umount -R /mnt
reboot

Conclusion

You can open wiki to customize. Because Arch Linux is like LEGO. And there you have it! Your new Arch Linux system is up and running with MBR, a single root partition, Xorg, and GNOME Shell. Now, go ahead and start customizing your setup, and welcome to the Arch Linux community!


See also