Skip to content

Instantly share code, notes, and snippets.

@x-zvf
Last active November 4, 2022 20:44
Show Gist options
  • Save x-zvf/b87c7976cea890559df2c8585cc19b36 to your computer and use it in GitHub Desktop.
Save x-zvf/b87c7976cea890559df2c8585cc19b36 to your computer and use it in GitHub Desktop.
Arch install instructions

Arch installation and setup

This gist contains every step I took to install my fully functional rice. Arch linux will be installed on luks encrypted lvm.

0. Preparation

I assume you already have a bootable arch usb and are booted from it. If not, download an arch iso and copy it on to a usb stick with dd (or something like bootiso if you don't trust yourself with dd. (But in that case I do not reccomend installing arch anyway.))

1. system installation

Prestart

  1. first check if we are booted into efi mode ls /sys/firmware/efi # Check if uefi if that directory is not empty we are. If it is, then please boot into efi mode.

  2. before we continue, disable the console beep with setterm -blenght 0 to keep your sanity and set your keyboard layout to something you are comfortable with with loadkeys, eg. loadkeys uk for the British layout or loadkeys de-latin1 for the German layout

Partitioning.

  1. Check which disk you want to install arch on, typically it's going to be something like /dev/sda, which this guide will assume you are installing on. If not, substitute /dev/sdaX with the appropriate drive. If you are not sure what the drive you are installing on is called, lsblk may help you.

  2. Create the partitions. run cgdisk /dev/sda

  • Delete all existing partitions, create GPT if necessary

  • Create new partitions

New-> default -> 512M-> ef00 -> bootefi
New-> default -> 100%->8e00-> partarch
Verify
Write
Quit
  • Make efi system fs mkfs.fat -F32 /dev/sda1

  • setup rootfs

cryptsetup -y -v luksFormat /dev/sda2

cryptsetup open --type luks /dev/sda2 pvarch
pvcreate /dev/mapper/pvarch
vgcreate vgarch /dev/mapper/pvarch

lvcreate -L16G vgarch -n swap
lvcreate -l 100%FREE vgarch -n rootfs

mkfs.ext4 /dev/mapper/vgarch-rootfs
mkswap /dev/mapper/vgarch-swap
swapon /dev/mapper/vgarch-swap
  • Check swap space with free -m
  1. Mount partitions
mount /dev/mapper/vgarch-rootfs /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
  1. Update live boot image if necessary pacman -Syy archlinux-keyring reflector

  2. Select a fast mirror. Subsititute your country. reflector -c "Germany" -f 10 -l 10 --verbose --save /etc/pacman.d/mirrorlist

  3. Install basic packages pacstrap /mnt base base-devel vim networkmanager neovim git zsh pbzip2 pigz lrzip lzop

  4. Make FS genfstab -U /mnt > /mnt/etc/fstab

  • specify external drives on boot with /etc/crypttab, like: pvdata UUID=2f9a8428-ac69-478a-88a2-4aa458565431 none luks,timeout=120
  1. chroot into install arch-chroot /mnt

  2. Set time and locales

rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Budapest /etc/localtime
hwclock --systohc --utc

vim /etc/locale.gen # Uncomment the locales you want. en_US should be uncommented
locale-gen
locale > /etc/locale.conf
  1. Set root and user passwords
passwd
useradd -m -s /bin/zsh -r -G wheel xzvf
EDITOR=vim visudo # enable group wheel or user
passwd xzvf
  1. Set the default tty layout to the one you prefer echo 'KEYMAP=uk' > /etc/vconsole.conf

  2. GET RID OF THE FUCKING BLEEPS! echo 'blacklist pcspkr' > /etc/modprobe.d/nobeep.conf

  3. Hostname and hosts

echo "beryllium" > /etc/hostname
vim /etc/hosts
  • Example hosts file:
127.0.0.1 localhost
127.0.0.1 lithium.periodic.table lithium

::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
  1. Apply some useful settings
vim /etc/makepkg.conf
PKGEXT='.pgk.tar' to remove unnecessary compression
MAKEFLAGS="-j$(nproc)"
COMPRESSGZ=(pigz -c -f -n)
COMPRESSBZ2=(pbzip2 -c -f)
COMPRESSXZ=(xz -c -z - --threads=0)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)

vim /etc/pacman.conf # ILoveCandy \n Color
  1. Install and configure bootloader
vim /etc/mkinitcpio.conf # 

replace the HOOKS with precisely: HOOKS=(base udev autodetect modconf block keyboard encrypt lvm2 filesystems fsck)

mkinitcpio -p linux
bootctl --path=/boot/ install
echo 'timeout 3'>> /boot/loader/loader.conf
  • vim /boot/loader/entries/arch.conf Example config:
title Arch
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=ee33c343-9873-4726-9b82-6b813780c104:lvarch root=/dev/mapper/vgarch-lvarch quiet rw

Tip: use :read ! blkid /dev/sda2 to get uuid

  1. Reboot to the install
exit
umount -R /mnt
reboot

post install (logged in as non priviledged user)

  1. Network
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager
  1. Install yay
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ~
rm /tmp/yay -rf
yay -S yay # Just to have it in yay's cache for future updates
  1. Install useful programs
yay -S openssh i3-gaps-next-git stow feh compton-tryone-git nvidia nvidia-utils \
  cronie polybar alsa-utils pulseaudio firefox-developer-edition chromium code \
  python-pip lxappearance vlc nodejs npm rofi dmenu tmux htop gotop iftop w3m ranger \
  emacs nerd-fonts-complete mutt-wizard materia-theme stow xorg-apps xorg-xinit \
  thefuck neomutt sox i3lock-color-git imagemagick autorandr arandr \
  pass browserpass browserpass-firefox browserpass-chrome bat powerline \
  pandoc texlive-most texlive-lang biber
  1. Activate nvidia driver (reboot may be necessary) sudo nvidia-modprobe

  2. vim /etc/ssh/sshd_config

Set: PermitRootLogin no

  1. Start services
sudo systemctl enable sshd
sudo systemctl start sshd

sudo systemctl enable cronie
sudo systemctl start cronie
  1. Make ssh key ssh-keygen
  2. Copy gpg keys from other pc
  • On other pc
ssh-copy-id user@ip
scp user@ip:/home/user/.ssh/id_rsa.pub /some/place # To add to github
gpg --export-secret-keys > keyfile
gpg --export-ownertrust > trustfile # copy these two to the other pc
  • On current install
gpg --import keyfile
gpg --import-ownertrust trustfile
  1. Install some python modules sudo pip install i3ipc fontawesome
  2. install oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  3. powerlevel9k git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
  4. doom emacs
git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.emacs.d/bin/doom install
  1. Install my st build
mkdir inst
cd inst
git clone git@github.com/x-zvf/st
cd st/src
sudo make install
  1. Install rofi theme
cd ../..
git clone https://github.com/0xdec/base16-rofi.git
cd ~
  1. Clone dotfiles
git clone git@github.com:x-zvf/dotfiles.git
rm .bash* .zshrc
cd dotfiles
stow .
  1. Add zsh plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# vim plug
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim # run :PlugInstall
  1. log out and back in
  2. Finally
  • Init pass
  • set up email
  • log in to browsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment