Skip to content

Instantly share code, notes, and snippets.

@SakibFarhad
Last active September 14, 2023 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SakibFarhad/6347c3b1323a395c3a735f23146b3270 to your computer and use it in GitHub Desktop.
Save SakibFarhad/6347c3b1323a395c3a735f23146b3270 to your computer and use it in GitHub Desktop.
Arch Linux Setup guide

Let's downlaod the ISO from this link.

Now need a pendrive, 4GB is more then enough. pen drive's path /dev/sdb/

sudo dcfldd if=arch_linux.iso of=/dev/sdb

Now let's boot the target machine with using UEFI and this pendrive.

if dhcp ethernet is not available use wifi-menu to setup wireless network
Partiton the drive

fdisk -l # check the list which one is getting the arch setup

/dev/nvme0n1 is the target

fdisk /dev/nvme0n1

create 3 drive for the arch setup

  • 512MB for EFI /dev/nvme0n1p1
  • 2GB for swap /dev/nvme0n1p2
  • rest goes to / /dev/nvme0n1p3
mkfs.fat -F32 /dev/nvme0n1p1
mkswap /dev/nvme0n1p2
swapon
mkfs.ext4 /dev/nvme0n1p3

now mount the partitons (for systemd-boot see below)

mount /dev/nvme0n1p3 /mnt
mkdir -p /mnt/boot/EFI
mount /dev/nvme0n1p1 /mnt/boot/EFI

Install base system

pacstrap /mnt base linux linux-firmware

add the base system to fstab

genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt

WOW!! we are in the system now

Change hostname

echo 'fullbrick' > /etc/hostname

Change timezone

ln -sf /usr/share/zoneinfo/Asia/Dhaka /etc/localtime

create user

useradd -mg users -G wheel,storage,power -s /bin/bash sakib
passwd sakib

now install my favourite packages

# I have nvidia GPU
# I love plasma desktop
pacman -S plasma intel-ucode konsole kate okular neovim git docker nvidia xorg-xrandr

locale-gen

nano /etc/locale.gen
# Uncomment en_US.UTF-8 UTF-8
locale-gen

Setup Network

systemctl enable NetworkManager avahi-daemon docker sddm

After Initial boot we will configure nvidia

We have 2 options one is grub another is systemd-boot, will describe both, use anyone.

grub

Install grub

pacman -S grub efibootmgr dosfstools os-prober mtools
grub-install --target=x86_64-efi  --bootloader-id=grub_uefi --recheck
grub-mkconfig -o /boot/grub/grub.cfg

systemd-boot

Nothing to install

mount /dev/nvme0n1p3 /mnt
mkdir -p /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

Create /boot

bootctl --path=/boot install

add following lines to /boot/loader/loader.conf

timeout 3
default arch

Next

cd /boot/loader/entries/
blkid -s PARTUUID -o value /dev/nvme0n1p3 > arch.conf

Now edit arch.conf, keep the UUID

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=PARTUUID=<generated_uuid> rw nvidia-drm.modeset=1

Done with installation

exit
umount -a
reboot

system will reboot into new KDE dekstop. happy us.

Nvidia setup (I have an asus Vivobook S15, should work for you too)

/etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

/usr/share/sddm/scripts/Xsetup

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

/etc/mkinitcpio.conf

MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

/etc/pacman.d/hooks/nvidia.hook

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
# Change the linux part above and in the Exec line if a different kernel is used

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'
sudo mkinitcpio -p linux

Now reboot and issue nvidia-smi you will file you kwin is running on nvidia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment