Skip to content

Instantly share code, notes, and snippets.

@xpando
Last active April 23, 2024 15:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpando/2f558beaaf92a4e23f9baf573b873c77 to your computer and use it in GitHub Desktop.
Save xpando/2f558beaaf92a4e23f9baf573b873c77 to your computer and use it in GitHub Desktop.
My notes on installing and configuring Arch Linux.

Arch Linux

Download

Download an ISO installation image from one of the mirrors.

e.g. West coast: mirrors.ocf.berkeley.edu

Create a bootable flash drive.

If you are installing a virtual machine you can skip this section. For physcial hardware you will need to copy the Arch installation ISO to a bootable flash drive.

Windows

To create bootable flash drives from the downloaded ISO image in Windows you will need a tool such as Etcher or Rufus. Either one can easily be installed using the Chocolatey package manager:

# Install Etcher
choco install Etcher

# Or install Rufus
choco install Rufus
Mac OS X

Etcher also works on OS X and can be installed using Homebrew:

brew cask install Etcher
Linux

TODO: include dd commands to create the bootable flash drive.

Partition the target installation disk.

After booting the flash drive on your target installation system you will need to partition the installation disk before installing the Arch system to it.

If you are installing on a HIDPI system you may need to increase the font size in the console. The following will install a larger font and enable it for the current session:

pacman -Sy
pacman -S terminus-font
setfont ter-v32n

showconsolefont

Optimize pacman mirror list

pacman -S reflector
reflector --verbose -l 10 -f 5 -c US -p https --save /etc/pacman.d/mirrorlist

First, find the drive you want to install to using the lsblk command. If you are installing in a virtual machine or on a laptop with a single hard drive this will likely be /dev/sda

E.g.

> lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   64G  0 disk
|-sda1   8:1    0  512M  0 part /boot
|-sda2   8:3    0   32G  0 part /
`-sda3   8:4    0 19.8G  0 part /home

Once you have determined the disk you want to install Arch to you can partition the disk using the fdisk command:

fdisk /dev/sda

Create 4 partitions to isolate specific functional areas of your Arch system. These patitions are boot, root and home

Boot Partition

This partition will contain things like the Linux kernel image and boot menu configuration etc. Only about 200MB of space will be required for this partition. To create this partition use the following steps from within the fdisk utility:

  1. Type o and press <Enter> to create a DOS style partition table. This will clear any existing partitions and make the disk ready for you to create the new partitioning scheme.
  2. Type n to create a new partition.
  3. Press <Enter> to accept the default p primary partition type.
  4. Press <Enter> again to accept the defaul first sector of 2048.
  5. Enter +200M for the last sector.
Root Partition
  1. Type n to create a new partition.
  2. Press <Enter> to accept the default p primary partition type.
  3. Press <Enter> again to accept the default.
  4. Enter +32G for the last sector.
Home Partition
  1. Type n to create a new partition.
  2. Press <Enter> to accept the default p primary partition type.
  3. Press <Enter> again to accept the default.
  4. Press <Enter> again to use the rest of the space fore the home partition.

Create filesystems.

mkfs.ext4 /dev/sda1 -L boot
mkfs.ext4 /dev/sda2 -L root
mkfs.ext4 /dev/sda3 -L home

Mount filesystems.

# Mount the root partition
mount /dev/sda2 /mnt
# Create mount points for boot and home directories
mkdir /mnt/boot
mkdir /mnt/home
# Mount the boot and home partitions
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/home

Bootstrap the installation.

pacstrap /mnt base base-devel linux linux-firmware intel-ucode grub networkmanager bind-tools sudo openssh gnupg zsh vim neovim git htop curl fd fasd fzf ripgrep exa bat reflector neofetch

Configure the system

First, create the fstab configuration file using the mounted filesystem structure on /mnt

genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
Configure the GRUB bootloader
# Install the GRUB bootloader
grub-install --target=i386-pc /dev/sda

# Generate the GRUB boot configuration
# NOTE: This is templatized from /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg

Or configure the systemd-boot loader if using EFI

Install the boot loader:

bootctl install --path=/boot

Configure the boot menu:

esp/loader/loader.conf

default  arch
timeout  4

esp/loader/entries/arch.conf

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=PARTUUID={uuid from blkid} rw

blkid -s PARTUUID -o value /dev/sdxY

Configure the clock.
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
Configure locale

Uncomment the en_US locales in /etc/locale.gen and run locale-gen

vim /etc/locale.gen
locale-gen

Set the LANG variable in locale.conf

Example locale.conf:

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

Configure Network

# Add the hostname to /etc/hostname
echo "hostname" > /etc/hostname

Configure localhost names

vim /etc/hosts

Add the following:

127.0.0.1   localhost
::1         localhost
127.0.0.1   myhostname.local myhostname

Enable NetworkManager service to configure the network at startup.

systemctl enable NetworkManager

Set the root password

passwd

Create user

useradd -mg users -G wheel -s /usr/bin/zsh david
passwd david

Enable sudo

Enable sudo for members of the wheel group using visudo.

Post Install

AUR

Install yay

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Install dotfiles

yay -S yadm starship-bin antibody-bin
yadm clone https://github.com/xpando/dotfiles

Install VirtualBox Guest Services

If instsalling in a VirtualBox VM:

yay -S virtualbox-guest-utils
sudo systemctl enable vboxservice
sudo systemctl start vboxservice

Audio Setup

yay -S alsa-utils pulseaudio-alsa pulsemixer

# Test the audio setup
alsamixer
pulsemixer
speaker-test -c 2

GUI

#!/bin/bash
pkgs=(
    # Base
    xorg-server
    xorg-xinit
    xorg-apps
    mesa
    xf86-video-vesa

    # Intel drivers
    Xf86-video-intel

    # Nvidia drivers
    nvidia
    nvidia-settings

    # VirtualBox drivers
    virtualbox-guest-modules-arch
    virtualbox-guest-utils

    # Fonts
    pango
    noto-fonts            # Base system fonts
    nerd-fonts-iosevka    # Monospaced terminal/programming font with ligatures
    otf-font-awesome      # Icons

    # Terminal
    alacritty

    # WM
    i3           # Tiling window manager
    i3blocks-git # Latest features for status bar
    rofi         # Launcher
    compton      # Compositer
    nitrogen     # Desktop background

    # Apps
    google-chrome  # Web browser
    qutebrowser    # Keyboard focused browser (uses chromium render engine)
    ranger         # Terminal based file browser

)
yay -S ${pkgs[@]}

# Enable VirtualBox guest additions
sudo systemctl enable vboxservice
sudo systemctl start vboxservice

Java Development

Install JDKs and tools like gradle and sbt with SDKMAN

DotNet Development

yay -S dotnet-sdk

Tweaks

Better tty fonts

Edit /etc/vconsole.conf

yay -S powerline-fonts-git
sudo vim /etc/vconsole.conf

KEYMAP=us
FONT=ter-powerline-v20n

Enable SSH

sudo systemctl enable sshd
sudo systemctl start sshd

Colored output

My TTY color theme:

sudo curl https://gist.githubusercontent.com/xpando/5c9ad198c917542a67b06991b24a59c2/raw/5870ca11ecfd1b8c0cd1ebfb1ad66218e5803f21/issue > /etc/issue

This installs a systemd unit that sets the tty to dark solarized theme:

https://github.com/adeverteuil/console-solarized

yay -S console-solarized-git

https://wiki.archlinux.org/index.php/Color_output_in_console

VirtualBox Guest

High resolution vconsole

sudo vim /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet nomodeset"
GRUB_GFXMODE=1600x1200x32
GRUB_GFXPAYLOAD_LINUX=keep

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

Refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment