Arch linux is the most anticipated linux distribution. It is lightweight, flexible and powered by a strong community. Its rolling release style keeps your PC ever updated.
We are going to install Arch Linux dual booting with windows.
*Updated on Feb 02, 2020*
Note: It is strongly recommended that you install windows prior to installing arch linux. Before installing windows create a boot partition of size 512MB.
So lets start.
Creating arch linux bootable usb
Get arch installation iso file from download here
After downloading arch.iso its time to create bootable usb drive using iso file.
If you are using linux then use dd
dd if=image.iso of=/dev/sdb bs=4M
If you are on windows, you can install Rufus utility to make your arch linux bootable usb.
If you want to install arch linux in uefi mode then in rufus select “GPT Partition Scheme for UEFI”. It is recommended that your windows installation should be also in UEFI mode if you are installing linux in UEFI Mode.
If you are not sure then just select MBR style partition. Windows 7+ supports GPT style partitions.
The best way to detect the boot mode of Windows is to do the following (info from here):
Boot into Windows
Press Win key and ‘R’ to start the Run dialog
In the Run dialog type “msinfo32” and press Enter
In the System Information windows, select System Summary on the left and check the value of BIOS mode item on the right
If the value is UEFI, Windows boots in UEFI-GPT mode. If the value is Legacy, Windows boots in BIOS-MBR mode.
In case where Windows and Linux dual boot from the same disk, it is advisable to follow the method used by Windows, ie. either go for UEFI-GPT boot or BIOS-MBR boot.
For more info please visit Arch Linux Dual boot with Windows.
I have windows 10 installed as UEFI-GPT so I am going to boot in UEFI mode and all my partitions will be in GPT style.
I have windows 10 installed in partition 2 already. Partition 1 of 512MB was created by windows to keep its boot loader.
So I am going to create 3 new partitions for linux.
First thing is to identify your existing disk partitions
Use cgdisk or cfdisk to create new partitions. Here is a great article explaining how to create different partitions.
If you are setting up fresh disk i.e no data in it then it is recommended to create a boot partition of 512MB. This boot partition is also needed for UEFI based install.
All setup, lets start installing
I have created 3 linux partitions, using cfdisk and selecting GPT
/dev/sda1 for efi boot /dev/sda2 for windows /dev/sda3 for linux root /dev/sda4 for swap /dev/sda5 for home
Formatting linux partitions
Partitions are created and now I am going to format them so linux can use them for root and home. Don’t format swap.
# mkfs.ext4 /dev/sda3 # mkfs.ext4 /dev/sda5
# mkswap /dev/sda4 # swapon /dev/sda4
All partitions formatted and swap set, now mount them.
# mount /dev/sda3 /mnt # mkdir /mnt/home # mount /dev/sda5 /mnt/home # mkdir /mnt/boot # mount /dev/sda1 /mnt/boot
Partitions setup and mounted, lets start installing arch linux.
Test internet connection
Make sure you are connected to internet.
# ping -c 3 www.google.com
If you have wifi, you can use “wifi-menu” to select the connection.
First refresh gpg keys so pacman can verify the installation packages.
If you have .sig file downloaded along with .iso file, you can verify keys by using
# gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
otherwise just refresh the keys
# pacman-key --refresh-keys
Verify UEFI boot
Verify your system booted in UEFI mode.
# ls /sys/firmware/efi/efivars
If you see list of files that means system was booted in UEFI mode.
Update the system clock
# timedatectl set-ntp true
# pacstrap /mnt base linux linux-firmware
Hit Enter and it will show the screen below
Hit enter and it will start downloading and installing.
Generate mount configuration file
linux needs to store partitions and mount information for future use to auto mount drives
lets generate that configuration file
# genfstab -U /mnt >> /mnt/etc/fstab
to make sure file has been create correctly please use following
# nano /mnt/etc/fstab
Switching from usb to arch root on your system
# arch-chroot /mnt /bin/bash
BOOT Loader Configuration
I am going to use GRUB boot loader for booting arch linux along with windows, if you prefer Systemd-boot loader instead of GRUB then follow this link for instructions and skip the steps related to GRUB.
To continue with GRUB follow the steps below.
First, install the packages grub and efibootmgr
GRUB is the bootloader and efibootmgr is used by the GRUB installation script to write boot entries for efi systems.
# pacman -S grub efibootmgr
Mount the efi file system partition, for example it is /dev/sda2
# mount /dev/sda1 /boot
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
If you are having Windows as dual boot you ll need to add windows in grub boot menu, for that you need to install os-prober
# pacman -S os-prober
Mount the file system where windows is installed, for example windows 10 is installed on /dev/sda2
# mkdir /mnt/windows10 # mount /dev/sda2 /mnt/windows10
Generate grub configuration file
# grub-mkconfig -o /boot/grub/grub.cfg
Configure your net work
We need to configure network so it would be connected automatically after reboot.
# pacman -S netctl wpa_supplicant dialog
If you prefer wifi:
# wifi-menu Select your network and provide key
If you prefer LAN then do the following
# systemctl enable dhcpcd@interface_name.service example for ethernet: # systemctl enable email@example.com example for wifi: # systemctl enable firstname.lastname@example.org
To find your interface name you can use either
# ip link or # ls /sys/class/net
You will see your device name as some thing like “enp38s0” for ethernet and “wlo1” for wifi.
Bravo!!! our new arch installation completed.
Restart the system and then continue post configuration i.e adding hostname, adding user and installing gnome.
Set the root password with:
Now it’s time to create a user for the system and also add some groups to it.
So run the following command and replace ‘tofeeq‘ with your user-name.
# useradd -m -g users -G wheel,storage,power -s /bin/bash tofeeq
add a password to tofeeq
# passwd tofeeq
Once that is done, we will now allow the users in wheel group to be able to performance administrative tasks with sudo. Run the following command to edit the sudoers:
# EDITOR=nano visudo
It will open the sudoers file where you have to uncomment this line:
%wheel ALL=(ALL) ALL
I will also recommend installing bash-completion so that Arch auto-complete commands of names of packages:
# pacman -S bash-completion
Now we will also install mesa for 3D support:
# pacman -S mesa
It’s time to install video drivers. I am using intel graphic card so would be using
# sudo pacman -S xf86-video-intel
If you are not using intel then you might explore
install network managers
# pacman -S NetworkManager # systemctl enable NetworkManager.service # systemctl start NetworkManager.service
# pacman -S alsa-utils pulseaudio pavucontrol
Install Desktop Environment
# sudo pacman -S gnome gnome-extra
This ll install XServer and all required packages itself as dependencies.
Select a mirror list
It is recommended that you select nearest mirror to get fast downloads
# nano /etc/pacman.d/mirrorlist
find your country or nearest one in file by pressing ctrl+w and type your country name and hit enter
copy whole line using alt+6 and now go to start by using pageup button or home button on keyboard
paste that line on the top of file using ctrl+u
now save the file using ctrl+x and enter y to save
Set your locale
edit locales file
# nano /etc/locale.gen
and uncomment your locale
I uncomment en_US.UTF-8 UTF-8 for english
Generate the locale(s) specified in /etc/locale.gen:
Create the /etc/locale.conf file substituting your chosen locale:
# echo LANG=en_US.UTF-8 > /etc/locale.conf
Export substituting your chosen locale:
# export LANG=en_US.UTF-8
Available time zones and subzones can be found in the /usr/share/zoneinfo/Zone/SubZone directories.
To view the available zones, check the directory /usr/share/zoneinfo/:
# ls /usr/share/zoneinfo/
Similarly, you can check the contents of directories belonging to a subzone:
# ls /usr/share/zoneinfo/Asia
Create a symbolic link /etc/localtime to your subzone file /usr/share/zoneinfo/Zone/SubZone using this command:
# ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime
# ln -s /usr/share/zoneinfo/Asia/Karachi /etc/localtime
Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.
# hwclock --systohc --utc
Set the hostname of your computer (e.g. arch):
# echo arch > /etc/hostname
# systemctl enable gdm.service # systemctl start gdm.service
Now you see gnome desktop appears
All done … Cheers 🙂