How to Install Arch Linux

Posted on by Martin Pollock
Reading Time: 7 minutes

What is Arch Linux?

Arch Linux is a Linux distribution designed for computers with X86-64 processors. It was created by Judd Vinet in 2002. The main idea behind this distribution is speed, flexibility, and simplicity. Arch Linux focuses on centralized configuration, similar to Gentoo Linux.

Arch Linux follows the rolling-release model system, meaning that the packages are available for a brief time after they are released. The pacman package manager is the most important feature that distinguishes Arch Linux. It offers management for packages in its repository as well as users’ own builds.

The goal of Arch Linux is to keep configuration simple. While simplicity is the philosophy, the configuration process is not for beginners. Fortunately, you have this guide on how to install Arch Linux. It also includes some optional configurations from which to start.

How to Install Arch Linux

In this tutorial, you will see how to successfully install Arch Linux. The installation can present a challenge for beginners and some Linux enthusiasts, but following these detailed steps will make things easier.

Step 1 – Download and Boot Arch Linux

  1. Download Arch Linux .iso file.
  1. There are several tools to create a live USB. The following is a list of viable tools, though others exist:
  2. Insert the USB drive you selected and boot your system from the installed media. Once the system boots, a terminal prompt will appear.

Step 2 – Prepare the Installation

  1. In the terminal prompt that appears, set your keyboard layout. In the example below, US stands for the United States keyboard layout.
localectl list-keymaps | grep US
  1. Set your keyboard layout.
loadkeys de_US-latin1
  1. If you have a Wi-Fi adapter, enable it with the following command.
iwctl
  1. You can find the name of your network adapter using the device list command.
  1. The following command allows you to scan for wifi networks. Replace name_of_your_wifi_adapter with your device’s name.
station name_of_your_wifi_adapter scan
  1. Use the following to see the list of available networks. Again, replace name_of_your_wifi_adapter with your device’s name.
station name_of_your_wifi_adapter get-networks 
  1. Connect to your network. Replace name_of_your_wifi_adapter with your device name and name_of_your_network with your network name.
station name_of_your_wifi_adapter connect name_of_your_network
  1. In order to go back to the Arch root .iso, type exit.
  1. Now that you have an Internet connection, you can synchronize the network-time protocol with the following command.
timedatectl set-ntp true
  1. Packages must be installed from a list of official Arch Linux servers called mirror servers. Ust the following command to set the fastest mirror list available for you.
reflector -c 'United States' -a 12 - -sort rate - -save etc/pacman.d/mirrorlist

The -c stands for country. If your country has a two word name, you have to put them through single quotes, as the United States is in our example above.

The -a stands for the age of the servers. In our example, 12 denotes servers that have been updated in the last 12 hours.

The --sort portion is to sort the servers by speed.

The --save will let you save this information under etc/pacman.d/mirrorlist.

  1. Synchronize your mirror servers with the following command.
pacman -Syy
  1. Use the lsblk command to list your disks so you can partition them and install Arch Linux.

Step 3 – Partition the Disk (UEFI Systems Only)

Note:
You can skip this step if you have a master boot record (MBR) system.

In this step, you will create two partitions that are mandatory, the extensible firmware interface (EFI) and root partitions. The home partition is optional.

Even though the unified extensible firmware interface (UEFI) system supports both master boot record (MBR) and GUID partition table (GPT), you will partition the disk with the GPT label using gdisk because of the MBR partition’s limitations in size and number of the partitions.

  1. Create new GPT entries in memory using the following command.
gdisk /dev/dsk
  1. Type n to create a new entry.
  1. The system will partition number 1 by default, so just press Enter.
  1. In the first sector, accept the defaults.
  1. In the last sector, choose how big you want the partition to be. The below command would set the partition size to 200 megabytes.
+200M
  1. This will be an EFI partition (currently, it is a Linux file system). The code for the EFI system partition is ef00, which is what you want to input.
