Featured Post

Recommended

How to Pass a Single GPU on a Virtual Machine: QEMU/KVM

GPU Passthrough with QEMU/KVM is now simpler than ever. Hi my name is Abdullah Musa and welcome to my blog, MusaBase! . In this c...

Hyprland (ML4W) Dotfiles On Arch Linux For Cutting Edge Configuration

Hyprland (ML4W) Dotfiles On Arch Linux For Cutting Edge Configuration

hyprland-ml4w-on-arch-linux

final-result
Let's do this!

Hi all, welcome to MusaBase!. In this article, I'll guide you through installing Hyprland on Arch Linux and take your desktop experience to the next level. We'll use the ML4W dotfiles repository and the official archinstall script. Without further ado, let's get started.







what is Hyprland?

Hyprland is a dynamic tiling Wayland compositor and window manager for Linux, known for its smooth animations, customizable features, and clean codebase. It's written in C++ and focuses on providing a visually appealing and efficient way to manage windows and desktops.




Step 1: Partitioning & Formatting Storage Disk

We can install Hyprland on almost any Linux distribution, but Arch Linux provides a minimal base that helps ensure a clean Hyprland installation. Using the archinstall script makes installing Arch Linux easier then ever. Follow these steps to install Arch Linux:

1.1: Boot into the Arch Linux Live Installation Environment

  • Reboot your PC.
  • Press F9, F10, F11, F12, Esc, or Del, (depending on your motherboard) to enter BIOS/UEFI settings.
  • Locate and disable Secure Boot.
  • Save changes and exit.
  • When prompted, press the key to select a boot device (e.g., F9) depending on your motherboard.
  • Choose your USB drive as the boot device.
  • You should see the Arch Linux boot menu, similar to this one:

  • Press Enter on Arch Linux install medium (x86_64, UEFI) .
  • After a few seconds, you will be in the Arch Linux live installation environment.

1.2: Partitioning with cfdisk

Next, we need to partition the hard disk to create a boot and root parititon. You can use fdisk, gparted or cfdisk. In this guide, I'll use cfdisk because it's convenient and provides an easy-to-use text-based "graphical interface".

  • If you have more than one drive connected, list all storage devices with:
lsblk
  • Now run the following command to open the cfdisk interface.
  • Select gpt as the partition table and press Enter.
cfdisk /dev/sdb

1.2.1: Create the Boot Parititon

  • In the cfdisk interface, select Free Space and press Enter.
  • Allocate around 512 MB to 1 GB depending on your needs. (.e.g., 1G or 512M) with capital G for Gigabytes and M for Megabytes
  • Next on the bottom options menu select [ Type ] and press Enter to open Partition Type/Filesystem menu.
  • Choose EFI System and press Enter.
  • Setting the boot partition table to EFI is essential because without it the firmware won't be able to locate and execute the bootloader.

1.2.2: Create the Root Partiton

  • Next, select Free Space again, then choose [ New ] from the bottom menu and press Enter.
  • Allocate the desired size for your root partition. If you plan to create a separate /home partition, allocate accordingly. In this example, we'll give 15GB to the root partition reserve space for swap partition.

1.2.3: Create a Swap Partition (Optional)

This step is optional, if you want to create a Swap Partition for your system then follow this or skip to next step.

  • Select Free Space then choose [ New ] and press Enter.
  • Allocate around 4GB (or as needed) and press Enter.
  • Next, with the Swap Partition highlighted, select [ Type ] and choose Linux swap partition type from the menu and press Enter.

1.2.4: Write the Partition Changes

This step is crucial, without writing the changes, your new partitions won't be created.

  • Navigate to [ Write ] in the bottom options menu and press Enter.
  • Type yes when prompted and press Enter.
  • Finall, select [ Quit ] to exit cfdisk.

1.3: Format the Parititons

Now that all required partitions have been created, let's format them before installing Arch Linux. First, run lsblk command to list all attached storage devices and their partitions. It's an easy way to identify partitions avoidformatting the wrong one:

Partitioned Hard-drive sdb

1.3.1: Format the Boot Partition

  • Run the following command:
mkfs.vfat -F32 /dev/sdb1

1.3.2: Format the Root Partition

  • Run the following command:
