- Shell 100%
| install.sh | ||
| packages.txt | ||
| README.md | ||
Arch Linux Installation
LVM on LUKS on MDADM Arch installation with systemd-boot
Partitioning
Create software raid using mdadm:
mdadm --create /dev/md0 --metadata=1.0 --level=1 --raid-devices=2 /dev/sda /dev/sdb
Create two partitions:
- /dev/md0p1 - 1GiB - boot partition,
- /dev/md0p2 - 100% free - system partition.
Format the boot partition:
mkfs.fat -F32 /dev/md0p1
Encryption
Encrypt the disk:
cryptsetup luksFormat /dev/md0p2
Open the disk with the password set above:
cryptsetup luksOpen /dev/md0p2 cryptlvm
LVM
Create a physical volume:
pvcreate /dev/mapper/cryptlvm
Create a volume group:
vgcreate vg01 /dev/mapper/cryptlvm
Create logical partitions:
lvcreate -L<SIZE_OF_RAM> vg01 -n lvswap
lvcreate -L<40-120G> vg01 -n lvroot
lvcreate -L<LEFT_FREE_SPACE - ~50G> vg01 -n lvhome
Format file system on logical partitions:
mkfs.ext4 /dev/vg01/lvroot
mkfs.ext4 /dev/vg01/lvhome
mkswap /dev/vg01/lvswap
Mount the volumes and file systems:
mount /dev/vg01/lvroot /mnt
mkdir -p /mnt/home /mnt/boot
mount /dev/vg01/lvhome /mnt/home
mount /dev/md0p1 /mnt/boot
swapon /dev/vg01/lvswap
Installation
If using Wi-Fi, connect to it via iwctl:
iwctl
station <DEVICE> connect <SSID>
Device name is usually wlan0, but you can always check with the ip command:
ip a
Install base packages, linux firmware, lvm2 and other utilities:
pacstrap /mnt base base-devel linux-lts linux-firmware lvm2 mdadm efibootmgr networkmanager modemmanager vim \
usb_modeswitch usbutils dosfstools fuse sshfs nfs-utils wget curl inetutils iftop nmap tcpdump swaks s-nail \
bind net-tools iw mtr samba mc lsof ffmpeg imagemagick yt-dlp git atop htop openssh autossh dd_rescue postfix \
cups cups-filters cups-pdf ghostscript gsfonts foomatic-db-engine foomatic-db foomatic-db-ppds foomatic-db-nonfree \
foomatic-db-nonfree-ppds gutenprint foomatic-db-gutenprint-ppds hplip podman podman-compose prometheus-node-exporter \
tigervnc libvncserver tree logrotate lsscsi pigz zip unzip 7zip unrar sysstat rlwrap enca recode xmlstarlet smartmontools nvme-cli
Generate fstab:
genfstab -U /mnt >> /mnt/etc/fstab
Generate mdadm config:
mdadm --detail --scan >> /mnt/etc/mdadm.conf
chroot into system:
arch-chroot /mnt
Set time locale:
ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
Set clock:
hwclock --systohc
Set your hostname:
echo 'HOST_NAME' > /etc/hostname
Uncomment your prefered locales in /etc/locale.gen and generate them:
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
sed -i 's/#pl_PL.UTF-8 UTF-8/pl_PL.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
Set system language:
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
Set your keymap:
echo 'KEYMAP=pl' > /etc/vconsole.conf
cat <<EOF > /etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "pl"
EndSection
EOF
Enable NetworkManager and ntp:
systemctl enable NetworkManager
systemctl enable systemd-timesyncd
Because our filesystem is on LVM we will need to enable the correct mkinitcpio hooks.
Edit the /etc/mkinitcpio.conf. Look for the HOOKS variable and update it to look like:
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
HOOKS=( ... block mdadm_udev encrypt lvm2 filesystems ... )
Regenerate the initramfs:
mkinitcpio -p linux-lts
Bootloader
Install a bootloader:
mkdir -p /boot/EFI/BOOT /boot/EFI/systemd
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi /boot/EFI/systemd/
cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi /boot/EFI/BOOT/BOOTX64.EFI
Create loader directories:
mkdir -p /boot/loader/entries
Edit loader configuration /boot/loader/loader.conf:
default arch.conf
timeout 0
editor no
Create a bootloader entry /boot/loader/entries/arch.conf:
title Arch Linux
linux /vmlinuz-linux-lts
initrd /initramfs-linux-lts.img
options cryptdevice=UUID={UUID}:cryptlvm root=/dev/vg01/lvroot quiet rw
Replace {UUID} with the UUID of /dev/md0p2.
Add UEFI boot entries:
efibootmgr -c -L Linux\ Boot\ Manager -l \\EFI\\systemd\\systemd-bootx64.efi -d /dev/md0 -p 1
efibootmgr -c -L Linux\ Boot\ Manager -l \\EFI\\BOOT\\BOOTX64.EFI -d /dev/md0 -p 1
Complete
Set a password for root user:
passwd
Add user:
useradd -mG uucp,storage,sys -s /bin/bash user_name
passwd user
Exit chroot, unmount everything and reboot:
exit
umount -R /mnt
reboot now
Other packages:
GPU drivers (nvidia):
pacman -S nvidia nvidia-utils lib32-nvidia-utils nvidia-settings
Fonts:
pacman -S noto-fonts noto-fonts-emoji noto-fonts-cjk
Audio:
pacman -S pipewire pipewire-jack pipewire-pulse pipewire-alsa wireplumber
Bluetooth:
pacman -S bluez bluez-utils
systemctl enable --now bluetooth.service
Make sure to install the above packages before the ones below.
Desktop environment (minimal):
pacman -S xorg xorg-xinit xorg-xrdb xsecurelock ly bspwm sxhkd polybar
systemctl enable --now ly.service
Desktop environment (kde):
pacman -S xorg xorg-xinit xorg-xrdb sddm plasma konsole dolphin
systemctl enable --now sddm.service