devoalda.gitlab.io/content/en/posts/arch_installation.md

10 KiB

author authorEmoji title date description draft hideToc enableToc enableTocContent tocPosition tocLevels tags series categories image
Devoalda 🐺 Linux - Arch Installation 2020-07-08T10:56:57+08:00 Arch Linux Installation false false true true inner
h1
h2
h3
arch
linux
Linux
arch
linux
images/postImages/archlinux.svg

{{< img src="/images/postImages/archlinux.svg" alt="archlinux" position="center" >}}

Introduction

This is an installation guide for Arch Linux. This is NOT a generic guide on installing Arch Linux, it is customized towards my preferences.

The Arch Linux installation guide can be found on the Arch Linux website here

Dependencies

Arch can be installed in a Virtual Machine or bare metal, installations on bare metal devices may include extra steps. Here are the dependencies

  • Arch Linux ISO
  • USB Thumbdrive (8GB) - Bare Metal Installations
  • Separate Workstation to create USB Bootable Devices

Software to create USB Bootable Devices

Linux

dd
dd if=/path/to/image/file.iso of=/dev/sdX status=progress

{{< alert theme="info" dir="ltr" >}} Where X is the USB Device E.G. /dev/sda, not the partition of the device Read more about dd: $ man dd {{< /alert >}}

Windows

balenaEtcher
Rufus
win32DiskImager

Virtual Machine managers

Any Virtual Machine managers can be used. Here are some popular ones:

VirtualBox

VMWare Workstation/Player

Installation

Hardware Configurations

Here are the hardware configurations I will be using for the virtual machine

  • 2GB Ram (2048MB)
  • 2 Processors

{{< alert theme="info" dir="ltr" >}} These settings can be changed in the future {{< /alert >}}

Arch Installation

Boot Selection

Power on the Virtual/Physical machine. Select the first option {{< img src="/images/postImages/arch_installation/bootmenu.png" title="Arch Boot" caption="Boot Menu" alt="Arch Boot Menu" position="center" >}}

Internet Conectivity

Ethernet connection is recommended. If on WI-FI use iwctl {{< img src="/images/postImages/arch_installation/ping.png" title="Arch Boot" caption="Internet Connectivity" alt="Arch Internet Connectivity" position="center" >}}

NTP

Sync the system time to NTP with timedatectl

timedatectl set-ntp true

Partitioning Drives

Use lsblk to find out your device name

Use this command to create a new partition table on your device

cfdisk /dev/sda

Select dos label type

{{< img src="/images/postImages/arch_installation/partitiontype.png" title="Partition" caption="Partition type label" alt="Arch Partition" position="center" >}}

Using the arrow keys and Enter, navigate and create these partitions

Single Drive

Partition Space Remarks
/dev/sda1 512MB boot
/dev/sda2 >=10GB root(/)
/dev/sda3 Leftover home

>1 Drive

Partition Space Remarks
/dev/sda1 512MB boot
/dev/sda2 Leftover root(/)
/dev/sdb1 All home

{{< img src="/images/postImages/arch_installation/partitiontable.png" title="Partition" caption="Partition table" alt="Arch Partition" position="center" >}}

Write the changes and Quit

Formatting Partitions

Do a lsblk again, /dev/sda should have 3 partitions

/dev/sda1

This is the boot partition, formatted to fat32

mkfs.fat -F32 /dev/sda1

/dev/sda2 and others

Other partitions are formatted to ext4

mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3

Mount partitions

Mount the root partition

mount /dev/sda2 /mnt

Create a folder and mount the home partition

mkdir /mnt/home
mount /dev/sda3 /mnt/home

Check the mount points with lsblk {{< img src="/images/postImages/arch_installation/partitionmount.png" title="Partition" caption="Partition Mount" alt="Arch Partition Mount" position="center" >}}

Pacstrap

Start the installation of arch with the Pacstrap script

pacstrap /mnt base linux linux-firmware sudo vim git base-devel

Select all and yes and wait for the installation to complete.

Fstab

Generate the fstab file

genfstab -U /mnt >> /mnt/etc/fstab

Chroot

Chroot into the system with BASH shell

arch-chroot /mnt /bin/bash

Locale

vim /etc/locale.gen

Find the languages you are going to use I am going to install

  • en_us both UTF and ISO
  • zh_SG.UTF-8
  • ko_KR.UTF-8

{{< alert theme="info" dir="ltr" >}} Can be changed later {{< /alert >}}

Save and exit the editor and generate locale

locale-gen

Create locale.conf with the corrosponding languages

echo "LANG=en_US.UTF-8" > /etc/locale.conf

Timezone

ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime

Set local time

hwclock --systohc --utc

Check the date with

date

Hostname

Set the Hostname of your system

echo arch > /etc/hostname

Edit your /etc/hosts file with vim /etc/hosts

Enter the following line

127.0.1.1 localhost.localdomain arch

Save and exit the editor

Network

Install and enable NetworkManager

pacman -S networkmanager
systemctl enable NetworkManager

Bootloader

Install grub and efibootmanager

pacman -S grub efibootmgr

Install the Bootmanager into the system

mkdir /boot/efi
mount /dev/sda1 /boot/efi
lsblk # to check if everything is mounted correctly
grub-install /dev/sda # Worked for me
# grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --removable
grub-mkconfig -o /boot/grub/grub.cfg

Root Password

Change the root password with passwd

Reboot

Exit and reboot your system

exit
umount -R /mnt
reboot

You should see GRUB screen on boot, with Arch installed

Login with root and the password previously set

Post-Installation

Arch is now installed, these are post installation processes like creating swap, user and installing a GUI

Swap

Create a swapfile with the same size as your RAM

dd if=/dev/zero of=/swapfile bs=1M count=2048 status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap defaults 0 0' >> /etc/fstab

{{< alert theme="info" dir="ltr" >}} Change 2048 to the size of your RAM in MB {{< /alert >}}

Check that your swapfile is working with free -h

User

Create a user and group

groupadd sudo
groupadd username 
useradd -m -g username -G sudo -s /bin/bash username

{{< alert theme="info" dir="ltr" >}} Change username to your desired username {{< /alert >}}

Edit sudoers file

EDITOR=vim visudo

Uncomment the line and add a line

Defaults insult
# %sudo ALL=(ALL) ALL

{{< alert theme="info" dir="ltr" >}} This will allow users in sudo group to run commands without sudo prefix {{< /alert >}}

Change the password of the user with passwd username

Reboot/Logout and login as user

DotFiles

Clone and 'install' Dotfiles from GitLab

git clone --recurse-submodules https://gitlab.com/devoalda/dotdrop-dotfiles.git
pip3 install --user -r ./dotdrop-dotfiles/dotdrop/requirements.txt
./dotdrop-dotfiles/dotdrop.sh install -p carnage

Install yay

cd /opt
sudo git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si

Install and change shell utilities

yay -S zsh starship st-luke-git
chsh -s /usr/bin/zsh username

Display

Xorg must be installed to be able to display a WM/DE

yay -S pulseaudio pulseaudio-alsa xorg xorg-xinit xorg-server

Install i3 (Optional) - More Stable

yay -S i3-gaps i3blocks i3exit

Install Xmonad & Xmobar (Optional)

yay -S xmonad xmonad-contrib xmobar-git
xmonad --recompile

Read more about my xmonad configurations here {{< alert theme="info" dir="ltr" >}} Install any WM/DE of your choice. {{< /alert >}}

Summary

Arch is installed successfully! {{< img src="/images/postImages/arch_installation/installed.png" title="Arch" caption="Installed" alt="Installed Arch Linux" position="center" >}}

Here are some programs I would install

Program Function
Firefox Web Browser
Dmenu & Utilities Application Launcher
Neovim Editor
VSCodium Editor
Pywal Themeing
Flameshot Screenshot Utility
Fcitx Multi-language Keyboard
Trayer Tray Application Support
Dunst Notification Manager
Mpd & Ncmpcpp Music Player
Mpv Video Player
Zathura PDF Reader

Have fun with your arch installation!

i use arch btw

{{< expand "Credits/References" >}} Mental Outlaw Video averagelinuxuser Arch Installation Guide {{< /expand >}}