Installing Arch Linux
How to install Arch Linux
Before we begin with the installation process, there are a few things I would like to get out of the way. I will be assuming that you have some knowledge of Linux; however, I will be explaining each step in full detail. If you are not using a Linux system, then you can search for a tutorial on how to make a bootable USB or SD card on Windows or macOS systems and skip to step 2. Finally, you will need some things for this endeavor including the USB or SD card you will use to install the operating system, the computer in which you would like to install Arch Linux, an Ethernet connection, and a lot of patience.
Now, lets start installing Arch Linux.
Step 1: Prepare the Installation Medium
To install Arch you must first prepare the USB or SD card with the ISO image. Go to https://www.archlinux.org/download/, and select which region you would like to download the file from. Once you have selected the mirror, download the file called archlinux-version-x86_64.iso. This is the disk image that you will be installing on the USB or CD.
Next, you will need to verify the download. You can do this from a terminal by typing the following command:
$ echo "b4294ad607d3df9bf71775484accff133a77fdae *archlinux-2020.01.01-x86_64.iso" | sha1sum --check
You should receive the following output:
If you do not receive this output, then try downloading the ISO file and checking it again.
Now that we have verified our ISO image, we can burn it to the USB or SD card. Simply format the drive that you wish to burn the ISO to. Then, type the following command (be sure to replace the X below with the letter of the drive you want to burn the ISO to):
$ sudo dd bs=1M if=archlinux-2020.01.01-x86_64.iso of=/dev/sdX conv=fsync
This should take quite a while, so sit back, relax, and drink a lot of coffee, cause the next step is where things start to get interesting.
Step 2: Boot Into the Arch Linux ISO
Now that you have your installation medium ready to go, stick the USB or SD card in the computer in which you would like to install Arch Linux. Boot up the computer and enter the BIOS configuration (for most computers you hit
esc, or a similar key while the computer is booting up.) Next, choose to boot from your installation medium.
Once the device has booted successfully, you will see a black screen with a few options. Then, select the first option. You should now have a prompt that looks like this:
root@archiso ~ #
If you see this, then you are good to go and can begin the installation.
Step 3: Setup for the Installation
Before we begin installing things, it’s a good idea to check the status of your network. You can type the following command to check this:
# ping -c 1 google.com
This command should return the following output:
PING google.com (126.96.36.199) 56(84) bytes of data. 64 bytes from google.com (188.8.131.52): icmp_seq=1 ttl=54 time=5.72 ms --- google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 5.721/5.721/5.721/0.000 ms
This means that you are connected to the internet and ready to move on to the next part of this step; however, if you recieve an output that looks like this:
ping: google.com: Temporary failure in name resolution
then check to make sure that your ethernet cable is connected correctly.
Next, you need to update the system clock. You can do this with this simple command:
# timedatectl set-ntp true
Step 4: Partition the Hard Drive
WARNING: What you are about to do will wipe the data on your computer’s drive. If you have not backed up all of your files and data, then this is your last chance to turn back and do so.
Now that you know what you are about to do, you can start partitioning the drive. First, check if you are using a UEFI system by running the command:
# ls /sys/firmware/efi/efivars
If it returns the contents of that directory, then you have an EFI system. If it does not return any output, then you are using BIOS.
Run fdisk to check your devices:
# fdisk -l
Note the device in which you wish to install Arch.
Now run cfdisk to partition the hard drive. Replace the X below with the letter of the device you noted earlier:
# cfdisk /dev/sdX
You will need to create three partitions:
- An EFI partition
- The root partition
- A swap partition
Note: If you do not see the
gpt option and your drive has a
dos partition table, you may have to use
fdisk to set a new partition table on the device.
Once you have done this, create a partition that is
512 M in size, label it as
EFI System, and give it the
boot flag if needed. Next up, make the swap partition and the root partition. The swap partition should be two times the size of your computer’s RAM and the root partition can be whatever size you would like so long as you have room. Label the swap partition as
Linux swap and the root partition as
Linux filesystem, then write the changes to disk (again see warning above).
Now that you have succesfully written the changes to the disk, you can setup the filesystem with (where X is the drive letter and Y is the drive number of your root partition):
# mkfs.ext4 /dev/sdXY
To get the swap space working use the commands (where X is the drive letter and Y is the drive number of your swap partition):
# mkswap /dev/sdXY # swapon /dev/sdXY
Finally, the EFI partition needs to use the FAT32 filesystem, so use the command (where X is the drive letter and Y is the drive number of your EFI partition):
# mkfs.fat -F32 /dev/sdXY
Step 5: Mounting and Installing Arch
You must now mount the root partition to
# mount /dev/sdXY /mnt
Go ahead and edit the mirrorlist, selecting which mirrors you would like to use when installing packages:
# nano /etc/pacman.d/mirrorlist
You can delete mirrors that are not from your respective country as these will result in slower downloads.
Now you can use pacstrap to download the essentials for your system:
# pacstrap /mnt base base-devel linux linux-firmware nano vim man-db networkmanager dhcpcd
Once those packages have been installed, use the following command to generate an fstab:
# genfstab -U /mnt >> /mnt/etc/fstab
Step 6: Configuring Your System
This step is fairly long; however, the tasks are fairly basic and rely mostly on your preferences.
chrooting into the new Arch installation with:
# arch-chroot /mnt
List out the available time-zone regions and cities with:
# ls /usr/share/zoneinfo/ # ls /usr/share/zoneinfo/<YOUR REGION>
Then, create a symbolic link to set your
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Finally, set your
# hwclock --systohc --utc
vim to uncomment any locales you wish to use in
/etc/locale.gen with (for the US this is
# nano /etc/locale.gen
Once the locale is uncommented, run the following command to set your locale:
You can set your language in the file
/etc/locale.conf (I use en_US.UTF-8 as an example below):
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
Create a hostname for your device and use the following command to set it:
# echo "<HOSTNAME>" > /etc/hostname
vim to edit
/etc/hosts, making it look like the following:
# nano /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 <HOSTNAME>.localdomain <HOSTNAME>
Set your root password with:
# pacman -Syu # pacman -S sudo
Next, make a user with a home directory and add them to the necessary groups:
# useradd -m <USERNAME> -G wheel,audio,optical,storage,video
Set a password for your new user:
# passwd <USERNAME>
Finally, give the user the permission to execute commands as a part of the wheel group:
Uncomment the following line by pressing the
del key over the pound symbol (“#”):
%wheel ALL=(ALL) ALL
:wq and hit
enter to write the changes and quit out of vim.
Step 7: GRUB
This step is fairly short and is the final step before you can boot into your installation of Arch Linux.
Start by installing
grub and a few packages that are required:
# pacman -S grub efibootmgr os-prober dosfstools
Mount the EFI partition you made earlier to the /boot/efi partition on your drive:
# cd /boot # mkdir EFI # mount /dev/sdXY /boot/EFI
Now that you have the grub package and other necessary packages, run
# grub-install --target=x86_64-efi --bootloader-id=grub_uefi --efi-directory=/boot/EFI --recheck
Then configure grub with the following command:
# grub-mkconfig -o /boot/grub/grub.cfg
You should now be able to boot into your Arch Linux installation. So, go ahead and exit from your current shell, unmount all of the mounted devices (where ABCD are the drive letters and numbers corresponding to your mounted partitions i.e. root and EFI), and reboot your system:
# exit # umount /dev/sdAB # umount /dev/sdCD # reboot
Once the grub menu appears, you may remove the installation medium.
Congrats, you have successfully installed Arch Linux!
By using Arch Linux, you have almost infinite control over the configuration of your system from here. I will be posting some more guides soon on some of the things that you can do with Arch and cool ways to customize it to your liking.