Computer >> Computer tutorials >  >> System >> Linux

How to Install Arch Linux

How to Install Arch Linux

Unlike Ubuntu or Linux Mint, Arch Linux is a rolling release Linux distribution, which means you just have to install it once, and it will continuously update itself to the latest version. It is also a barebones distribution that gives you complete control over what you want to install on your system. The best thing of all is the Arch wiki, which is one of the best in the Linux community.

The one thing of note about Arch Linux is its installation process. It is not for the faint-hearted. If you are keen to get Arch Linux on your system, this guide shows how to install it.

Getting Started

Before you can install Arch Linux, you need to first download the ISO file and burn it into a USB drive or DVD.

1. Go to Arch Linux’s Download page, and download the ISO file (under the HTTP Direct Downloads section).

2. Using a tool like balenaEtcher, create a bootable USB drive.

3. Once you are done creating the bootable drive, insert it into your computer and boot into it.

Note: To install Arch Linux on your computer, it is best that your computer is connected to a wired connection. Wireless connection will require more configuration that won’t be covered in this tutorial.

Initial Setup

Choose to boot into Arch in the initial startup menu. It should be the first available option. You’ll arrive at a command prompt logged in as root.

How to Install Arch Linux

To start, make sure that the clock is correct with:

timedatectl set-ntp true

Hard Drive Configuration

It’s time to set up your hard drive. There are a few ways to handle this, but cfdisk seems to be the most straightforward.

cfdisk

If your hard drive doesn’t already have a partition table, you’ll be asked to set one up. Select “DOS.” While it isn’t the most current thing, it’s much easier to work with here.

How to Install Arch Linux

Next, you’ll arrive on a table with your hard drive’s partitions or free space listed. If you have partitions already, you can keep them and skip to the next step. If you want to start over, highlight them, and select “Delete” at the bottom of the screen.

Highlight the free space that you want to create a partition from, and select “New” from the bottom. Hit Enter. Then, enter the size that you want the partition to be. Repeat these steps for each partition. If you’re not sure what to do, create a 512MB partition for “/boot,” and use the rest of your drive for root (/).

When you’re done, select “Write” from the bottom menu. Type “yes” to confirm the changes. Press “q” to exit.

How to Install Arch Linux

Create the filesystems for your new partitions. Actually, this part is easy. Just run the following commands, assuming your drive is “/dev/sda.”

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2

Mounting the Partitions

Now, you’re ready to mount your partitions and start setting up your system. Assuming your drives are at “/dev/sda1” and “/dev/sda2,” the setup should look like this:

mount /dev/sda2 /mnt
mkidr /mnt/boot
mount /dev/sda1 /mnt/boot

Basic System Setup

You can edit the live CD’s mirror list here to choose download mirrors closest to you. This isn’t strictly necessary, and it can be time consuming. If you’d like to do it, place the mirrors closest to you on the top of the list in “/etc/pacman.d/mirrorlist.”

How to Install Arch Linux

Use the pacstrap utility to bootstrap your system on the newly mounted drive.

pacstrap /mnt base

This will take a bit of time, but don’t worry – Arch is essentially setting itself up.

When the bootstrap is finished, you can generate Arch’s fstab file. This file keeps track of the different filesystems (partitions) to mount on your system.

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

Inside the New System

How to Install Arch Linux

It’s time to move into your new Arch system. You can do that by changing root (chroot) into it. Chroot is a way for you to piggyback one Linux system on top of another that is already running. Arch has a tool to streamline the process.

arch-chroot /mnt

As soon as you hit Enter, the command prompt will change to reflect your new location in the Arch install.

Timezone

How to Install Arch Linux

You’ll need to set your system’s timezone next. Have a look in “/usr/share/zoneinfo” to locate your region and city. Then, link it to your system’s local time.

ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Sync your system with the hardware clock.

hwclock --systohc

Localization

You’ll need to set your system’s localization so your language and everything else associated with it are correct. Open “/etc/locale.gen,” and uncomment (by removing the “#” in front of the line) your locale of choice. For the U.S., it’s “en_US.UTF-8 UTF-8.”

Run the following to generate your locale.

locale-gen

Create a file at “/etc/locale.conf,” and place your chosen locale in the file like the example below.

LANG=en_US.UTF-8

Networking

There’s a bit of basic network configuration to do now, too. Start by setting your computer’s hostname in “/etc/hostname.”

yourhostname

How to Install Arch Linux

Add that hostname to your “/etc/hosts” file so your computer can associate it with itself.

127.0.0.1	localhost
::1		localhost
127.0.0.1	yourhostname

Finally, in order to have networking on startup, enable the DHCP service at boot.

systemctl enable dhcpcd

Users

So far, you’ve been working as the root user. For security, change that root user password to something more secure. Run the passwd command, and enter your new password for root.

passwd

How to Install Arch Linux

You’ll want to create a regular user for daily use.

useradd -m -G users,audio,input,optical,storage,video -s /bin/bash username

Give your user a new password the same way you did before, but specify the username in the passwd command.

passwd username

Final System Tasks

How to Install Arch Linux

You’re going to need to generate an initramfs for your system in order to handle several common tasks like LVM, disk encryption, and RAID. Don’t worry, it’s a single command.

mkinitcpio -p linux

The last thing you need before rebooting is the bootloader, GRUB. Start by installing it with Pacman.

pacman -S grub

Install GRUB on your hard drive so that it can start before Arch.

grub-install --target=i386-pc /dev/sda

Finally, set up GRUB’s configuration on your “/boot” partition.

grub-mkconfig -o /boot/grub/grub.cfg

When that’s done, type “exit” to exit the chroot. Unmount your partitions and reboot into Arch.

exit
umount -R /mnt
reboot

Your system will reboot into Arch Linux! Keep in mind that you’ll still need to set up your graphical desktop, if that’s what you’re planning to do. One of Arch’s strengths is the choice that it affords, and there’s plenty of choice available there, too much to cover in a simple guide like this. All of it, though, is documented in the Arch Wiki, and mostly comes down to installing the right packages.