TTY prepare works

Get current IP address

ip a

Change root password

passwd root

Change sshd config

vim /etc/ssh/sshd_config

Restart ssh service

systemctl restart sshd

SSH to archlinux live iso

ssh root@192.168.123.100

Bootstrap System

Disable reflector service

sudo systemctl stop reflector.service

Configure mirrors

vim /etc/pacman.conf
-----
[options]
Color
ParallelDownload = 5
[multilib]
Include = /etc/pacman.d/mirrorlist
 
# Add CN source
[archlinuxcn]
Server = https://mirrors.bfsu.edu.cn/archlinuxcn/$arch
-----
vim /etc/pacman.d/mirrorlist
-----
Server = https://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
-----

Partitions

Format drive (Dangrous)

wipefs --all /dev/nvme0n1

With gdisk

# list paritions
lsblk
 
# create patitions
gdisk /dev/nvme0n1
# create efi partition
# n
# size: +1G
# hexcode or guid: ef00
# create btfs partition
# n
# size: <enter>
# hexcode or guide: <enter>
# write partitions
# w
# confir,: Y
 
# verify new partitions
lsblk
 
# format paritions
mkfs.fat -F32 /dev/nvme0n1p1

Format paritions

mkfs.btrfs /dev/nvme0n1p2
mkfs.fat -F32 /dev/nvme0n1p1

Create sub-volumes

mount /dev/nvme0n1p2 /mnt
cd /mnt
btrfs subvolume create @
btrfs subvolume create @home
cd
umount /mnt
mount -o noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=@ /dev/nvme0n1p2 /mnt
mkdir /mnt/{boot,home}
mount -o noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=@home /dev/nvme0n1p2 /mnt/home/
mount /dev/nvme0n1p1 /mnt/boot

System install

Install base system

# install base packages
pacstrap /mnt sudo base linux linux-firmware linux-headers
pacstrap /mnt git vim amd-ucode gvfs btrfs-progs
pacstrap /mnt networkmanager openssh usbutils terminus-font os-prober neovim make gcc
# generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
 
vim /etc/mkinitcpio.conf
-----
...
MODULES=(btrfs)
...
-----
mkinitcpio -p linux

Set timezone

sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo timedatectl set-ntp true
sudo hwclock --systohc

Set locale

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

Set hostname

echo "archlinux" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1       localhost" >> /etc/hosts
echo "127.0.0.1 archlinux.localdomain archlinux" >> /etc/hosts

Create default user

useradd -m -g users -G wheel -s /bin/bash suling
passwd suling
echo 'suling ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/suling
chmod 440 /etc/sudoers.d/suling

Enable default services

sudo systemctl enable NetworkManager
sudo systemctl enable sshd
sudo systemctl enable cronie.service

Install boot manager

Install packages

pacman -S grub efibootmgr os-prober
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH

Config files

vim /etc/default/grub
-----
...
GRUB_DEFAULT=0
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet nowatchdog"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false
...
-----

Generate grub config

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

Configure source

vim /etc/pacman.conf
-----
...
[options]
Color
ParallelDownload = 5
[multilib]
Include = /etc/pacman.d/mirrorlist
# Add CN source
[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
...
-----
 
vim /etc/pacman.d/mirrorlist
-----
Server = https://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
...
-----
 
sudo pacman -Syu
sudo pacman -Sy pacman-contrib archlinuxcn-keyring
sudo pacman-key --lsign farseerfc@archlinux.org

Unmount partition

exit
umount -R /mnt
reboot

Post installation

Paru configs

vim /etc/paru.conf
 
-----
...
BottomUp
SkipReview
-----

Makepkg configs

vim /etc/makepkg.conf
-----
...
MAKEFLAGS="-j8"
...
-----

Install KDE-Plasma

sudo pacman -S plasma-meta konsole dolphin yakuake okular gwenview spectacle kdeconnect sshfs ark tela-icon-theme-git
sudo systemctl enable sddm
sudo systemctl start sddm

Install nesserary packages

sudo pacman -S vim xdg-utils xdg-user-dirs openssh cronie base-devel gcc make cmake paru
sudo pacman -S xorg xorg-xkill xorg-xset xorg-xinput xorg-xsetroot xorg-xset xclip
sudo systemctl enable sshd --now
sudo systemctl enable cronie --now

Network

sudo pacman -S net-tools iputils inetutils dnsutils wpa_supplicant bridge-utils lsof
sudo systemctl enable NetworkManager --now

Bluetooth

# Load the `btusb` kernel module
sudo modprobe btusb
lsmod | grep btusb
 
# auto load module at boot
echo "btusb" | sudo tee /etc/modules-load.d/bluetooth.conf
sudo pacman -S bluez bluez-utils blueman blueberry
sudo systemctl enable bluetooth --now
 
# Load kernel modules at boot
sudo modprobe i2c-dev bluetooth
echo "i2c-dev btusb" | sudo tee /etc/modules-load.d/peripherals.conf

Install fonts

sudo pacman -S adobe-source-han-serif-cn-fonts wqy-zenhei adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts noto-fonts-cjk ttf-iosevka-nerd
fc-cache -vf

AMD GPU

# Install AMDGPU driver packages
sudo pacman -S xf86-video-amdgpu vulkan-radeon libva-mesa-driver mesa-vdpau
# Set kernel module parameters
sudo vim /etc/modprobe.d/amdgpu.conf
-----
options amdgpu si_support=1
options amdgpu cik_support=1
-----
 
sudo vim /etc/modprobe.d/radeon.conf
-----
options radeon si_support=0
options radeon cik_support=0
-----
# Load GPU module in mkinitcpio
sudo vim /etc/mkinitcpio.conf
-----
MODULES=(amdgpu radeon btrfs)
-----
sudo mkinitcpio -p linux
# Configure Xorg server
sudo vim /etc/X11/xorg.conf.d/20-amdgpu.conf
-----
Section "OutputClass"
    Identifier "AMD"
    MatchDriver "amdgpu"
    Driver "amdgpu"
EndSection
-----
# Reboot
reboot

Useful packages

# Fcitx5
sudo pacman -Sy fcitx5-im fcitx5-chinese-addons fcitx5-rime rime-ice
 
# System utils
paru -Sy wget curl tmux zsh git unzip fish tree nano htop zip p7zip jq htop neofetch nvtop npm smbclient
 
# User utils
paru -Sy aria2-fast xdotool ffmpeg q-dns nali-go-bin eza bat proxmox-backup-client timeshift-autosnap timeshift-autosnap cifs-utils debtap n-m3u8dl-re-bin nali-go-bin proxmox-backup-client v2raya yt-dlp
 
# Desktop applications
## Base
paru -Sy barrier gparted visual-studio-code-bin google-chrome obsidian tela-icon-theme-git kwalletmanager filezilla qbittorrent typora-free-bin libreoffice-fresh-zh-cn libreoffice-fresh mouse-actions-gui-bin realvnc-vnc-viewer
 
## Communication
paru -Sy telegram-desktop linuxqq-nt-bwrap wechat-universal-bwrap
 
## Video/Audio/Images
paru -Sy splayer-bin vlc upscayl-bin losslesscut-bin