mkfs.ext4 /dev/sdb2
format the root partition

1.3.3: Make Swap Area (Optional if you created a swap partition)

  • If you created a swap partition, run the following command (replace sdb3 with your swap partition name):
mkswap /dev/sdb3
making a swap area



Step 2: Updating & Synchronizing the Live Environment

Before running the arhcinstall script, I need to cover a few preliminary steps to ensure it doesn't fail. You can skip ahead to the installation section if you wish, but if you encounter any errors, return to this step and try again.

2.1: Keys Activation

  • Run these two commands consecutively:
pacman-key --init
pacman-key --populate archlinux

2.1: Synchronize and Update the Local Package Database

  • Run the following command:
pacman -Sy

2.2: Update the Keyring

  • Run the following command:
pacman -S archlinux-keyring

2.3: Install or Update the archinstall Script

  • Run the following command:
pacman -S archinstall




Step 3: Install Arch Linux with archinstall Script

3.1: Run the archinstall Script

  • Finally, run the following command to start the installer:
archinstall

3.2: Mounting Partitions

  • Navigate to Disk Configuration and press Enter.
  • Select Partition press Enter.
  • Select Manual Partitioning and press Enter.
  • Choose the disk you partitioned for Arch Linux and press Enter, for me it's /dev/sdb.
choose-disk

3.2.1: Mount the Boot Partition

  • Select the boot partition created in Step 1 (Efi System) and press Enter.
  • Select Assign mountpoint and press Enter.
  • When prompted, enter the mountpoint and press Enter:
/boot

3.2.2: Mount the Root Partition

  • Select the root partition created in Step 1 (formatted as ext4) and press Enter.
  • Select Assign mountpoint and press Enter.
  • When prompted, enter the mountpouint and press Enter:
/

3.2.3: Confirm the Partition Layout & Exit

  • If you created additional partitions (e.g., /home), mount them now in the same way.
  • After moutning every partition, select Confirm and exit and press Enter.
  • Select Back and press Enter to return to the archinstall main menu.
confirming-mounted-partition-points

3.3: Disable Swap in archinstall

  • Even if you didn't create a swap partition in Step 1, you still need to disable this options. Leaving it enabled can cuase installation errors.
  • From the archinstall main menu, select Swap and press Enter.
  • On the prompted options select no and press Enter.

3.4: Select a Bootloader

  • Select Bootloader and press Enter.
  • Choose GRUB and press Enter.

3.5: Set the Hostname

  • Select Hostname and press Enter.
  • Replace the default hostname (archlinux) with your desired hostname (e.g., MusaBase) and press Enter.

3.6: Set the Root Password

  • Select Root password and press Enter.
  • Enter a strong password for the root account, then re-enter it to confirm.

3.7: Create a User Account

3.7.1: Add a User

  • Select User account and press Enter.
  • Choose Add a user and press Enter.
  • When prompted, type your username (e.g., john) and press Enter.

3.7.2: Set User's Password

  • Enter a password for the new user and re-enter it to confirm.

  • When asked "if you want to make this user a superuser (sudo) ?", i am choosing no beacuse i will grant my user sudo previliges after installation of Linux OS.
  • Choose yes or no according to your needs and press Enter.

3.7.3: Confirm & Exit

  • Optionally create additional users. When finished, select Confirm and exit and press Enter.

3.8: Choose a Profile

  • Select Profile and press Enter and then choose Type.
  • Choose Minimal and press Enter and then press on back.

3.9: Configure Audio

  • Select Audio and press Enter.
  • Choose an audio server. I'm going with pulseaudio but you can pick the other option if you prefer.

3.10: Configure the Network

  • Select Network configuration and press Enter.
  • Choose NetworkManager. If you select another tool, ensure it's configured for internet access in the installed system.

3.11: Install Arch Linux

I've left all other settings at their defaults but customized the kernel and ecryption options as needed. I'm not installing extra pacakges now, I'll add them after installation. Let's move on to the installation process:

  • Select Install and press Enter.
  • When prompted to confirm your configuration, chooseyes and press Enter. The installation will then begin.

3.12: Reboot

  • Once the installation finishes, you will be prompted to reboot.
  • Reboot now to begin the next phase: installing Hyprland.
