arch installation - seintzx/dotfiles GitHub Wiki
This is my archlinux installation guide both for single and dual boot with windows
If you want a more in-depth guide read the Arch Installation Guide, it's the best starting point to understand what I'll do here
Thanks to fam4r for the help
If you want to single-boot simply skip to archlinux's part
Download the latest iso here and create a bootable USB drive
For a *nix system you can run:
$ dd bs=16M if=<image.iso> of=/dev/sdX status=progress && syncUse gparted live iso to clear old disk, create GPT partition's table and those
partition:
- 60% windows (NTFS)
- 40% arch (unallocated or ext4)
boot partition will be create by windows during installation process
NOTE: Partition's percentage depends on your need note that on arch I keep root and home together
- Install windows through installation's media
- Install all updates from control panel
- Disable secure boot from BIOS
- Disable fastboot (Control Panel -> Hardware -> Power Options -> System)
Fire up arch installation's media
$ setfont ter-132nNOTE: Do not create EFI partition if dual-booting
$ cgdisk /dev/nvme0n1
1 512MB EFI partition # Hex code ef00
2 100% size partiton # (to be encrypted) Hex code 8300Format to EFI
$ mkfs.vfat -F32 -n EFI /dev/nvme0n1pYNOTE:
Yis the number of the EFI partition where you want to install boot or the one already create by windows
Note: Many NVMe drives can exceed 2GB/s, consider your crypto algorithm wisely, review
cryptsetup benchmark, the defaults are viewable at end ofcryptsetup --help, defaults are commonly the fastest with good security from my experience with cryptsetup (AES 256, sha256, 2000ms)
$ cryptsetup --use-random -v luksFormat --type luks2 /dev/nvme0n1pX
$ cryptsetup luksOpen /dev/nvme0n1pX luksNOTE:
Xis the number of the partition where you want to installarch
This creates one partions for both root and home
If you want /home and /root into differents partition do it now
$ pvcreate /dev/mapper/luks
$ vgcreate vg0 /dev/mapper/luks
$ lvcreate -l +100%FREE vg0 --name root
$ mkfs.ext4 -L root /dev/mapper/vg0-root$ mount /dev/mapper/vg0-root /mnt
$ mkdir /mnt/boot
$ mount /dev/nvme0n1pY /mnt/boot$ iwctl$ pacstrap /mnt base base-devel \
zsh neovim git \
efibootmgr \
dialog wpa_supplicant networkmanager \
intel-ucode linux linux-firmware lvm2It includes editor, boot manager, driver for intel and lvm compatibility, software for network connection
$ genfstab -pU /mnt | tee -a /mnt/etc/fstabChange relatime to noatime on all non-boot partitions (reduces wear if using
an SSD)
$ nvim /mnt/etc/fstab
--------------------------------------------------------------------------------
...
#tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0Uncomment the line if you know what you are doing
$ arch-chroot /mnt /bin/bash$ ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime
$ hwclock --systohc$ echo <MYHOSTNAME> /etc/hostname$ nvim /etc/hosts
--------------------------------------------------------------------------------
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostnameUncomment wanted locales in /etc/locale.gen
$ nvim /etc/locale.gen
$ locale-gen
$ localectl set-locale LANG=en_US.UTF-8NOTE: To avoid problems with gnome-terminal set locale system wide do NOT set LC_ALL=C. It overrides all the locale vars and messes up special characters. Pay attention to the .UTF-8 Capital letters!
$ echo LANG=en_US.UTF-8 >> /etc/locale.conf
$ echo LC_ALL= >> /etc/locale.conf$ passwd$ groupadd MYUSERNAME
$ useradd -m -G wheel,storage,power,network,uucp -s /bin/zsh MYUSERNAME
$ passwd MYUSERNAME
$ EDITOR=nvim visudo
--------------------------------------------------------------------------------
...
%wheel ALL=(ALL) ALL
...$ bootctl --path=/boot install
$ nvim /boot/loader/loader.conf
--------------------------------------------------------------------------------
default arch.conf
timeout 5
editor no$ nvim /boot/loader/entries/arch.conf
--------------------------------------------------------------------------------
title archlinux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=<UUID>:vg0:allow-discards
root=/dev/mapper/vg0-root
rw quiet
nvme_core.default_ps_max_latency_us=5500
mem_sleep_default=deep
psmouse.synaptics_intertouch=1NOTE: use
blkidto find the<UUID>of the raw encrypted device (/dev/nvme0n1pX)
DUAL BOOT ONLY
$ ls /boot/EFI/Microsoft/Boot
$ mkdir /mnt/winboot
$ mount /dev/nvme0n1pY /mnt/winboot
$ cp -r /mnt/winboot/EFI/Microsoft /boot/EFIAbove step may be unnecessary
$ nvim /boot/loader/entries/windows.conf
--------------------------------------------------------------------------------
title windows
efi /EFI/Microsoft/Boot/bootmgfw.efiCheck with bootctl list
$ pacman -S grub
$ grub-install --target=x86_64-efi --efi-directory=boot /dev/nvme0n1pYModify config
$ nvim /etc/default/grub
--------------------------------------------------------------------------------
...
# GRUB_CMDLINE_LINUX="<copy paramenters from entries's options row>"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=<UUID>:vg0:allow-discards ..."
GRUB_PRELOAD_MODULES="... lvm"
...Save config
$ grub-mkconfig -o /boot/grub/grub.cfg$ nvim /etc/mkinitcpio.conf
--------------------------------------------------------------------------------
...
MODULES=(... ext4)
HOOKS=(base udev keyboard autodetect modconf block lvm2 encrypt filesystems fsck)
...NOTE: Order is important, do not change it unless you know what you are doing
$ mkinitcpio -p linuxIf the command fails because there's no space left on partition, remove
fallback image
$ nvim /etc/mkinitcpio.d/linux.preset
--------------------------------------------------------------------------------
...
PRESETS=('default')
...$ cat /etc/lvm/lvm.conf | grep issue_discards
$ sed -i 's/issue_discards = 0/issue_discards = 1/g' /etc/lvm/lvm.conf
$ cat /etc/lvm/lvm.conf | grep issue_discards
$ systemctl enable --now fstrim.timer$ exit
$ umount -R /mnt
$ reboot