Step-by-Step Guide- How to Install Arch Linux for a Customized and Lightweight OS Experience
How to Install Arch Linux: A Step-by-Step Guide
Installing Arch Linux can be a rewarding experience for those looking to gain a deeper understanding of Linux and its inner workings. However, it can also be challenging for beginners due to its simplicity and the lack of hand-holding compared to other Linux distributions. In this article, we will walk you through the process of installing Arch Linux, step by step, to ensure a smooth and successful installation.
Before you begin, make sure you have the following prerequisites:
1. A USB drive with at least 1GB of space (2GB is recommended).
2. A computer with a 64-bit CPU (x86_64).
3. A stable internet connection.
4. Basic knowledge of Linux commands and partitioning.
Step 1: Download the Arch Linux ISO
1. Visit the Arch Linux website (https://archlinux.org/) and download the latest ISO image for your architecture (x86_64).
2. Burn the ISO image to a USB drive using a tool like Rufus (https://rufus.ie/).
Step 2: Boot into the Arch Linux Live Environment
1. Insert the USB drive into your computer and restart it.
2. Enter the BIOS or UEFI settings and change the boot order to boot from the USB drive.
3. Save the changes and exit the BIOS/UEFI settings.
4. Your computer should now boot into the Arch Linux Live Environment.
Step 3: Partition Your Hard Drive
1. Open a terminal in the Arch Linux Live Environment.
2. Use the `fdisk` command to partition your hard drive. For example, to create a primary partition for the root (/) directory, type:
“`
fdisk /dev/sda
“`
3. Press `n` to create a new partition, then `p` to create a primary partition.
4. Enter the starting sector as `1` and press `Enter` to accept the default ending sector.
5. Set the partition type to `8e` for an ext4 filesystem.
6. Press `w` to write the changes to the disk.
Step 4: Format the Partition
1. Use the `mkfs.ext4` command to format the newly created partition. For example:
“`
mkfs.ext4 /dev/sda1
“`
Step 5: Mount the Partition
1. Mount the formatted partition to the `/mnt` directory using the `mount` command. For example:
“`
mount /dev/sda1 /mnt
“`
Step 6: Install the Base System
1. Install the base system by running the following command:
“`
pacstrap /mnt base base-devel
“`
2. Wait for the installation to complete. This process may take some time.
Step 7: Configure the System
1. Generate an SSH key for remote access by running:
“`
ssh-keygen -t rsa -b 4096
“`
2. Edit the `/etc/pacman.d/mirrorlist` file to select a mirror closer to your location.
3. Update the system package lists by running:
“`
pacman -Sy
“`
4. Create a new user and password by running:
“`
useradd -m -g wheel your_username
passwd your_username
“`
5. Generate a new `fstab` file by running:
“`
genfstab -U /mnt >> /mnt/etc/fstab
“`
Step 8: Chroot into the New System
1. Change the current directory to the mounted partition:
“`
cd /mnt
“`
2. Enter the chroot environment by running:
“`
arch-chroot /mnt
“`
Step 9: Install System Components
1. Update the system package lists:
“`
pacman -Sy
“`
2. Install essential system components such as network manager, bootloader, and other required packages:
“`
pacman -S NetworkManager os-prober grub
“`
3. Configure the network by running:
“`
nmcli con mod eth0 ipv4.method manual ipv4.address 192.168.1.2/24 ipv4.gateway 192.168.1.1
“`
4. Update the `grub` configuration file by running:
“`
grub-mkconfig -o /boot/grub/grub.cfg
“`
Step 10: Reboot into the New Arch Linux System
1. Exit the chroot environment by running:
“`
exit
“`
2. Unmount the mounted partitions:
“`
umount -R /mnt
“`
3. Restart your computer:
“`
reboot
“`
Congratulations! You have successfully installed Arch Linux. Enjoy your new system and the satisfaction of having built it from the ground up.