How to Install Arch Linux

Share This:

arch-linux

Arch Linux is a popular minimalist Linux distribution which can be cutting edge with a steep learning curve compared to most other Linux distributions. This guide will walk you through installing Arch Linux from the Live ISO to either bare metal or a virtual machine like VMware or VirtualBox.

Download the Arch Linux ISO

Head over to https://archlinux.org/download to download the latest Live ISO. Near the bottom is a list of mirrors so that you can find one close to you. As of this writing, Arch Linux just released 2020.01.01.

Burn the ISO to a DVD or USB

Using any number of tools available, you can burn the ISO to make a Live CD or a USB. If you’re creating a virtual machine you can mount the ISO using your virtualization software and boot to the ISO.

Connect to the Internet and Enable NTP

The easiest way to get on the internet is if you’re setting up a virtual machine or using a wired connection.

Check your internet connection by pinging Google:

ping -c 3 google.com

Once you’ve verified your internet connection, enable NTP:

timedatectl set-ntp true

Partition the Hard Drive

Next up, we’ll need to partition the hard drive. This will be different for each user depending on your end goals. We’ll want at minimum a root partition to boot to and a swap partition.

Get a list of your drives:

fdisk -l

Partition the drive using cfdisk (replacing the X with your disk letter):

cfdisk /dev/sdX

In most cases, you’ll want to select dos as the label type. Select New to create your partition. You’ll set your size at the next prompt. Remember to leave room for your swap partition. Set it as a Primary partition and also toggle the Bootable flag to On.

Do the same process to create the swap partition. Change the Type to 82 Linux swap / Solaris. Do not make the swap partition bootable.

Select Write to apply the changes, then confirm with Yes. Once the changes are written, you can Quit cfdisk.

Create Filesystem and Swap Space and Mount Them

You have some options for the filesystem. One of the most stable is ext4. To make your primary partition ext4, use this command (replacing the X with your drive letter and the 1 with your partition letter if it isn’t 1):

mkfs.ext4 /dev/sdX1

Create your swap filesystem by using (again, replacing the X and the 2 as needed):

mkswap /dev/sdX2

Mount the primary partition and swap partition by using:

mount /dev/sdX1 /mnt
swapon /dev/sdX2

Install the Base System and Kernel

To get started with Arch Linux, you’ll want to install the base system and kernel. This step will take some time.

pacstrap /mnt base base-devel linux linux-firmware

Generate the fstab file and chroot into Arch Linux

Use this command to generate the fstab file:

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

Use arch-chroot to chroot into the new Arch Linux system:

arch-chroot /mnt

Set Time Zone

Set your timezone by running (replace Region and City with your information):

ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime

Update the hardware clock:

hwclock --systohc

Generate Locale Files

Run:

locale-gen

Uncomment locales you wish to use using echo:

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

Set Hostname, Create Hostname File, Enable DHCP

Replace HOSTNAME in this command with the name you want to give your system:

echo "HOSTNAME" > /etc/hostname

Install and Enable DHCP:

pacman -S dhcpcd
systemctl enable dhcpcd

Install Network Manager:

pacman -S networkmanager
systemctl enable NetworkManager

Set Root Password

Set the root password by running:

passwd

Install GRUB Bootloader

For our purposes, we’ll be installing the GRUB bootloader. You’re welcome to install your bootloader of choice here.

Download GRUB:

pacman -S grub os-prober

Install GRUB (replace the X with your drive letter):

grub-install /dev/sdX

Configure GRUB automatically:

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

Exit and Reboot

Exit and reboot into your freshly installed system:

exit
reboot

Next Steps

Now that you have a base install of Arch Linux, the next steps will be to install a desktop environment like GNOME or XFCE, etc. You can follow our Install Basic Tools and Desktop Environment in Arch Linux guide.


Share This:

 

Related Content

Leave a Comment