#!/linuxSucks/Install a vanilla Arch Linux

Nov 19, 2020

Set keyboard layout, the default is US:

ls /usr/share/kbd/keymaps/**/*.map.gz

Verify the boot mode:

ls /sys/firmware/efi/efivars

Or

efivar -l

If the command shows the directory without error, then the system is booted in UEFI mode.

Update the system clock:

date
timedatectl set-ntp true

File Systems and Partitions

Check disk list

lsblk

Do Partitions with:

If there is just one drive

cfdisk

If there are more than one drive

cfdisk /dev/sdb

And do three partitions:

sda1 600M (ufi)
sda2 50GB (root)
sda3 4GB  (swap if needed, can be more)
sda4 180GB (home)

This partitions are for 256 GB ssd.

Formatting

EFI partition

mkfs.fat -F32 /dev/sda1

Make the swap partition

mkswap /dev/sda3

Activating swap

swapon /dev/sda3

Formatting root, home and other partitions

mkfs.ext4 /dev/sda2 -> (root)
mkfs.ext4 /dev/sda4 -> (home)

Mounting Partitions

Root Partition

mount /dev/sda2 /mnt

Home Partition

mkdir /mnt/home
mount /dev/sda4 /mnt/home

UEFI Partition

mkdir /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi

Base installation And Settings

Check the mirror list and chose the mirrors in local zone:

nano /etc/pacman.d/mirrorlist

Install base system:

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

Create fstab:

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

Change to chroot:

arch-chroot /mnt

Switch local time:

ln -sf /usr/share/zoneinfo/RegionCity /etc/localtime

Setup local clock:

hwclock --systohc

Localization, open and uncomment en_US.UTF-8 UTF-8:

vim /etc/locale.gen

Generate the locales:

locale-gen

Create the locale.conf:

vim /etc/locale.conf

And add:

LANG=en_US.UTF-8

Setup Hostname and Hosts

Hostname, add the machine name

vim /etc/hostname

Hosts

vim /etc/hosts

Add:

127.0.0.1	localhost
::1	        localhost
127.0.0.1	Archlinux.localdomain	Archlinux

Install optional software

pacman -S networkmanager
systemctl enable NetworkManager

Setup Passwords and User

Set password for root user:

passwd

Add user (where USER change it for your username):

useradd -m -g users -G audio,video,network,wheel,storage,rfkill -s /bin/bash USER

Add password for the new user:

passwd USER

Visudo, search and uncomment:

EDITOR=vim visudo
%wheel ALL=(ALL) ALL

Install grub

First install:

pacman -S grub efibootmgr

After the installations is finish install grub uefi:

grub-install --target=x86_64-efi --efi-directory=/boot/efi

Then configure grub:

grub-mkconfig -o /boot/grub/grub.cfg

Reboot

Exit the chroot environment:

exit

Unmount all partitions:

umount -R /mnt

At last:

reboot

Home  Linux  Notes  Blog Spot