WretchedGhost's Arch Install Guide

WretchedGhost's Arch Install Guide
Page content

Editor’s Note Here is a guide of my super simple install of Arch Linux using a fork of Classy Girraffe’s that users LUKS, ext4, GRUB2, swapfile, and tmpfs. It can be found here. I also have my personal dotfiles that you can check out here.

This guide does not hold your hand so you will either need to research a few things you do not know or you must already know what commands and flags are needed when presented.

Step 0. If WiFi is needed.

iwctl
station wlan0 scan
station wlan0 connect <your-SSID>
(Enter password)

Step 1. Set the date and time.

timedatectl set-ntp true

Step 2. If you need to set a bigger font in the tty.

This is usually only needed if you are needing larger font when using a HiDPI screen.

setfont ter-132b

Step 3. Partition the disks.

Only 500MB or bigger is needed for boot partition/EFI but 512MB gives a little buffer.

gdisk /dev/nvme0n1
    +512M ef00
    100% 8300

Step 4. Create the encrypted root partion on your device.

I like to call my root LUKS partition cryptroot but you can call it anything you like.

cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup luksOpen /dev/nvme0n1p2 cryptroot

Step 5. Build the filesystems.

Make sure to use the -F32 flag which set the fats to the 32 flag as this will default to 16 if you don’t. For the ext4 partition you will notice that it is no longer under /dev/nvme0n1p2 but rather /dev/mapper due to the way Linux organizes the LUKS filesystems. Plus its easier to type /dev/mapper/cryptroot than /dev/nvmen1p2xxxx.

mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/mapper/cryptroot

Step 6. Mount root and boot.

mount /dev/mapper/cryptroot /mnt
mkdir -p /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

Step 7. Setup the Swapfile.

I prefer a swapfile due to the ability to quickly shrink and grow the partition as needed when more or less RAM is installed. Creating a swapfile is usually not the way to get hibernation working if you need it, but rather setting up a dedicated swap partition would be best if you are needing hibernation.

24576 = 24G
or
32768 = 32G
dd if=/dev/zero of=/mnt/.swapfile bs=1M count=24576 status=progress
chmod 600 /mnt/.swapfile
mkswap /mnt/.swapfile
swapon /mnt/.swapfile

Step 8. Install the base files and generate the fstab. Also build the tmpfs.

Here we will be manually adding a tmpfs in /etc/fstab which again allows us to dynamically change it if needed. We will be setting it to 8GB.

pacstrap /mnt base base-devel linux linux-firmware vim git screenfetch networkmanager grub efibootmgr intel-ucode bash-completion

Swap out linux-lts/linux-lts-headers, linux-zen/linux-zen-headers, linux-hardended/linux-hardended-headers for linux/linux-headers if you want to use a different kernel than vanilla.

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

vim /mnt/etc/fstab
...
tmpfs /tmp tmpfs rw,nodev,nosuid,size=8G,noatime,mode=1700 0 0
...

(Also change all relatime to noatime EXCEPT for /boot if you are using a SSD. For NVMe or HDD do NOT change them to noatime)

Step 9. Chroot into the new system drive.

arch-chroot /mnt /bin/bash

Step 10. Setup the time and make it persistent.

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc
vim /etc/locale.gen 

(uncomment en_US.UTF-8)

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

Step 11. Setup hostname and hosts files.

echo <hostname> > /etc/hostname
vim /etc/hosts

127.0.0.1	localhost
127.0.1.1	box.wretchednet.in box	

Step 12. Create the root password.

passwd

Step 13. Edit the kernel hooks and tweak pacman.conf

Add keyboard between autodetect and modconf and encrypt between block and filesystem in the HOOKS array.

vim /etc/mkinitcpio.conf
...
HOOKS=(base udev autodetect keyboard modconf block encrypt filesystems fsck)
...

You can remove the fsck if you don’t like the filesystem to check itself after every reboot. This can sometimes like up to 10 minutes.

Step 14. Update the kernel modules.

mkinitcpio -p linux 

