Arch Linux Installation UEFI ext4 - LeandroTheDev/arch_linux GitHub Wiki

Load keyboard language

  • loadkeys br-abnt2

Connect to the internet

  • iwctl
  • device list
  • station wlan0 scan

This will show the intenets in your area.

  • station wlan0 get-networks
  • station wlan0 connect "INTERNET NAME"

Test internet connectivity

  • ping google.com

Update time date

  • timedatectl set-ntp true
  • timedatectl set-timezone America/Sao_Paulo

Alternativily you can see the timezones with timedatectl list-timezones

  • timedatectl status

Partitions

Creating the partition Select the one you want install arch

  • lsblk

Opens partition, ? means the disk letter

  • cfdisk /dev/sd?

Select the disk you wanted The first partition needs 300 MB is the EFI system partition

  • 300M / EFI System

Alternative 1 Swap Partition

Swap partition recommended 4GB

  • 4GB / Linux swap

Linux system

  • Default / Linux filesystem

Home partition #Optionally for formating device without losing data

  • Default / Linux filesystem

Save

  • write
  • quit

The ? means the disk letter you formated, the number is the partition

Active the UEFI boot partition

  • mkfs.fat -F32 /dev/sd?1

Alternative 1 Swap Partition

Active de swap on the partition

  • mkswap /dev/sd?2
  • swapon /dev/sd?2

Obs: if you use the Alternative 2 in Swap then probably you partition number is 2

Active linux partition, also for the home directory if exist

  • mkfs.ext4 /dev/sd?3
  • mount /dev/sd?3 /mnt

Downloading linux

  • pacman -Sy archlinux-keyring
  • pacstrap -i /mnt base-devel base linux or linux-zen linux-firmware vim

Enabling mount system

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

Entering in root user on the system

  • arch-chroot /mnt

Changing timezone

  • ln -sf /usr/share/zoneinfo/AMERICA/Sao_Paulo /etc/localtime
  • hwclock --systohc

Language

  • vim /etc/locale.gen
  • en_US.UTF-8 -> remove the #

Install the language

  • locale-gen

Naming the machine

  • vim /etc/hostname

Configuring localhost

  • vim /etc/hosts

Rembember to use Tab Spaces

127.0.0.1         localhost
::1               localhost
127.0.1.1	  machinename.localdomain	machinename

Mount the home directory, if you are using the home partition

  • mount /dev/sd?? /home

Change root password

  • passwd

Create user

  • useradd -m username

Create user password

  • passwd username

Give access to user

  • usermod -aG wheel username

Download sudo for root actions

  • pacman -S sudo

Edit visudo to grant previleges to users

  • visudo
  • export EDITOR=nano

Remove the #

#%wheel ALL=(ALL) ALL

Download the grub for boot manager

  • pacman -S grub efibootmgr dosfstools os-prober mtools ntfs-3g
  • mkdir /boot/EFI
  • mount /dev/sd?1 /boot/EFI

Installing

  • grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
  • cp /usr/share/locale/en@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
  • grub-mkconfig -o /boot/grub/grub.cfg

Script for updating grub

  • vim /usr/sbin/update-grub

Add

#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

Run script

  • grub-install /dev/sd?

Update settings

  • chown root:root /usr/sbin/update-grub
  • chmod 755 /usr/sbin/update-grub
  • update-grub

Install a network manager to use internet

  • pacman -S networkmanager
  • systemctl enable NetworkManager

If you are using home partition Create a script for mounting on boot

  • sudo vim /etc/systemd/system/home.service

Add

[Unit]
Description=Mount home
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/mount /dev/sd?? /home

[Install]
WantedBy=multi-user.target

Umounting in shutdown

  • sudo vim /etc/systemd/system/homeshutdown.service

Add

[Unit]
Description=Umount home
Before=shutdown.target reboot.target halt.target

[Service]
Type=oneshot
ExecStart=/bin/umount /home

[Install]
WantedBy=multi-user.target

Enable the services

  • systemctl enable home
  • systemctl enable homeshutdown

Finishing installing

  • exit umount -R /mnt
  • reboot

Configuring Arch Linux

Permanent loadkeys for terminal

  • sudo vim /etc/vconsole.conf

Add

KEYMAP=br-abnt2

Load numlock on startup

  • sudo vim /usr/local/bin/numlock

Add

#!/bin/bash

for tty in /dev/tty{1..6}
do
    /usr/bin/setleds -D +num < "$tty";
done
  • chmod +x /usr/local/bin/numlock

  • sudo vim /etc/systemd/system/numlock.service

Add

[Unit]
Description=numlock

[Service]
ExecStart=/usr/local/bin/numlock
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  • sudo systemctl enable numlock

Alternative 2 Swap File

Use dd to create a swap file recommended 8 GB

  • dd if=/dev/zero of=/swapfile bs=1M count=8k status=progress

Give Permissions

  • chmod 0600 /swapfile

Format to Swap File

  • mkswap -U clear /swapfile

Active Swap

  • swapon /swapfile

Add any Entry for Swap File

  • sudo vim /etc/fstab

Add

/swapfile none swap defaults 0 0

Connect to the internet

  • sudo nmcli device wifi connect "INTRNETNAME" password "password"

Active some Librarys for pacman

  • sudo vim /etc/pacman.conf

Remove the #

#[multilib]
#Include = /etc/pacman blablablabla

Arch logs when entering

  • sudo vim /etc/default/grub

Implement

GRUB_CMDLINE_LINUX="loglevel=2 nowatchdog"

# Remove the hashtag
GRUB_DISABLE_OS_PROBER=false

Disable Stop Job

  • sudo vim /etc/systemd/system.conf

Remove the #

DefaultTimeoutStopSec=1s

Reload daemon after changing system.conf

  • sudo systemctl daemon-reload

Get Windows in Grub

  • sudo vim /etc/default/grub

Freezes and Improvements Workaround

AMD Users

  • sudo pacman -S amd-ucode earlyoom

Intel Users

  • sudo pacman -S intel-ucode earlyoom

Add to Startup Command

  • earlyoom -m 5,5

Update Grub to run amd-ucode

  • sudo update-grub
  • reboot

CPU Improvements not Recomended

  • linux-cachyos-bore auracle

  • Only for terminal uses

  • ananicy-git auracle

  • systemctl enable ananicy.service

  • cfs-zen-tweaks auracle

  • systemctl enable set-cfs-tweaks.service

Finish

  • Have Fun