Friday, November 15, 2024
Google search engine
HomeGuest BlogsHow to Install Arch Linux

How to Install Arch Linux

Introduction

Arch Linux is currently one of the most popular Linux distributions, thanks to its versatility and minimal system requirements.

Arch Linux features a rolling release and always comes with the latest Linux kernel and functionalities.

This article is a step-by-step guide on how to install and configure Arch Linux on your computer.

How to Install Arch LinuxHow to Install Arch Linux

Prerequisites

  • At least 1GB of RAM and 20GB of free hard-drive space
  • An internet connection
  • A blank DVD and the hardware and software necessary to burn it
  • Alternatively, a USB drive with at least 2GB of free space

Note: The installation requires formatting your hard drive. Doing this removes all saved data. Make sure to back up relevant data before starting the installation process.

Arch Linux Install Guide

Install Arch Linux on your computer by following the steps outlined below.

Step 1: Download the Arch Linux ISO

Download the ISO from the Arch Linux download page. There are two ways to do so:

  • via BitTorrent
  • as a direct download

To download the ISO via torrent, choose between adding a magnet link to your BitTorrent app or downloading the torrent file.

Alternatively, scroll through the page until you find a mirror that’s closest to your current location.

Step 2: Create a Live USB or Burn Arch Linux ISO to a DVD

Once you have the Arch Linux ISO, you can create a live USB or burn it to a DVD.

Create a Live USB of Arch Linux

The simplest way to create a live USB of Arch Linux is to use an app like Etcher GUI. This app is available on both Linux and Windows systems.

If you are using Linux, create a live USB with the following command:

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

Burn the Arch Linux ISO to a DVD

You can also install Arch Linux from a DVD. Use a tool like Brasero or AnyBurn to burn the ISO you downloaded onto a blank DVD.

Step 3: Boot up Arch Linux

1. With the Arch Linux ISO burned on a DVD or stored as a live USB, insert the installation media into your computer and restart.

2. Depending on your system, pressing F2, F10, or F12 lets you choose the device the system boots from.

3. With the boot settings open, select the preferred install media (live USB or DVD). The following screen shows up after Arch Linux boots:

Select Boot Arch Linux (x86_64) in the boot menuSelect Boot Arch Linux (x86_64) in the boot menu

4. Select Boot Arch Linux (x86_64) and press Enter to start the setup process.

Step 4: Set the Keyboard Layout

During the Arch Linux installation, the default keymap is US. To list other available layouts, run:

ls /usr/share/kbd/keymaps/**/*.map.gz

To change the layout, use the appropriate layout file name with the loadkeys command. For example, run the following command to select a German keyboard layout:

loadkeys de-latin1

Step 5: Check Your Internet Connection

Check your Internet connection using the ping command:

ping -c 3 google.com

If you want to install Arch Linux using a wireless Internet connection, consult the Arch Linux wiki’s wireless network configuration section.

Step 6: Enable Network Time Protocols (NTP)

Next, enable Network Time Protocols (NTP) and allow the system to update the time via the Internet:

timedatectl set-ntp true

To check the NTP service status, use:

timedatectl status

Step 7: Partition the Disks

1. Use the fdisk command to list all available disk drives:

fdisk -l

2. Find the name of the disk you want to partition. The name is displayed in the /dev/sdX format, where X is the drive letter.

Find the name of the disk you want to partitionFind the name of the disk you want to partition

Note: When reviewing the list of available disk drives, ignore the ones ending in rom, loop, or airoot.

2. Partition the drive using the cfdisk command:

cfdisk /dev/sdX

Where X is the drive letter of the disk you want to partition.

3. Using the arrow keys, select dos as the label type, and press Enter.

Select 'dos' as disk label typeSelect 'dos' as disk label type

4. The next screen shows how much free space you have on the selected disk and lets you allocate it. Select New at the bottom of the screen and press Enter to begin creating a new disk partition.

Select 'New' to create a new partitionSelect 'New' to create a new partition

5. Select the partition size, shown in gigabytes. Once you enter the preferred size, press Enter to confirm.

Set partition sizeSet partition size

Note: Make sure to leave enough free space for the swap space partition. This partition requires at least two times the amount of RAM in disk space.

6. Once prompted, set the partition as Primary and press Enter to confirm.

Set partition as primarySet partition as primary

The new partition is now displayed, along with the free space available on the disk drive.

7. Select the Bootable option at the bottom of the screen and press Enter to confirm. This way you make sure that Arch Linux boots from your primary partition installed.

Set partition as bootableSet partition as bootable

8. Repeating the process outlined above, you need to create another partition using the remaining disk space. Instead of making the new partition bootable, select the Type option at the bottom of the screen and press Enter.

Select partition typeSelect partition type

9. Scroll down on the list until you find 82 Linux swap / Solaris. Press Enter to confirm. This creates a swap space partition.

Select '82 Linux swap / Solaris' on the partition type listSelect '82 Linux swap / Solaris' on the partition type list

10. Confirm the changes to the drive by selecting Write at the bottom of the screen. Type yes, and press Enter.

Confirm changes made to the driveConfirm changes made to the drive

11. Select Quit and press Enter to exit the cfdisk screen.

Select 'Quit' to exit the cfdisk screenSelect 'Quit' to exit the cfdisk screen

Step 8: Create Filesystem

You need to format the new partitions to install Arch Linux. To do this, create a file system for each of the partitions.

1. Use the mkfs command to create an ext4 filesystem for the bootable partition:

mkfs.ext4 /dev/sdX1

Where X is the drive letter of the disk the partition belongs to.

Create a filesystem for the bootable partitionCreate a filesystem for the bootable partition

2. Next, create a file system for the swap space partition using the mkswap command:

mkswap /dev/sdX2

Again, replace X with the drive letter of the disk the partition belongs to.

Create a filesystem for the swap space partitionCreate a filesystem for the swap space partition

Step 9: Mount the Filesystem

Now, mount the filesystems you created by running the following commands:

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

Where:

  • mount – Mounts the filesystem on the bootable partition.
  • swapon – Activates the swap space filesystem.
  • X – The drive letter of the disk the partition belongs to.
Mount the new filesystems on your partitionsMount the new filesystems on your partitions

Step 10: Check the Mirror List for an Appropriate Mirror

The Arch Linux installation downloads the necessary files through a mirror. Downloading files from a mirror that’s far away from your location slows down the process, which eventually causes the installation to fail.

To speed up the download, you need to set up the mirror list to make the fastest mirrors at the top.

1. Start by syncing the pacman repository:

pacman -Syy
Synchronize the pacman repositorySynchronize the pacman repository

2. Installing a reflector lets you update the mirror and sorts it by download speed. Add a reflector by typing:

pacman -S reflector
Install the reflectorInstall the reflector

3. If necessary, create a backup of the mirror list:

cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

4. Use the reflector to update the mirror list:

reflector -c "XX" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist

Where "XX" is the code of your country (for example, enter "US" if you are located in The United States).

Note: The mirror list is located in /etc/pacman.d/mirrorlist.

Step 11: Install Arch Linux

Use the pacstrap script to install Arch Linux to the bootable partition:

pacstrap /mnt base linux linux-firmware

Depending on your download speed, the installation process might take some time.

Step 12: Configure Arch Linux

Once the Arch Linux installation is complete, you need to configure the settings.

Generate the fstab File

The fstab file defines the order in which disk partitions, block devices, remote devices, and other data sources are mounted.

Create a fstab file by running:

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

Use Arch-Chroot and Enter the Mounted Disk as Root

Change the root to the newly installed Arch Linux system with the arch-chroot command:

arch-chroot /mnt

Set the Time Zone

1. First, list all the available time zones:

timedatectl list-timezones

2. Find your time zone and make a note of the name.

3. Run the command:

timedatectl set-timezone Time/Zone

Replace Time/Zone with the appropriate name.

Set the Locale

Setting up the locale determines the language, date, numbering, and currency format for your system.

1. The locale.gen file contains a list of all available locales. Open it and find the name of your preferred locale:

sudo nano /etc/locale.gen

2. Uncomment the name of your preferred locale and any other you would like to use.

3. Press Ctrl + X to exit and type Y to save the changes.

4. Generate a locale configuration file by typing:

locale-gen
echo [locale_name] > /etc/locale.conf

Where [locale_name] is the name of your preferred locale.

Note: You can also change the time zone and locale later while using your Arch Linux system.

Set the Hostname File

1. Create a hostname file and add your hostname to it by running the following hostname command:

echo [your_hostname] > /etc/hostname

2. Then, create a hosts file via touch command:

touch /etc/hosts

3. Add the following content to the new hosts file:

127.0.0.1	localhost
::1		localhost
127.0.1.1	[your_hostname]

4. To enable the Dynamic Host Configuration Protocol (DHCP), type:

systemctl enable dhcpcd

Set the Root Password

Set up a new root password with the passwd command:

passwd

Running this command prompts you to type and then retype your new password.

Step 13: Install Grub Bootloader

Next, install the GRUB bootloader. There are two ways to install GRUB, depending on whether you are using a non-UEFI or UEFI system.

Install GRUB Bootloader on a Non-UEFI System

1. Add the GRUB bootloader packages by using the pacman manager:

pacman -S grub os-prober

2. Install the GRUB bootloader:

grub-install /dev/sdX

Where X is the letter of the drive you want to install GRUB on.

3. Create a GRUB configuration file by using:

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

Install GRUB Bootloader on a UEFI System

1. Add the GRUB bootloader packages by using the pacman manager:

pacman -S grub efibootmgr

2. Create a directory for the EFI partition:

mkdir /boot/efi

3. Mount your bootable partition to the directory you created:

mount /dev/sdX1 /boot/efi

Where X is the drive letter of the disk the partition belongs to.

4. Install GRUB by using:

grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi

5. Finally, create a GRUB configuration file:

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

Step 14: Exit Arch-Chroot Environment and Reboot

1. Exit the arch-chroot environment:

exit

2. Then, reboot the system:

sudo reboot

Step 15: Login to Arch Linux

Once the system reboots, GRUB loads and offers you the option of loading Arch Linux. Press Enter to load the system. Use the password you set up to log in.

Log in with the GRUB bootloaderLog in with the GRUB bootloader

Conclusion

After following this guide, you should have successfully installed and configured Arch Linux on your computer. If you need an Arch Linux desktop environment, refer to our guide How To Install GNOME In Arch Linux.

Have fun working on this versatile and lightweight Linux distribution!

Was this article helpful?
YesNo

RELATED ARTICLES

Most Popular

Recent Comments