For Linux kernel. Use Linux-lts for LTS kernel, Linux-hardened, and or Linux-zen

vim /etc/pacman.conf

Uncomment Color and add ILoveCandy. Uncomment [multilib] and the line underneath.

Step 15. Build and tweak GRUB

We need to add the UUID of the cryptroot partition to the /etc/default/grub config file. We begin by running blkid -s UUID -o value /dev/nvme0n1p2 » /etc/default/grub which will add the UUID of the cryptroot to the bottom the /etc/default/grub page. From within the /etc/default/grub we can move the UUID to the GRUB_CMDLINE_LINUX= line just like below. Replace XXXX-XXXX-XXXX for your UUID.

vim /etc/default/grub
GRUB_CMDLINE_LINUX="cryptdevice=UUID=XXXX-XXXX-XXXX:cryptroot" 

and uncomment
#GRUB_ENABLE_CRYPTODISK=y
to
GRUB_ENABLE_CRYPTODISK=y

Step 16. Next we want to install and build GRUB.

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCHLINUX
grub-mkconfig -o /boot/grub/grub.cfg

Step 17. Make sure WiFi and or DHCP will work after reboot.

systemctl enable NetworkManager

Step 18. Exit out of the ‘chroot’ed system and reboot

exit 
reboot

You should now have a working Arch system albeit with no additional users nor GUI, but with a great base to then start building a clean and simple workstation.

Extras

Essentials needed for GUI using X11

$ sudo pacman -S xorg-xinit xorg-server xorg-xauth

Below are the packages I need to have a computer running the way I use it via i3-gaps and whatnot.

  • openssh (Allows for secure shell to and from other servers/computers)
  • curl (CLI web fetcher)
  • wget (CLI web fetcher, older but usually built in to most systems)
  • neofetch (Cooler hardware viewer)
  • vim (if not already installed earlier)
  • vi (Text editor. Needed since root’s default editor is vi and not vim unfortunately)
  • rsync (Archiver that can backup files and directories)
  • bash-completion (bash Auto-completion with Tab)
  • git (Pull git configs)
  • zip (For zipping files)
  • unzip (For unzipping .zip files)

GUI programs

i3

  • i3-wm (The gaps make i3 cooler and extends certain capabilities not found in i3 vanilla)
    • i3blocks (IMO the best status bar for i3)
    • ttf-font-awesome (Cool font symbols)
    • ttf-dejavu (Font)
    • ttf-monoid (Font)
    • feh (My prefered wallpaper program + image viewer)
    • urxvt-perls (Great terminal emulator) (requires ~/.Xresources setup to look good)
    • picom (Window transparency. Updated fork of compton)
    • dunst (Desktop notification)
    • rofi (Nice menuing for programs)
    • gsimplecal (Simple calendar)
    • networkmanager-openvpn (Needed for OpenVPN via the applet)
    • conky (On-screen hardware display. Think HUD)
    • network-manager-applet (GUI icon on i3blocks for Network-Manager)
    • xfce4-clipman (Good clipboard manager)
    • arandr (Multi monitor configuerer, and profile saver and loader)
    • volumeicon (Volume icon on i3blocks bar)
    • lxapperance (For tweaking icon and window themes)
    • i3lock (Integrated lock for i3)
    • xautolock (Detects the lockout timer and runs i3lock via script)
    • scrot (Takes screenshots from the command line)
    • imagemagick (Converts the screenshot)
  • firefox (browser)
  • midori (Lightweight browser that allows for https login on old tls 1.1 or older)
  • qutebrowser (Vim-like browser)
  • pcmanfm (Basic file manager)
  • thunar (File manager, with bulk rename)
    • gvfs (USB Drive support)
    • gvfs-smb (SMB support)
    • gvfs-mtp (Android support)
  • wine (Runs Windows programs)
  • thunderbird (Great email client)
  • pipewire (systemd sound controller)
    • pipewire-alsa (For sound)
    • pipewire-pulse (for bluetooth support and other)
  • pavucontrol
  • newsboat (a terminal RSS client)
  • fzf (fuzzy finder tool)
  • bat (highlights code output, etc. Better than cat)

