DEV Community

Cover image for Mastering Arch Linux: A Guide to Installation, Commands, and Mastery(Part-1)[Must Read]
Trix Cyrus
Trix Cyrus

Posted on

Mastering Arch Linux: A Guide to Installation, Commands, and Mastery(Part-1)[Must Read]

Author: Trix Cyrus

Waymap Pentesting tool: Click Here
TrixSec Github: Click Here
TrixSec Telegram: Click Here


Arch Linux is renowned for its simplicity, flexibility, and power, making it a favorite among advanced Linux users. Whether you’re looking to customize every detail of your operating system or delve into the depths of Linux, Arch is the perfect playground. In this article, we’ll explore how to get started with Arch Linux and master its essential commands.


Why Choose Arch Linux?

Arch Linux stands out for several reasons:

  • Rolling Release Model: Always have the latest software.
  • Minimalist Installation: You install only what you need.
  • AUR (Arch User Repository): Access to a vast library of community-contributed packages.
  • Active Community: A rich ecosystem of guides and forums.

If you're ready to take control of your Linux experience, Arch Linux is the way to go.


1. Installing Arch Linux

Prerequisites

  1. Download the ISO: Head to Arch Linux's official website and grab the latest ISO.
  2. Create a Bootable USB: Use tools like Rufus or dd to create a bootable USB.
  3. Internet Access: Ensure you have a stable connection.

Installation Steps

  1. Boot into the ISO:
    • Select your bootable USB from the boot menu.
  2. Partition the Disk: Use fdisk or cfdisk:
   fdisk /dev/sda
Enter fullscreen mode Exit fullscreen mode

Create partitions for the root, swap, and optionally home.

  1. Format the Partitions:
   mkfs.ext4 /dev/sda1  # For root
   mkswap /dev/sda2     # For swap
   swapon /dev/sda2
Enter fullscreen mode Exit fullscreen mode
  1. Mount the Partitions:
   mount /dev/sda1 /mnt
Enter fullscreen mode Exit fullscreen mode
  1. Install the Base System:
   pacstrap /mnt base linux linux-firmware
Enter fullscreen mode Exit fullscreen mode
  1. Generate the Filesystem Table (FSTAB):
   genfstab -U /mnt >> /mnt/etc/fstab
Enter fullscreen mode Exit fullscreen mode
  1. Chroot into the System:
   arch-chroot /mnt
Enter fullscreen mode Exit fullscreen mode
  1. Set the Timezone and Locale:
   ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
   hwclock --systohc
Enter fullscreen mode Exit fullscreen mode
  1. Set the Root Password:
   passwd
Enter fullscreen mode Exit fullscreen mode
  1. Install a Bootloader (e.g., GRUB):

    pacman -S grub
    grub-install /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
    
  2. Reboot:

    exit
    umount -R /mnt
    reboot
    

2. Essential Arch Linux Commands

Once you’ve installed Arch Linux, mastering these commands will help you navigate and customize your system.

Package Management with Pacman

Pacman is Arch’s package manager. Here are some essential commands:

  • Update the system:
  sudo pacman -Syu
Enter fullscreen mode Exit fullscreen mode
  • Install a package:
  sudo pacman -S package_name
Enter fullscreen mode Exit fullscreen mode
  • Remove a package:
  sudo pacman -R package_name
Enter fullscreen mode Exit fullscreen mode
  • Search for a package:
  pacman -Ss keyword
Enter fullscreen mode Exit fullscreen mode
  • Clean the package cache:
  sudo pacman -Sc
Enter fullscreen mode Exit fullscreen mode

Working with AUR (Arch User Repository)

AUR allows you to access community-built packages.

  1. Install an AUR helper like yay:
   sudo pacman -S yay
Enter fullscreen mode Exit fullscreen mode
  1. Install an AUR package:
   yay -S package_name
Enter fullscreen mode Exit fullscreen mode

System Management

  • View running processes:
  top
Enter fullscreen mode Exit fullscreen mode
  • Check disk usage:
  df -h
Enter fullscreen mode Exit fullscreen mode
  • Monitor memory usage:
  free -h
Enter fullscreen mode Exit fullscreen mode
  • List hardware details:
  lscpu
  lspci
  lsblk
Enter fullscreen mode Exit fullscreen mode

3. Customizing Arch Linux

Window Managers

Arch Linux doesn’t come with a graphical interface by default, so you’ll need to install one. Popular options include:

  • Desktop Environments:
    • GNOME: sudo pacman -S gnome
    • KDE Plasma: sudo pacman -S plasma
  • Window Managers:
    • i3: sudo pacman -S i3
    • Openbox: sudo pacman -S openbox

Themes and Appearance

  • Install a GTK Theme:
  sudo pacman -S arc-gtk-theme
Enter fullscreen mode Exit fullscreen mode
  • Set up Fonts:
  sudo pacman -S ttf-dejavu ttf-liberation
Enter fullscreen mode Exit fullscreen mode

Configure Dotfiles

Dotfiles allow you to personalize your shell, editor, and more. Examples:

  • .bashrc or .zshrc for shell customization.
  • .vimrc for Vim editor settings.

4. Troubleshooting Tips

  • Pacman Database Issues:
  sudo rm -rf /var/lib/pacman/db.lck
Enter fullscreen mode Exit fullscreen mode
  • Boot Issues: Reboot into a live USB and chroot into your system to fix configurations.
  • AUR Build Errors: Ensure all dependencies are installed using makepkg.

5. Resources for Arch Linux Users


Conclusion

Mastering Arch Linux takes patience and practice, but the reward is a system tailored precisely to your needs. By learning its installation process, essential commands, and customization options, you’ll not only gain a deeper understanding of Linux but also appreciate the power of open-source technology.

Have questions or tips about Arch Linux? Share them in the comments below!


~Trixsec

Top comments (3)

Collapse
 
urbanisierung profile image
Adam

I'm using Ubuntu with i3 for its simplicity and I'm really happy with it. Looking back at the time I was using Gentoo: I now need much less time in configuring stuff or fixing bugs. How it's with Arch: do you have to spend lot of time for troubleshooting, or is it just working?

Collapse
 
trixsec profile image
Trix Cyrus

Arch requires more setup and occasional troubleshooting due to its rolling-release model, but with the Arch Wiki and forums, issues are usually easy to resolve. Once configured, it’s stable and highly customizable—perfect if you enjoy control over your system!

Collapse
 
urbanisierung profile image
Adam

Sounds like I have to try it out. Thanks for the introduction!