ef00
  1. You will type n for a new partition (the root partition) and accept the number 2 as default.
  1. For the first sector, accept the defaults.
  1. For the last sector, hit Enter. It will use the remaining space that is left on the disk.
  1. The default is the Linux file system, so the code is already good. Accept defaults and hit Enter.
  1. Type w to write the changes to the disk.
  1. Once the operation has been completed successfully, you will format the partitions using the following command. The EFI partition must be a file allocation table (FAT) system type. You will specifically create a fat32 file system and the device name.
mkfs.fat -f32 /dev/dsk1
  1. You have to repeat the process for the root partition.
mkfs.ext4 /dev/dsk2
  1. Mount your root partition with the following command.
mount /dev/dsk2 /mnt 
  1. You will mount your EFI partition, but first, you have to create a directory for it. Use this command to accomplish that.
mkdir -p /mnt/boot/efi - mkdir

The -p is used to create multiple directories. If you want to create just one, you can just use mkdir. The directories you want to create are boot and EFI to mount the EFI partition in this specific directory. Also, you can mount the EFI partition onto the boot directory if you prefer.

  1. Mount dsk1.
mount /dev/dsk1 /mnt/boot/efi
  1. You can see everything you have written and mounted using the lsblk command.

Step 4 - Partition the Disk (MBR Systems Only)

Note:
You can skip this step if you have a UEFI system.

MBR requires a disk operating system (DOS) disk label.

  1. Use the following command to format a disk.
fdisk /dev/dsk
  1. Type n to create a swap partition.
  1. Accept the default for the primary partition and the first sector. The last sector defines the size of the swap partition.

The basic rule is to create double the RAM memory size. For example, if you have 2 GB of RAM, your swap partition should be at least 4 GB. Type 4G and hit Enter.

  1. You will need to change the created partition type from Linux to Linux swap. Type t. The code for a swap partition is 82.
  1. Next, we have to create the root partition. Type n.
  1. Accept the defaults for the primary partition, partition number, first sector, and last sector.
  1. Hit w in order to write these changes to the disk.
  1. Use the following commands to activate the swap partition.
mkswap dev/dsk1
swapon /dev/dsk1
  1. Format and activate the root partition.
mkfs.ext4 /dev/dsk2
  1. Mount the root partition.
mount /dev/vda2 /mnt

Step 5 - Install the Base Packages (UEFI and MBR Systems)

Installing base packages is crucial in order to have a running system. Some of the base packages that we will install are:

  • Base.
  • Linux firmware, which will provide additional firmware for the system.
  • Linux kernel.
  • Intel-ucod (for Intel processors).
  • Amd-ucod (for AMD processors).
  • Vim or nano (orpackages for the text editor that you prefer).
  1. Use the following command to install the base packages in the mount directory.
pacstrap /mnt base linux-firmware linux intel-ucod vim
  1. Generate the file system table, which is where the file mount points are stored. Every time the device boots up, it will check this file to see what should be mounted.
genfstab -U mnt >> /mnt/etc/fstab

Step 6 – Start the Arch Linux Installation

Thus far, the previous steps were preparation for the actual Arch Linux installation. The last steps will pertain to the installation.

  1. Mount into the installation.
arch-chroot /mnt
  1. Set the timezone of the system. Replace America/New_York with the appropriate country/location for your system’s timezone.
ln -sf usr/share/zoneinfo/America/New_York/ etc/localtime

You can look up the configuration for your location using the following command. Replace your_city_name with the city your system is located.

timedatectl list-timezones | grep your_city_name
  1. Synchronize the system and hardware clock.
hwclock -systohc
  1. Configure the locale.gen file, which contains the locales for the system. For this tutorial, we are using the Vim text editor.
vim /etc/locale.gen

Scroll down in order to find the locale you want to use and remove the # from the start of the line containing the language you prefer. Save the file and exit vim using the :wq! command.

  1. Generate the locales.
locale-gen
  1. Create the locale.conf file.
vim etc/locale.conf

Enter your preferred locale. For the United States, enter the following.

LANG=en_US.UTF-8

Save the file and exit vim using the :wq! command.

  1. Set the hostname. The hostname portion will be your device’s hostname.
vim /etc/hostname
  1. Set the host file.
vim /etc/hosts

On the empty line enter. Where yourhostname appears, you will enter your device’s hostname.

127.0.0.1        localhost
::1                   localhost
127.0.1.1        yourhostname.localdomain        yourhostname
  1. Set a password for the root user using the passwd command.

Step 7 -  Install Additional Packages

The default package manager in Arch Linux is pacman. Pacman runs perfectly with the Arch Build System. In order to install a package using pacman, you have to use the -S option.

  1. Install additional packages using pacman:
pacman -S networkmanager network-manager-applet grub mtools dosfstools git linux-headers
bluez-utils bluez pulseaudio reflector xdg-utils xdg-user-dirs cups

 The Arch Linux website provides a list of all available packages.

  1. Install the grub bootloader (on UEFI systems only).
grub-install -target=x86_64-efi -efi-directory=/boot/efi -bootloader-id=GRUB

A configuration file for grub needs to be generated.

grub-mkconfig -o /boot/grub/grub.cfg
  1. Install the grub bootloader (on MBR systems only).
grub-install -target=i386-pc /dev/dsk

A configuration file for grub needs to be generated.

grub-mkconfig -o /boot/grub/grub.cfg
  1. Make sure that the network manager is enabled so you can configure the Wi-Fi.
systemctl enable NetworkManager

Step 8 - Create a User and Set a Password

For the purpose of this tutorial, our user will be johndoe. Replace johndoe in the user and password commands with your own personal username and password.

useradd -nG wheel johndoe
passwd johndoe

Step 9 – Finish the Installation

Those were all the basic steps of how to install Arch Linux. Now we have to exit the installation, unmount all partitions, and reboot the machine. You will use the following commands.

exit
unmount -a
reboot

Step 10 – Arch Linux Customization

If the grub bootloader was installed correctly, you will be able to select Arch Linux to boot. You can log in using credentials for the user you created. When you have logged in, you can continue the boundless Arch Linux configuration this operating system is famous for.

The following are optional, depending on your preferences, but are helpful in most use cases.

  1. Before you install a desktop environment, you have to install X server, one of the most used display servers.
sudo pacman -S xorg
  1. After the X server installation is complete, choose your preferred desktop environment.

            Cinnamon:

sudo pacman -S cinnamon nemo-fileroller

            GNOME:

sudo pacman -S gnome gnome-extra

            XFCE:

sudo pacman -S xfce4 xfce4-goodies

            MATE:

sudo pacman -S mate mate-extra
  1. Install codecs and plugins.
sudo pacman -S faac faad2 flac jasper lame libdv a52dec libtheora x264 gstreamer0.10-plugins
libmad libvorbis wavpack
  1. Install additional software for day-to-day use. For this tutorial, the command below will install:
  • LibreOffice.
  • Gedit (another text editor).
  • Skype.
  • Firefox.
  • Thunderbird (email client).
  • Pidgin (instant messaging client).
  • VLC (media player).
sudo pacman -S libreoffice gedit skype firefox thunderbird pidgin vlc
  1. Install archive managers.
sudo pacman -S tar unrar p7zip p7zip-plugins rsync

Final Thoughts

Customization is limitless, which is the real power of this operating system. You can customize almost everything in Arch Linux, such as the desktop environment, themes, and the mouse pointer. If you are willing to learn more about Arch Linux, you can visit the Arch Linux wiki.


You’ve read about Arch Linux and how to install it. Liquid Web’s unmanaged dedicated hosting allows you to install your own operating system and manage it how you wish. Contact a salesperson to configure your dedicated server today.

Avatar for Martin Pollock

About the Author: Martin Pollock

Martin is a tech-savvy, experienced customer and now a support technician with more than two years of experience in the field. He's a gamer at heart that also loves psychology and astronomy and would never miss a good game of basketball, even if it rains.

Latest Articles

What is VMware HA and DRS?

Read Article

How to Make OpenStack Work for You

Read Article

Five Steps to Create a Robots.txt File for Your Website

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article