Extras

  • android-tools (For installing GrapheneOS on phones from Linux)
  • cups (Printing)
  • cifs-utils (used for mounting SMB or samba via mount or /etc/fstab)
  • ntfs-3g (allows to mount NTFS file system partitions)
  • nfs-utils (Enables NFS client on the local machine)
  • deluge (Torrenting)
  • libreoffice-still (Stable version of Libreoffice)
  • manuskript (Cohesive book/manuscript writing program)
  • pavucontrol (GUI for sound management)
  • obsidian (GUI for editing files and plotting points)

Desktop Manager - lightdm

  • lightdm (Nice looking login screen, teamviewer requires a DM. I prefer lightdm to gdm (gnome DM) or others)
    • lightdm-slick-greeter (nicer look to default lightdm. Only install lightdm or lightdm-slick-greeter, not both)

yay (Go-Lang built AUR (Arch User Repo))

Installation

If you are migrating from another AUR helper, you can simply install Yay with that helper.
Source

The initial installation of Yay can be done by cloning the PKGBUILD and building with makepkg:

Before you begin, make sure you have the base-devel package group installed.

# pacman -S --needed git base-devel
# git clone https://aur.archlinux.org/yay.git
# cd yay
# makepkg -si
  • urxvt-resize-font-git (Allows to resize font using urxvt)
  • signal-browser-beta-bin (The secure messaging app in desktop form. Beta and binary format)
  • caffeine-ng (Keeps screen from turning off when enabled)
  • blueberry (Bluetooth GUI manager)
  • firefox-profile-service (Setup profiles in firefox with firefox profile add-in extension)
  • spotify (For music and podcasts)
  • teamviewer or teamviewer-beta
  • downgrade (For downgrading programs on Arch)

Optional and or for Laptops

Themes

To stick with my purple color schema I use the following below

  • AUR vimix-gtk-themes (I use the vimix-dark-amethyst Widget Style in lxappearance)
  • vimix-icon-theme (I use the vimix-Amethyst dark Icon Theme)
  • vimix-cursor (vimix-amethyst) (For the Mouse cursor)

For OpenVPN+Tailscale (Remote network) * openvpn * tailscale (Point-to-point tunneling that uses Wire-Guard)

For Remmina (Remote desktop)

  • remmina
    • freerdp
    • xrdp (I believe this is needed for vnc)

For Time Sync

  • systemctl enable systemd-timesyncd.service –now

For SSDs only but NOT for NVMes

  • systemctl enable fstrim.time –now

For laptops (workstations can benefit from redshift though)

  • redshift (shifts bluelight and brightness. Useful on desktop as well)
  • power-profiles-daemon (Power control program which is needed for rofi to manipulate power settings)
  • powertop (shows current status of batteries/power)
  • brightnessctl (controls the brightness of the screen)
  • iw (not installed by default in some Arch builds. CLI for controling WiFi)
  • xorg-xbacklight (enables changing screen brightness levels)
  • Enable Natural Scrolling on touchpad. Add “Option ‘NaturalScrolling’ ‘True’”
$ sudo vim /usr/share/X11/xorg.conf.d/40-libinput.conf
...
Section "InputClass"
    Identifier "libinput touchpad catchall"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "NaturalScrolling" "True"
EndSection

Reduce the swappiness

  • echo ‘vm.swappiness=10’ | sudo tee /etc/sysctl.d/99-swappiness.conf

For Steam (Gaming)

  • (enable multilib in /etc/pacman.conf)
  • steam-native-runtime (will run through the desired libraries and packages, ie Nvidia, Intel, or AMD)
    • If you didn’t install steam use these below if you have a modern-ish nvidia card
    • nvidia-dkms (required for linux-zen)
    • nvidia or amdvlk (instead of amdvlk, mesa works fine for me)

For Ripping DVDs

  • makemkv (aur)(for setting the kernel to see the optical drive)
# echo sg >> /etc/modules-load.d/sg.conf
$ sudo modprobe sg