JucaRei / ArchInstall

My Personal Script for installing arch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arch Basic Install Commands-Script

Remember that the first part of the Arch Linux install is manual, that is you will have to partition, format and mount the disk yourself. Install the base packages and make sure to include git so that you can clone the repository in chroot.

A small summary:

  ip a (see ip address to ssh installsudo)
  • If needed, load your keymap
    • loadkeys br-abnt2
  1. Refresh the servers with pacman -Syy and fix sync time
    • sudo pacman -Syy
    • timedatectl set-ntp true
  • Select best servers for your location
    • reflector -c Brazil -a 6 --sort rate --save /etc/pacman.d/mirrorlist
  1. Partition your disk:
  • cfdisk /dev/sdX (write)
  • gdisk /dev/sdX (write)
    • (boot, swap, linuxFileSystem, etc)
  1. Now, Format the partitions:
    • mkfs.btrfs /dev/sdX  (can be any filesystem you like not only ext4)
    • mkfs.fat -F32 /dev/sdaX  (boot MUST be fat32)
    • mkswap /dev/sdaX - (swap if you already want to make a swap partition)
  2. Activate the swap:
  • swapon /dev/sdaX (swapNumber)
  1. Mount the partitions

    • mount /dev/sdaX /mnt
    • (mount efi windows) mkdir /mnt/boot
    • mount /dev/sdX(efi windows number) /mnt/boot
    • (windows partition acessible on linux) /mnt/windows10
    • mount /dev/sdX /mnt/windows10
  2. Mount Btrfs subvolumes

  • Root subvolume:
    • btrfs su cr /mnt/@
  • Home subvolume:
    • btrfs su cr /mnt/@home
  • Snapshots subvolume:
    • btrfs su cr /mnt/@snapshots
  • Var_log subvolume:
    • btrfs su cr /mnt/@var_log
  1. Umount to fix their own respective directories:

    • umount /mnt
    On oldpc use the EFI from default OS (mac) to boot, which is on /dev/sda1 
    mount /dev/sda1 /mnt/boot
  1. Mount the subvolumes:
  choose lzo or zstd for compression  (compress-force=ztsd:5  | compress-force=lzo:4)
  • mount -o noatime,ssd,compress-force=zstd:18,space_cache=v2,commit=120,autodefrag,discard=async,subvol=@ /dev/sdaX /mnt
  • mkdir -p /mnt/{boot/{efi,grub},Windows,home,.snapshots,var/log}
  • mount -o noatime,ssd,compress-force=zstd:18,space_cache=v2,commit=120,autodefrag,discard=async,subvol=@home /dev/sdaX /mnt/home
  • mount -o noatime,ssd,compress-force=zstd:18,space_cache=v2,commit=120,autodefrag,discard=async,subvol=@snapshots /dev/sdaX /mnt/.snapshots
  • mount -o noatime,ssd,compress-force=zstd:18,space_cache=v2,commit=120,autodefrag,discard=async,subvol=@var_log /dev/sdaX /mnt/var/log
    • Dont forget to mount boot and Windows:
      • mount /dev/sdX (boot) /mnt/
      • mount /dev/sdX (Windows) /mnt/Windows
  1. Check if everything is ok:
  • lsblk -f

Now install the base packages for the System

  1. Install the base packages into /mnt

Arch

- (intel-ucode or amd-ucode)
  • pacstrap /mnt base linux-lts linux-lts-headers linux-firmware git nano vim intel-ucode reflector mtools dosfstools btrfs-progs pacman-contrib

Artix

- (intel-ucode or amd-ucode)
  • basestrap /mnt base base-devel linux-lts linux-lts-headers runit elogind-runit linux-firmware git vim intel-ucode mtools dosfstools btrfs-progs

OLDPC

  • pacstrap /mnt base linux linux-headers linux-firmware intel-ucode git vim nano

Generate the FSTAB file with:

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

Artix

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

Enter in the installation directory

  • arch-chroot /mnt

Artix

  • artix-chroot /mnt
    OldMac

    bootctl --path=/boot install
  • cd /boot/
  • cd /loader
  • vim loader.conf
  • change the last string to arch-*
  • cd /entries/
  • make file arch.conf
  • vim arch.conf
  • paste commands with your image:
title   Arch Linux
linux   /vmlinuz-linux-lts
initrd  /intel-ucode.img
initrd  /initramfs-linux-lts.img
options root=/dev/sda3 rootflags=subvol=@ rw
  • Ext4 dont need rootflags
  • b43.allhwsupport=1 mitigations=off nowatchdog nvidia-drm.modeset=1 i915.modeset=1
  1. Download the git repository with git clone
  2. cd arch-basic

Anothers way to create swap file:

- fallocate -l 3GB /swapfile
- chmod 600 /swapfile
- mkswap /swapfile
- swapon /swapfile
  • Using ZRAM (Best)
    • pacman -S zramd
    • edit /etc/default/zramd, uncomment MAX_SIZE, put your desired value
    • MAX_SIZE=3072 (3GB)
    • enable the service: sudo sytemctl enable --now zramd.service
    • check if it's enabled: lsblk

-echo "swapfile none swap defaults 0 0" >> /etc/fstab

Other Configurations after install

  • Add to mkinitcpio.conf

    • MODULES = (btrfs i915 nvidia)
    • ON HOOKS remove fsck and add btrfs grub-btrfs-overlayfs
    • ON BINARIES put "/usr/bin/btrfs"
  • Optimus Manager

    • edit the config file sudo nano /etc/optimus-manager/optimus-manager.conf
    • On [nvidia] change the dynamic_power_management to fine
    • On [optimus] change the startup_mode to hybrid

Other Repos

Chaotic-AUR

Install the primary key, with it install our keyring, and finishing installing our mirrorlist.

pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
pacman-key --lsign-key 3056513887B78AEB
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'

Append (add to the end of the file) /etc/pacman.conf

[chaotic-aur]
Include = /etc/pacman.d/chaotic-mirrorlist

Liquorix

Key-ID: 9AE4078033F8024D

pacman-key --keyserver hkps://keyserver.ubuntu.com --recv-keys 9AE4078033F8024D
pacman-key --lsign-key 9AE4078033F8024D

[liquorix]
Server = https://liquorix.net/archlinux/$repo/$arch

About

My Personal Script for installing arch


Languages

Language:Shell 62.6%Language:C 16.1%Language:Lua 9.3%Language:GLSL 7.2%Language:JavaScript 2.6%Language:Makefile 0.6%Language:Python 0.5%Language:CSS 0.4%Language:Perl 0.4%Language:Roff 0.3%Language:Sass 0.1%Language:Dockerfile 0.0%Language:Xonsh 0.0%Language:Nix 0.0%