This will be a very basic overview in what is to be done for installing Arch Linux. For more information check out Arch wiki installation guide.
The commands shown in this guide will be in italian(font).
Step 1: Downloading the required files and applications
I have downloaded a few applications to help ease the process for the installation. You can download them using the links below.
Rufus:
This helps in formatting the USB and converting the disc image file to a dd image file. I have used rufus, you can use other tools too. This only works on windows.
rufus link
BitTorrent
The download option in the wiki page suggests we use BitTorrent for downloading the disc image file.
BitTorrent for windows
Arch Linux torrent file
This is for downloading the Arch Linux Torrent File. The download link can be found in the website given below.
Arch Linux Download Page
Step 2: The bootable USB
You will need a USB of size at least 2GB and 4GB or above should be very comfortable to use.
First open the BitTorrent application or the web based version and upload the magnet link or the torrent file to start downloading the disc image file.
Then to prepare the USB:
- Launch the application to make the bootable USB like rufus.
2.In the device section select your USB and remember all the data in the drive will be lost after the process.
3.In boot selection, choose the disc image file that was downloaded through torrent.
4.In the target system select UEFI as we are using a UEFI system.
5.In the partition scheme make sure GPT is selected.
6.In file system select fat32 and 4096 bytes as cluster size.
7.When you click ready it will present you with 2 options, select the dd image file which is not the default option.
After the process is done the USB will not be readable to windows, so there is no need to panic if you cannot access the USB.
If you are using a dual boot make sure you have at least 30 GB of unallocated space.
I would recommend to turn off bitlocker settings as it could give rise to other challenges during the installation.
Then get into the UEFI Firmware settings of your system. One easy way is to:
1.Hold shift key while pressing to restart the computer
2.Go into Troubleshoot
3.Go into Advanced Settings
4.Select UEFI Firmware Settings
5.You will have to restart again but you will be in the required place.
Turn off secure boot state. It is usually in the security settings.
Select save changes and exit.
When you log back into your system ensure that secure boot state is off by going into system information.
Go back to UEFI Firmware settings by repeating the process.
In the boot priority section, give your USB device the highest priority. This is usually in the boot section. Then select save changes and exit.
Step 3: Preparing Arch Linux Installation
When all the above steps are done and the system restarts, you will be prompted with a few options. Select Arch Linux install medium and press 'Enter' to enter the installation environment. After this you will need to follow a series of steps.
1. Verifying you are in UEFI mode.
To do that type the command
cat /sys/firmware/efi/fw_platform_size
You should get the result as 32 or 64. If you get no result then you may not be using UEFI mode.
2. Connecting to the internet:
If you are using an ethernet cable then you don't have to worry as you might already be connected to internet.
Use the command
ping -c 4 google.com
or another website to ping from to check if you're connected to the internet.
To connect to wi-fi, type in the command
ip link
This should show you all the internet devices you have. Your wi-fi should typically be wlan0 or something like wlp3s0, which is your device name.
Then type the command
iwctl
This should get you into an interactive command line interface.
You can explore the options by using the command
help
My device name was wlan0 so I'm using wlan0 in the command I'm going to show if yours is different make the appropriate changes.
To connect to the wifi use the command
station wlan0 connect "Network Name"
where "Network Name" is the name of your network.
If you want to know the name of your network before doing this you can try the command
station wlan0 get-networks
To get out of the environment simply use the command
exit
After you exit, you can verify your connection with
ping -c 4 google.com
If it doesn't work, try the command
ping -c 4 8.8.8.8
If the above also doesn't work, the problem may lie with your network.
However if the second option works for you, the fix would be to manually change the DNS server you're using.
To do that, run the command
nano /etc/systemd/resolved.conf
In this file if the DNS part is commented using a #, remove the # and replace it with a DNS server you desire. For eg: 8.8.8.8
ctrl + x to save and exit
Now try pinging a website such as google.com again to make sure you're properly connected to the internet.
3. Set the proper time
When you connect to the internet you should have the proper time. To check you can use the command
timedatectl
4. Create the partitions for Arch Linux
To check what partitions you have, use the command
lsblk
This will list the partitions you have. It will be in the format /dev/sda or /dev/nvme0n1 or something else. Mine was /dev/nvme0n1 so I'll be using the same in the commands below.
To make the partitions, use the command
fdisk /dev/nvme0n1
This should bring you to a separate command line interface.
It will give you an introduction on what to do.
Now we will create the partitions.
To create a partition, use the command
n
It will show you what you want to number your partition and the default option. Click enter as it will automatically take the default option if you don't enter any value. Let's say mine is 1.
It will show you what sector you want the partition to start from and the default option. Click enter.
Then it will ask you where you want the sectors to end: type
+1g
1g will allot 1 GB to the partition you just created.
Then create another partition in the same way, let's say mine is sector number 2 this time and finally instead of
+1g use +4g
This will allot 4 GB to the second partition you just created.
Create another partition and this time leave the last sector to default so it can have the remaining space. Let's say this partition is number 3.
partition 1 - EFI system partition
partition 2 - Linux SWAP partition
partition 3 - Linux root partition
5. Prepare the created partitions for Arch Linux installation
Here, we are going to format the memory in the chosen partitions and make them the appropriate file systems.
For the EFI partition:
mkfs.fat -F 32 /dev/nvme0n1p1
This converts the 1 GB partition into a fat32 file system.
For SWAP partition:
mkswap /dev/nvme0n1p2
This converts the 4 GB partition into something that can be used as virtual RAM.
For root partition:
mkfs.ext4 /dev/nvme0n1p3
This converts the root partition into a file system that is called ext4.
6. Mounting the partitions
This is for setting a reference point to the partitions we just created.
For the EFI partition:
mount --mkdir /dev/nvme0n1p1 /mnt/boot
For the root partition:
mount /dev/nvme0n1p3 /mnt
For the swap partition:
swapon /dev/nvme0n1p2
Step 3: The Arch Linux Installation
1. Updating the mirrorlist (optional)
The mirrorlist is a list of mirror servers from which packages can be downloaded. Choosing the right mirror server could get you higher download speeds.
This step isn't required as the mirror list is automatically updated when connected to the internet but if you would like to manually do it, its in the file
/etc/pacman.d/mirrorlist
2. Installing base Linux kernel and firmware
To do this, use the command
pacstrap -K /mnt base linux linux-firmware
Step 4: Configuring Arch Linux system
1. generating fstab
The fstab is the file system table. It contains information on each of the file partitions and storage devices. It also contains information on how they should be mounted during boot.
To do it, use the command:
genfstab -U /mnt >> /mnt/etc/fstab
2. Chroot
Chroot is short for change root. It is used to directly interact with the Arch Linux partitions from the live environment in the USB.
To do it, use the command:
arch-chroot /mnt
3. Time
The timezone has 2 parts the region and the city. I am from India so my region is Asia and the city is Kolkata. Change yours appropriately to your needs.
The command:
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
We can also set the time in hardware clock as UTC.
To do that:
hwclock --systohc
4. Installing some important tools
The system you have installed is a very basic system, so it doesn't have a lot of stuff. I'm recommending two very basic tools as they can be handy.
i) nano:
This is a text editor file so you can make changes to configuration files.
pacman -S nano
ii) iwd:
This is called iNet wireless daemon. I recommend this so that you can connect to wi-fi once you reboot to your actual arch system.
pacman -S iwd
5. Localization
This is for setting the keyboard layout and language. Go to the file /etc/locale.conf by using
nano /etc/locale.conf
I want to use the english language that is the default in most devices so for doing that you have to uncomment(remove the #) for the line that says
LANG=en_US.UTF-8
As there are a lot of lines you can search using ctrl+F.
Then ctrl+X to save and exit.
Then use the command
locale-gen
This command generates the locale you just uncommented.
6. Host and password
To create the host name, we should do it in the /etc/hostname file. Use
nano /etc/hostname
Then type in what your hostname would be.
ctrl + X to save and exit.
To set the password of your root user, use the command
passwd
7. Getting out of chroot and rebooting the system
To get out of chroot simply use
exit
Then to reboot the system use
reboot
Remove the installation medium(USB) as the device turns off.
Step 5: Enjoy Arch Linux
Arch Linux is one of the most minimal systems. So you can customize it to your liking. You can also install other desktop environments if you feel like it.