## Arch Linux Installation Note
### After boot into live environment...
- You may want to adjust console font: e.g. `setfont ter-132b`
the fonts are located in `/usr/share/kbd/consolefonts/`
### Prerequisite
#### Connect to Internet
1. ensure your network interface is enable by running `ip link`
2. Ethernet: no extra step require
Wi-Fi: using `iwctl` to connect to wifi
3. run `ping archlinux.org` to verify the connection
#### Sync System Clock
1. `timedatectl set-ntp true`
`timedatectl set-timezone Region/City`
*The available timezones can be listed using* `list-timezones`
2. run `timedatectl` to check the setting
### Partition the disks
1. run `lsblk` to check the name of your disk
2. using `fdisk` to patition your disk
- hint:
`g` : create new GPT patition table and wipe all data of the partition
`n` : create partitions
`d` : delete a partition
`p` : list current changes on the disk
`t` : chage the partition's type (EFI for boot, swap for swap, etc.)
`w` : write all changes to disk and quit
`q` : quit without save the changes
- You should at least create these partitions
1. EFI (1G)
2. SWAP (>=4G)
3. Linux file system (rest space of your disks)
### Format the partitions
1. formatting root partition with ext4 `mkfs.ext4 /dev/root_partition`
2. formatting swap partition `mkswap /dev/swap_partition`
3. formatting EFI partition with FAT32 `mkfs.fat -F 32 /dev/efi_system_partition`
*You may want to use different file system for root partition see* [file systems](https://wiki.archlinux.org/title/File_systems#Create_a_file_system)
### Mount the file systems
1. mount root partition to /mnt
`mount /dev/root_partition /mnt`
2. create `/mnt/boot` and mount EFI partition to it
`mount --mkdir /dev/efi_system_partition /mnt/boot`
3. enable swap partition using
`swapon /dev/swap_partition`
### Install essential pakages
1. back up mirrorlist
`cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak`
2. sort the mirrorlist using `reflector` command
`reflector --country taiwan --sort rate > /etc/pacman.d/mirrorlist`
*You can using `vim` to uncomment `ParallelDownloads = 5` in `/etc/pacman.conf`*
3. download essential packages to new root
`pacstrap -K /mnt base linux linux-firmware`
- Note
- *You may want to specify several firmware packages you need instead of single* `linux-firmware` *package* (e.g. `linux-firmware-amdgpu`) *see* [Linux firmware](https://wiki.archlinux.org/title/Linux_firmware)
- Other recommand packages to download in this step
`intel-ucode` or `amd-ucode` : CPU microcode
`base-devel`, `linux-headers`, `networkmanager` , `git` , `wget`, `curl`, `vim`
### Configure the system
1. setting fstab file using `genfstab`
`genfstab -U /mnt >> /mnt/etc/fstab`
2. change root into the new system
`arch-chroot /mnt`
3. link corresponding timezone file to your `/etc/localtime`
`ln -sf /usr/share/zoneinfo/Region/City /etc/localtime`
generate `/etc/adjtime` by running `hwclock --systohc`
4. edit `/etc/locale.gen` and uncomment `en_US.UTF-8 UTF-8` then running `locale-gen`
5. set language `echo "LANG=en_US.UTF-8" > /etc/locale.conf`
6. set hostname `echo "ArchLinux" > /etc/hostname `
7. initialize hosts
`echo "127.0.0.1 localhost" >> /etc/hosts`
`echo "::1 localhost" >> /etc/hosts`
`echo "127.0.1.1 hostname.localdomain localhost" >> /etc/hosts`
8. enable networkmanager when system boot up
`systemctl enable NetworkManager`
download `wpa_supplicant` for wireless connection
`sudo pacman -Syu wpa_supplicant`
9. set root password by running `passwd`
10. create user account and set password
`useradd -m -G wheel user_name`
`passwd user_name`
*You may want to add user_name to other groups see* [Users and groups](https://wiki.archlinux.org/title/Users_and_groups)
11. uncomment `%wheel ALL=(ALL) ALL` in `/etc/sudoers`
12. install bootloader
`pacman -Syu grub efibootmgr`
`grub-install --target=x86_64-efi --efi-directory=efi_system_partition --bootloader-id=GRUB`
`grub-mkconfig -o /boot/grub/grub.cfg`
13. reboot
`exit`, `unmount -R /mnt` then `reboot`
### Install desktop environment and some apps
- uncomment multilib section in `/etc/pacman.conf`
- uncomment Color in pacman.conf to enable color
- pipewire
`sudo pacman -Syu pipewire wireplumber pipewire-audio pipewire-alsa pipewire-pulse pipewire-jack`
- bluetooth
`sudo pacman -Syu bluez bluez-utils`
`sudo systemctl enable --now bluetooth.service`
- intel-iGPU
`sudo pacman -Syu mesa vulkan-intel`
- amd-iGPU & dGPU
`sudo pacman -Syu mesa vulkan-radeon xf86-video-amdgpu`
- nvidia-dGPU
`sudo pacman -Syu nvidia nvidia-utils nvidia-settings`
- fonts
`sudo pacman -Syu ttf-liberation wqy-zenhei noto-fonts-cjk`
- KDE plasma(wayland)
`sudo pacman -Syu plasma-desktop kde-gtk-config plasma-nm powerdevil kdeplasma-addons systemsettings sddm sddm-kcm dolphin kitty firefox vlc fastfetch`
- command auto-completion
install `bash-completion` add `complete -cf sudo` in `~/.bashrc` then run `source ~/.bashrc`
- optimize ssd
run `sudo systemctl enable fstrim.timer`
then `sudo systemctl start fstrim.timer`
- backup
`sudo pacman -S rsync`
`yay -Sy timeshift`
### Security
- firewall
`sudo pacman -S ufw`
`sudo ufw enable`
check the firewall if it's activated by `sudo ufw status verbose`
`sudo systemctl enable --now ufw.service`
- apparmor
add kernel parameter `lsm=landlock,lockdown,yama,integrity,apparmor,bpf`
download `apparmor`
`sudo systemctl enanle --now apparmor`
To test if AppArmor has been correctly enabled
`aa-enabled` output should be `Yes`
### Arch User Repository (AUR)
- `git clone https://aur.archlinux.org/yay-bin.git`
`cd yay-bin`
`makepkg -si`
- [yay (Yet another Yogurt) github repo](https://github.com/Jguer/yay)
### Some nvidia stuff
1. edit `/etc/default/grub`
ensure `GRUB_CMDLINE_LINUX_DEFAULT="... nvidia-drm.modeset=1"`
then running `grub-mkconfig -o /boot/grub/grub.cfg`
2. [early KMS start](https://wiki.archlinux.org/title/Kernel_mode_setting#Early_KMS_start)
[pacman hook](https://wiki.archlinux.org/title/NVIDIA#pacman_hook)
then running `sudo mkinitcpio -P`
3. verify the DRM is set properly
run `cat /sys/module/nvidia_drm/parameters/modeset`
it output should be `Y`
### flatpak
1. (still working on it)
### hyprland
1. some component:
`waybar` : status bar
`wofi` : app launcher/switcher
`swaync` : notification daemon
`nautilus` : file manager
`hyprlock` : lock screen
`hypridle` : system suspend, etc
`hyprshot` : screen shot
`hyprpaper, swww` : wallpaper
`kitty` : terminal
`startship` : eye candy for your terminal
`nwg-look` : gtk theme
`sof-firmware` : speaker sound
`noto-fonts-emoji` : system emojis
*delete wqy-zenhei to prevent apps fallback to it if you have to use Japanese, Chinese.. fonts
2. VAAPI
stow, catppuccin-gtk-theme-mocha, sof-firmware
### Reference
- [Arch wiki](https://wiki.archlinux.org/title/Main_page)
- [arch-minimal-install by rtxx](https://github.com/rtxx/arch-minimal-install)
- NYCU SDC Arch Linux Workshop installation guide
- [10 Things to do After Installing Arch Linux](https://www.youtube.com/watch?v=bMYLM8pEuIk)
- [I Installed The Hardest System Known To Man...](https://www.youtube.com/watch?v=_JYIAaLrwcY)