rebooting-system-after-installation-finished



Step 4: Boot into the Freshly Installed Arch Linux System

After rebooting, you will see the GRUB menu with a few options:

grub-bootloader

4.1: Login with User Account

  • Select Arch Linux and press Enter.
  • After a few seconds, you will see the tty1 command-line login prompt.
  • At the login prompt, enter the username and password you created during installation.

4.2: Grant Sudo Privileges to Your Local User

4.2.1: Switch to Super-User (root)

  • Run this command to switch user to the suerp-user account. When prompted, enter the root password you set during installation:
su

4.2.2: Install the Nano Text Editor

  • Next, runt the following command to install nano, a command line text editor:
pacman -S nano

4.2.3: Enable sudo for the Wheel Group

  • Now, we need to edit the sudoers file (visudo)to grant sudo rights to members of the wheel group.
  • Run:
EDITOR=nano visudo
editor-nano-visudo
  • It will open up sudoers file in nano:
visudo-file
  • Press the Down Key () to navigate to downward in the file.
  • Navigate all the way to bottom and look for line contatining:
# %wheel ALL=(ALL:ALL) ALL
  • Uncomment the line by deleting # from the start of the line.
  • Next, press Ctrl + O to save changes then press Enter to apply the changes, then press Ctrl + X to exit the file.

4.2.4: Add your User to the Wheel Group

  • Run the following command:
usermod -aG wheel musabase
adding-user-to-wheel-group

4.2.5: Change back to Local User

Now, that your user has sudo privileges, switch back from the super-user to your local account. It's best practice to perform administrative tasks as a normal user with sudo rather than as root.

  • Run the following command:
su username

4.3: System Update with Local User

  • Now that your user has sudo privileges, run a system update using sudo.
  • Run the following command (you will be prompted for your user's password):
sudo pacman -Syu

4.4: Install Additional Packages

Before installing Hyprland ML4W, install additional packages to avoid errors.

  • Run the following commad:
sudo pacman -S kitty firefox kate hyprland sddm curl wget git

4.5: Enable the SDDM Display Manager

  • Now that SDDM (Simple Desktop Display Manager) is installed, enable and start it so you can log into Hyprland
  • Run the following command:
sudo systemctl enable --now sddm

4.6: Login into Your Hyprland

At the login screen, enter your user's password and press Enter. After a few seconds, you will see the Hyprland desktop:

hyprland-default-screen
  • Close any welcome dialog, then press SUPER + Q or Meta + Q or WindowsKey + Q to open kitty terminal emulator.

4.7: Configure the DNS Server (Optional)

Perform this step only if you encounter network issues while downloading or installing packages (e.g., package downloads aborting).

  • In the terminal, run the following command:
sudo nano /etc/resolv.conf
  • It will open /etc/resolv.conf file in nano:
  • In the /etc/resolv.conf file, add the following line:
nameserver 8.8.8.8
nameserver-added
  • Next, press Ctrl + O to save chagnes then press Enter to apply the saves and then press Ctrl + X to exit the file.



Step 5: Install Hyprland ML4W (My Linux for Work)

  • Now that everything is set up, let's install the ML4W Dotfile.
  • In the kitty terminal, run this command:
bash <(curl -s https://raw.githubusercontent.com/mylinuxforwork/dotfiles/main/setup-arch.sh)
  • This will clone the ML4W repository and execute the installation script to set up its dotfiles.
  • This process can take 10-15 minutes, depending on your internet connection and CPU speed.
  • During execution, the script will prompt you to choose options. I'm accepting the defaults, but you can customize them as needed.




Afterwards

Now that Arch Linux and a fully Configured Hyprland are installed, you're ready to go. To adjust keybindings (e.g., terminal, browser, file manager) and other settings, edit ~/.config/hypr/hyprland.conf just remember to reload the configuration after editing by running hyprctl reload in terminal or by pressing (SUPER + Shift + R ). I'll cover further customization in another article, this is it for now.


🎉 Congratulations! your Arch Linux system with Hyprland dotfiles is now up and running!

If you hit any snags, drop a comment below, I'm here to help.
If this guide helped you, subscribe to our newsletter for more step-by-step tutorials.
1O1 out, I'll see you in the next one!