Skip to content

Instantly share code, notes, and snippets.

@Felix-Kyun
Last active October 27, 2022 06:37
Show Gist options
  • Save Felix-Kyun/31ec09c0c78c9539b45719f1f2bee314 to your computer and use it in GitHub Desktop.
Save Felix-Kyun/31ec09c0c78c9539b45719f1f2bee314 to your computer and use it in GitHub Desktop.
simple guide to install and setup arch on a bios/mbr machine with btrfs

Install

i've written this on obsidian so the format may be a bit weird on github

Pre Configure

  • set font
setfont ter-124n

all fonts can be found in /usr/share/kbd/consolefonts/

  • check internet
ip a
ping google.com -c 2
  • Update system clock
timedatectl set-ntp true
timedatectl status

Partitioning The Disk

  • Partition the disk appropriatly
lsblk # list partitionss
#im doing to use /dev/sda as my starting point 
cfdisk # use cfdisk to make a single partition spanning whole disk
mkfs.btrfs /dev/sda1 # mount
  • Making subvolumes
DISK LAYOUT

/dev/sda
	|-> @ -> /
	|-> @home  -> /home
	|-> @snapshots -> /.snapshots
	|-> @cache -> /var/cache
	|-> @tmp -> /var/tmp
	|-> @log -> /var/log
	|-> @swap -> /.swap
mount /dev/sda1 /mnt # mount disk
cd /mnt # to make it easier to type
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @snapshots
btrfs subvolume create @swap
btrfs subvolume create @cache
btrfs subvolume create @tmp
btrfs subvolume create @log
cd ~ # important or it will keep the disk busy
umount /mnt
  • Mounting SubVolumes
export M_OPT="noatime,space_cache=v2,compress=zstd,ssd,discard=async"
mount -o ${M_OPT},subvol=@ /dev/sda /mnt
mkdir -p /mnt/{home,var/cache,var/tmp,var/log,.snapshots,.swap}
mount -o ${M_OPT},subvol=@home /dev/sda /mnt/home
mount -o ${M_OPT},subvol=@snapshots /dev/sda /mnt/.snapshots
mount -o ${M_OPT},subvol=@swap /dev/sda /mnt/.swap
mount -o ${M_OPT},subvol=@tmp /dev/sda /mnt/var/tmp
mount -o ${M_OPT},subvol=@cache /dev/sda /mnt/var/cache
mount -o ${M_OPT},subvol=@log /dev/sda /mnt/var/log
  • Enabling Swap On BTRFS Without Additional Partitions
cd /.swap
truncate -s 0 ./swapfile
chattr +C ./swapfile
dd if=/dev/zero of=./swapfile bs=1M count=<FILE-SIZE-IN-MiB> status=progress
chmod 600 ./swapfile
mkswap ./swapfile
swapon ./swapfile

Finallizing Initial Setup

  • install base/essential packages
pacman -Syy
reflector -c India -a 6 --sort rate --save /etc/pacman.d/mirrorlist
pacman -Syyy
pacstrap /mnt base base-devel linux-zen linux-firmware neovim git intel-ucode btrfs-progs bash-completion htop mandb mlocate networkmanager openssh pacman-contrib pkgfile reflector sudo terminus-font
  • Generate Fstab And Chroot Into System
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt

Configure

Timezone

ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
hwclock --systohc

Hostname

echo 'iris' > /etc/hostname

echo > /etc/hosts <<EOF
127.0.0.1 localhost
::1       localhost
127.0.0.1 iris.localdomain iris
EOF

Locale

export locale='en_US.UTF-8' 
sed -i "s/^#\(${locale}\)/\1/" /etc/locale.gen 
echo 'LANG=${locale}' > /etc/locale.conf 

locale-gen
or manually do it with nvim

Set Font And Keymap

echo 'FONT=ter-124n' > /etc/vconsole.conf

#optional
echo 'KEYMAP=colemak' >> /etc/vconsole.conf

Set Editor

echo 'EDITOR=nvim' > /etc/environment 
echo 'VISUAL=nvim' >> /etc/environment

Setting New User

passwd # to change the root passwd 
useradd -m -G wheel felix
passwd felix


sed -i "s/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/" /etc/sudoers

Enable Some Services

systemctl enable NetworkManager
systemctl enable reflector.service

Mkinitcpio

# edit appropriatly
MODULES=(btrfs)

HOOKS=(base udev keyboard autodetect keymap consolefont modconf block btrfs filesystems resume fsck)

after editing /etc/mkinitcpio.conf mkinitcpio -P linux-zen

Installing Grub

pacman -S grub

grub-install --target=i386-pc /dev/sda 
grub-mkconfig -o /boot/grub/grub.cfg

Before Reboot

pacman -S --needed linux-zen-headers network-manager-applet mtools dialog reflector xdg-user-dirs xdg-utils inetutils bluez bluez-utils bash-completion openssh rsync alsa-utils pipewire pipewire-alsa pipewire-pulse pipewire-jack
systemctl enable bluetooth
exit # exit arch-chroot
cd
umount -R /mnt

Reboot

Check For Errors

systemctl --failed
journal -p 3 -xb

Sudo Tweak

echo "felix ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoer_felix

Pacman Tweak

Color
ILoveCandy
VerbosePkgList
ParallelDownloads = 15
sudo pacman -Syu

zswap

yay -S zramd
zramd start
systemctl enable zramd.service

Locate

sudo pacman -S mlocate
sudo updatedb

Trim

sudo systemctl enable fstrim.timer

AUR -> yay

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

TimeShift

yay -S timeshift \
	timeshift-autosnap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment