Installing Arch Linux using the official ISO

Get started with Arch Linux as a blank canvas and build the simple and elegant environment you want with this book and ebook.

(For more resources related to this topic, see here.)

Getting ready

You can get the official ISO image file from https://www.archlinux.org/download/. On this page you will find a download link to the latest release. Depending on your preference, download the torrent file or the ISO image file immediately.

The following list describes the main tasks that we will perform in this recipe:

  • Preparing, booting, and setting keyboard layout: We are going to get the ISO file from the download page of the Arch Linux website and store it on the preferred media of our choice. At the time of writing this article, there is a dual ISO image file that contains both i686 and x86-64 architectures on one disk. Start your PC with your preferred installation media (CD or USB stick). On most PC systems, you can access the boot menu by pressing one of the function keys, usually between F8 and F12 depending on the motherboard manufacturer. On older machines where you do not yet have a boot menu, you might need to change the boot order in the BIOS where the CD-ROM (or DVD/Blu-ray) has to be chosen as the first device to try booting from. We'll also explain how to use a different keyboard layout than the default one in this recipe.

  • Creating, formatting, and mounting partitions: You can partition the disks the way you want using cfdisk (for MBR disk partitioning) or cgdisk (for GUID disk partitioning). After creating the partitions, we can choose to format our created partitions with specific filesystems. When all partitions are formatted, we need to mount the partitions. First we will mount the root partition to /mnt. The other partitions will be mounted later on after you have created the specific folders. We'll designate our device with /dev/sdX; in your case this can be /dev/sda, and so on.

  • Connecting to the Internet: To be able to continue installing the ISO you need to connect to the Internet, because there are no packages available for installation on the ISO. For a wireless network you will need to use netcfg. When connected to a wired network, just use dhcpcd or dhclient.

  • Installing the base system and boot loader: These days the base system gets installed by running a simple script pacstrap. Pacstrap takes multiple parameters, the target location, and the packages or groups you want to install. For people who want to develop on their machines, the best base install is adding base-devel to the default installation. For normal end users, just base will be sufficient to start.

  • Configuring the system: In this recipe, we'll describe the flow of what to do during the configuration.

How to do it...

The following steps will guide you in preparing, booting, and setting keyboard layout:

  1. Once you have downloaded the ISO image file, you should also verify its integrity by downloading the sha1sums.txt file from the download page.

    These days you can also check if the ISO is completely valid by verifying the signature of the ISO.

  2. Verify the integrity by issuing the sha1sum -c sha1sums.txt command and you'll see whether your download was successful or not. Also check if the signature of the ISO is correct by running gpg -v archlinux-...iso.sig:

    sha1sum -c sha1sums.txt gpg -v archlinux-2012-08-04-dual.iso.sig

    The following screenshot shows the execution of this step:

  3. As you can see in the previous screenshot, the ISO's checksum is ok and the signature is valid.

  4. Now that we are sure our ISO is ok, we can burn this to a CD with our favorite burning program.

  5. Insert the CD into the drive, or insert the USB stick into the USB port of your PC.

  6. Enter the boot menu, or let your computer automatically boot from the inserted installation media.

  7. If the previous steps are performed correctly, you will see the following screenshot:

  8. Select the architecture you want and press Enter, and we'll be on our way.

  9. Search the keyboard layout desired for your region. The available keyboard layouts can be found at /usr/share/kbd/keymaps/.

  10. Set the desired keyboard layout with loadkeys keyboardlayout.

Now let's perform the following steps to create, format, and mount partitions:

  1. Start cfdisk or cgdisk, having the first parameter as the device you want to partition:

    cfdisk /dev/sdX cgdisk /dev/sdX

  2. Create your partition scheme.

  3. Store the partition scheme.

  4. Use the mkfs command to create a filesystem on a specific partition:

    mkfs -t vfat /dev/sdX mkfs.ext4 -L root /dev/sdX

  5. Mount your root partition to /mnt:

    mount /dev/sdX3 /mnt

  6. Make directories under mount for your other partitions:

    mkdir -p /mnt/boot

  7. Mount the other partitions:

    mount /dev/sdX1 /mnt/boot

The following steps are needed to connect to the Internet:

  1. When we need a wireless network, create a netcfg profile and run netcfg mywireless.

  2. Use dhclient or dhcpcd to get an IP address.

The following steps should be performed for installing the base system and boot loader:

  1. Run pacstrap with the desired parameters:

    pacstrap /mnt base base-devel

  2. Install the desired boot loader: the best choice at this moment is Syslinux.

  3. The final installation of the boot loader will be done in a chroot during the initial configuration.

We'll now list the steps to do during the configuration:

  1. Generate fstab with genfstab:

    genfstab -p /mnt >> /mnt/etc/fstab

  2. Change the root into the system location:

    arch-chroot /mnt

  3. Set your hostname in /etc/hostname.

  4. Create /etc/localtime symlink.

  5. Set your locale in /etc/locale.conf.

  6. Uncomment the configured locale in /etc/locale.gen.

  7. Run locale-gen.

  8. Configure /etc/mkinitcpio.conf.

  9. Generate your initial ramdisk:

    mkinitcpio -p linux

  10. Finish installation of your boot loader.

  11. Set the root password with passwd.

  12. Leave the chroot environment (exit).

How it works...

We downloaded the ISO image file via torrent, or via HTTP from the mirror sites listed on the download page. The sha1sum command lets us verify the integrity of the downloaded ISO. On top of the checksum, we can also check the integrity by verifying the signature available for the ISO. So now, we can rest assured that the downloaded file is the real one. The ISO contains a fully working operating system. It also contains all the necessary tools to perform system recovery and installation.

The keyboard configuration set with loadkeys will make sure that the key you press on your keyboard will be translated to the correct letter on your screen. Using a different keyboard layout from the one on your physical keyboard might be confusing.

We then created a partition scheme on the selected disk with the appropriate tool (cfdisk or cgdisk). Make Filesystem (mkfs) is a unified frontend to create a filesystem. Using it we created our filesystem layout manually under/mnt by creating our default partition layout in our root, and mounting the specific partitions accordingly.

You can make a connection with your wireless network (if needed), and then use dhcpcd or dhclient to obtain an IP address that enables you to access the Internet.

Pacstrap will run pacman with a modified root location to install the desired packages into the newly created system.

For example, installing Syslinux:

pacstrap /mnt syslinux

The specific configuration files will ensure we don't have to do all those steps over and over again on every boot.

Summary

This article explained the procedure to get Arch Linux installed on your system using the official installation media.

Resources for Article :


Further resources on this subject:


Books to Consider

comments powered by Disqus