notes/IT/Installing Arch.md
2023-08-26 11:33:11 -06:00

4.0 KiB

#linux #documentation

See offical documentation here.

Preperation

Prerequisites Check if system is in UEFI mode with: ls /sys/firmware/efi/efivars If it lists the directory without issue then it's in EFI mode, if no directory exists is returned than EFI is disabled.

Partitioning Disks List disks with: fdisk -l Select disk to modify with: fdisk /dev/sdx (where x is the selected disk) In the fdisk environment, use:

  • n to create a new partition
  • p or e to select primary or extended, primary is fine for all partitions on this install.
  • +[size][scale] EG: +512M or +1g create a partition of that size.
  • w to write changes to the disk.

Arch requires:

  • 1 EFi system partition of at least 300MiB mounted to /mnt/boot (Only for UEFI systems)
  • 1 root partition using all leftover space mounted at /mnt
  • Optionally a swap partition more than 512MiB, but ideally equal to the total ram.(Note: the swap partition is not mounted, but is instead initialized with mkswap /dev/swap_partition)

Formatting Partitions

  • Format the root partition as ext4
mkfs.ext4 /dev/root_partition
  • Format the EFI system partition as Fat32
mkfs.fat -F 32 /dev/efi_system_partition
  • Initialize the swap partition
swapon /dev/_swap_partition_

Mounting Partitions Mount these partitions with mount /dev/sdxI /mounting_location, for this purpose /mnt. You will need to:

  • Mount root partition(/)
mount /dev/[root_partition] /mnt
  • Mount EFI System Partiton (boot may need to be made with mkdir)
mount /dev/[efi_system_partition] /mnt/boot
  • If a swap partition was made, initialize it with:
swapon /dev/[swap_partition]

Update Mirrors Use reflector to update mirrors to the optimal servers.

Installation

Use pacstrap to install necessary packages into /mnt

pacstrap /mnt base linux linux-firmware dhcpcd nano

Note: if you wish to configure a static IP you can remove dhcpcdfrom the package list and use ip address add [IP]/[subnet] broadcast + dev [interface], where subnet is usually /24 and the interface can be found with ip link. You will need to add a route, which can be done with ip route add default via [gateway address]. Configuring the system Generate an fstab file(shows how partitions should translate into disk space)

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

Chroot into the new system with arch-chroot

arch-chroot /mnt

Optionally set time zone(See installation wiki)

Edit /etc/locale.gen to set locales. For English uncomment en_US.UTF-8 UTF-8. If needed, generate locales with locale-gen.

Start and enable internet

systemctl start dhcpcd
systemctl enable dhcpcd

User Account Management Set a root password with passwd. Install sudo

pacman -S sudo

Add a user

useradd -m [user]

Give the user a password:

passwd [user]

Add the user to the sudoers group(you will need to uncomment a line from /etc/sudoers)

usermod -aG wheel [user]

Reboot, unmount the .iso, and login to the user just created.

Install either amd-ucode or intel-ucode depending on the system processor

sudo pacman -S [needed package]

Beyond the install Install grub andefibootmgr with pacman

pacman -S grub
pacman -S efibootmgr

Create the directory for grub

mkdir /boot/EFI/GRUB

Install grub to the efi partition.

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

Generate the grub config

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

Install xorg-server

sudo pacman -S xorg-server

Install plasma

sudo pacman -S plasma

Install sddm

sudo pacman -S plasma

Start sddm

sudo systemctl start sddm.service

If the desktop works as intended, enable sddm to launch at boot

sudo systemctl enable sddm.service