DEV Community

Kb Bohara
Kb Bohara

Posted on • Edited on

1

Install Arch with swapfile baby.

Hi, let's get started with our install. Download the ISO and boot it however you want.

1. Connect to WiFi

# Connect to your WiFi (replace <wifi_name> with your network)
iwctl station wlan0 connect <wifi_name>
Enter fullscreen mode Exit fullscreen mode

2. Test the Connection

# Ping a website to check connectivity
ping kbbohara.com.np
Enter fullscreen mode Exit fullscreen mode

3. Enable NTP

# Set network time protocol
timedatectl set-ntp true
Enter fullscreen mode Exit fullscreen mode

4. Identify Your Disk

# List disks to identify your target disk (mine is /dev/sda)
lsblk
Enter fullscreen mode Exit fullscreen mode

5. Partition the Disk

# Partition disk /dev/sda:
fdisk /dev/sda

# Inside fdisk, input the following:
#  g        -> Create a new GPT partition table
#  n        -> Create new partition (EFI)
#           -> Accept default partition number
#           -> Accept default first sector
#           -> Enter "+512M" for size
#  n        -> Create new partition (Linux filesystem)
#           -> Accept defaults to use the remaining space
#  w        -> Write changes and exit
Enter fullscreen mode Exit fullscreen mode

6. Format the Partitions

# Format EFI partition as FAT32 and Linux partition as ext4
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
Enter fullscreen mode Exit fullscreen mode

7. Mount the Partitions

# Mount the Linux partition and create/mount the boot directory for EFI
mount /dev/sda2 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
Enter fullscreen mode Exit fullscreen mode

8. Install Base Packages

# Install base system, Linux kernel, firmware, and vim
pacstrap /mnt base linux linux-firmware vim
Enter fullscreen mode Exit fullscreen mode

9. Generate fstab

# Generate filesystem table
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
Enter fullscreen mode Exit fullscreen mode

10. Change Root

# Enter the new system environment
arch-chroot /mnt
Enter fullscreen mode Exit fullscreen mode

11. Create Swapfile

# Create and activate a 16GB swapfile
fallocate -l 16GB /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Enter fullscreen mode Exit fullscreen mode

12. Add Swapfile to fstab

# Open fstab and add the swapfile entry at the end
vim /etc/fstab
# Add: /swapfile none swap defaults 0 0
Enter fullscreen mode Exit fullscreen mode

13. Set Timezone & Clock

# Link timezone and sync hardware clock
ln -sf /usr/share/zoneinfo/Asia/Kathmandu /etc/localtime
hwclock --systohc
Enter fullscreen mode Exit fullscreen mode

14. Configure Locale

# Edit locale.gen to uncomment en_US.UTF-8 and generate locale
vim /etc/locale.gen
locale-gen
echo "LANG=en_us.UTF-8" > /etc/locale.conf
Enter fullscreen mode Exit fullscreen mode

15. Set Hostname

# Set hostname to "arch"
echo "arch" > /etc/hostname
Enter fullscreen mode Exit fullscreen mode

16. Configure Hosts File

# Edit /etc/hosts for proper hostname resolution
vim /etc/hosts
# Add the following:
# 127.0.0.1   localhost
# ::1         localhost
# 127.0.1.1   arch.localdomain arch
Enter fullscreen mode Exit fullscreen mode

17. Set Root Password

# Set the root password
passwd
Enter fullscreen mode Exit fullscreen mode

18. Install & Configure systemd-boot

# Install systemd-boot on the EFI partition
bootctl install

# Create loader configuration
vim /boot/loader/loader.conf
# Add:
# default  arch
# timeout  3
# editor   no

# Create boot entry for Arch Linux
vim /boot/loader/entries/arch.conf
# Add:
# title   Arch Linux
# linux   /vmlinuz-linux
# initrd  /initramfs-linux.img
# options root=UUID=<your-root-partition-UUID> rw
# Get UUID: blkid /dev/sda2
Enter fullscreen mode Exit fullscreen mode

19. Install Additional Packages & Finalize

# Install necessary packages
pacman -S networkmanager network-manager-applet wpa_supplicant dialog os-prober mtools dosfstools base-devel linux-headers

# Exit chroot, unmount all partitions, and reboot
exit
umount -a
reboot
Enter fullscreen mode Exit fullscreen mode

Post-Install Steps

Connect to WiFi with nmcli

# Use nmcli or your preferred network manager after reboot
nmcli device wifi list
nmcli device wifi connect <wifi_name> password <password>
Enter fullscreen mode Exit fullscreen mode

Create a New User

# Create a new user and add to the wheel group
useradd -m -G wheel baby
passwd baby

# Allow wheel group sudo privileges
EDITOR=vim visudo
# Uncomment: %wheel ALL=(ALL) ALL
Enter fullscreen mode Exit fullscreen mode

Install GPU Drivers

# For Intel:
sudo pacman -S xf86-video-intel intel-media-driver

# For AMD:
sudo pacman -S xf86-video-amdgpu

# For NVIDIA:
sudo pacman -S nvidia nvidia-utils
Enter fullscreen mode Exit fullscreen mode

Audio Setup

// By default, ALSA provides basic audio support.
// For a modern audio stack, install PipeWire.
// install:
pipewire # core
pipewire-pulse # (pulse-audio replacement)
wireplumber #(pipewire session manager)
alsa-utils #(for ALSA support)
helvum #(optional, for pipewire graph GUI)
Enter fullscreen mode Exit fullscreen mode

Install Hyprland and a Greeter

# Install Hyprland (Wayland compositor)
sudo pacman -S hyprland wayland wlroots xorg-xwayland polkit

# For a login greeter, consider installing ly
sudo pacman -S ly
Enter fullscreen mode Exit fullscreen mode

// Done. Enjoy your Arch Linux with Hyprland!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (1)

Collapse
 
thekbbohara profile image
Kb Bohara • Edited

My hyprland conf: git clone https://github.com/thekbbohara/.dotfiles.git

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

If you found this post helpful, please leave a ❤️ or a friendly comment below!

Okay