How to Install Arch Linux

From LearnLinux.tv Wiki
Jump to navigationJump to search

Contents

Overview

In this video, the viewer is shown how to install Arch Linux.

Relevant Links
Original Video
Arch Linux Download Page

Installation Steps

Download latest Arch linux ISO

https://www.archlinux.org/download/

Check if there is an Internet connection (if on wired)
 ip addr show
For WiFi, you can use wifi-menu
 wifi-menu
If you do have a network connection but no IP address use:
 dhcpcd
Edit the mirrorlist (optional)
 nano /etc/pacman.d/mirrorlist
Update repository index
 pacman -Syyy
See partitions/drives on the system (find the name of your hard drive)
 fdisk -l
Start the partitioner (fdisk)
 fdisk /dev/<DEVICE> (substitute <DEVICE> for your device name, example: /dev/sda or /dev/nvme0n1)
Show current partitions
 p
Create EFI partition
 g (to create an empty GPT partition table)
 n
 enter
 enter
 +500M
 t
 1 (For EFI)
Create rootfs partition
 n
 enter
 enter
 +30G
 
Create home partition
 n
 enter
 enter
 enter
Show current partitions again
 p
Finalize partition changes
 w
Format the EFI partition
 mkfs.fat -F32 /dev/<DEVICE PARTITION 1> (for example: /dev/sda1)
Format the rootfs partition
 mkfs.ext4 /dev/<PARTITION 2> (for example: /dev/sda2)
Format the home partition
 mkfs.ext4 /dev/<PARTITION 3> (for example: /dev/sda3)
Mount the root partition
 mount /dev/<PARTITION 2> /mnt
Create the home partition mount point
 mkdir /mnt/home
Mount the home volume
 mount /dev/<PARTITION 3> /mnt/home
Create the /etc dirctory
 mkdir /mnt/etc
Create the /etc/fstab file
 genfstab -U -p /mnt >> /mnt/etc/fstab
Check the /etc/fstab file
 cat /mnt/etc/fstab
Install Arch Linux base packages
 pacstrap -i /mnt base
Access the in-progress Arch installation
 arch-chroot /mnt
Install a kernel and headers
 pacman -S linux linux-headers

For LTS:

 pacman -S linux-lts linux-lts-headers

Or both:

 pacman -S linux linux-lts linux-headers linux-lts-headers 
Install a text editor
 pacman -S nano
Install optional packages
 pacman -S base-devel openssh
Enable OpenSSH if you've installed it
 systemctl enable sshd
Install packages for networking
 pacman -S networkmanager wpa_supplicant wireless_tools netctl
Install dialog (required for wifi-menu)
 pacman -S dialog
Enable networkmanager
 systemctl enable NetworkManager
Create the initial ramdisk for the main kernel
 mkinitcpio -p linux
Create the initial ramdisk for the LTS kernel (if you've installed it)
 mkinitcpio -p linux-lts
Uncomment the line from the /etc/locale.gen file that corresponds to your locale
 nano /etc/locale.gen (uncomment en_US.UTF-8)
Generate the locale
 locale-gen
Set the root password
 passwd
Create a user for yourself
 useradd -m -g users -G wheel <username>
Set your password
 passwd <username>
Install sudo (may already be installed)
 pacman -S sudo
Allow users in the 'wheel' group to use sudo
 EDITOR=nano visudo

Uncomment:

 %wheel ALL=(ALL) ALL
Install packages for GRUB
 pacman -S grub efibootmgr dosfstools os-prober mtools
Create the directory for EFI boot
 mkdir -p /boot/EFI
Mount the EFI partition
 mount /dev/<DEVICE PARTITION 1> /boot/EFI
Install GRUB
 grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
Create the locale directory for GRUB
 mkdir /boot/grub/locale
Copy the locale file to locale directory
 cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
Generate GRUB's config file
 grub-mkconfig -o /boot/grub/grub.cfg
Create swap file
 fallocate -l 2G /swapfile
 chmod 600 /swapfile
 mkswap /swapfile
Back up the /etc/fstab file
 cp /etc/fstab /etc/fstab.bak
Add the swap file to the /etc/fstab file
 echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
Check the /etc/fstab file to make sure it includes all the right partitions
 cat /etc/fstab

You should have a mountpoint for the root filesystem, boot partition, home partition, and swap file

Wrapping Up, Optional Considerations

Install CPU Microde files (AMD CPU)
 pacman -S amd-ucode
Install CPU Microde files (Intel CPU)
 pacman -S intel-ucode
Install Xorg if you plan on having a GUI
 pacman -S xorg-server
Install 3D support for Intel or AMD graphics

If you have an Intel or AMD GPU, install the mesa package:

 pacman -S mesa
Install Nvidia Driver packages if you have an Nvidia GPU
 pacman -S nvidia nvidia-utils

Note: Install nvidia-lts if you've installed the LTS kernel:

 pacman -S nvidia-lts
Install Virtualbox guest packages

If you're installing Arch inside a Virtualbox virtual machine, install these packages:

 pacman -S virtualbox-guest-utils xf86-video-vmware

Moment of truth: Reboot your machine

Exit the chroot environment
 exit
Unmount everything (some errors are okay here)
 umount -a
Reboot the machine
 reboot