DEV Community

Kb Bohara
Kb Bohara

Posted on

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

# 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 and its PulseAudio replacement
sudo pacman -S pipewire pipewire-pulse pipewire-alsa

// Most apps will use PipeWire automatically.
// Optionally, install a volume control (e.g., pavucontrol) if needed.
sudo pacman -S pavucontrol

// That's it for audio!
Enter fullscreen mode Exit fullscreen mode

Install Hyprland and a Greeter

# Install Hyprland (Wayland compositor)
sudo pacman -S hyprland

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

// Done. Enjoy your Arch Linux with Hyprland!

Top comments (0)