Skip to content

Instantly share code, notes, and snippets.

@HoneyBearCodes
Last active April 3, 2024 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HoneyBearCodes/ba4b56cc4b6d1322b29a94b875deccdf to your computer and use it in GitHub Desktop.
Save HoneyBearCodes/ba4b56cc4b6d1322b29a94b875deccdf to your computer and use it in GitHub Desktop.
Instructions for dual booting Arch Linux with Windows 10/11 (Intel GPU) and installing i3 as the Window Manager
#!/usr/bin/env bash
##########################
# AUTHOR: SHASHANK SINGH #
##########################
# Adjust terminal font size for better visibility
setfont ter-132n
###### Connect to Wi-Fi if Ethernet is unavailable using iwctl ######
# Replace <iface> & <ssid> with your wireless interface and preferred network name respectively.
iwctl
# List available network interfaces
device list
# View available networks
station <iface> get-networks
# Connect to desired network using SSID
station <iface> connect <ssid>
# Verify internet connectivity
ip addr | grep 'inet '
# Test connection
ping -c 4 www.google.com
###### Synchronize the pacman package database ######
pacman -Syy
# Install Arch Linux Keyring
pacman -S archlinux-keyring
###### Set up partitioning scheme ######
# Identify connected hard drives
lsblk
# Use disk utility such as cfdisk to partition (e.g., cfdisk /dev/<drv>)
# Create partitions: Root (/), Home (/home), Swap (optional), Boot (/boot/EFI)
# Format partitions
mkfs.fat -F32 /dev/<efi_partition> && mkfs.ext4 /dev/<root_partition> && mkfs.ext4 /dev/<home_partition> && mkswap /dev/<swap_partition>
# Mount partitions
mount /dev/<root_partition> /mnt && mkdir /mnt/home && mount /dev/<home_partition> /mnt/home && mkdir -p /mnt/boot/EFI && mount /dev/<efi_partition> /mnt/boot/EFI && swapon /dev/<swap_partition>
###### Installing Arch Base in the root partition ######
pacstrap -i /mnt base base-devel linux linux-firmware sudo
###### Generate the fstab file to mount partitions automatically at boot ######
genfstab -U /mnt >> /mnt/etc/fstab
# Review fstab
cat /mnt/etc/fstab
###### Log in to the newly installed system ######
arch-chroot /mnt
###### Set super user password ######
passwd
###### Create new user and set password ######
useradd -m -g users -G wheel,storage,power,video,audio -s /bin/bash <username>
passwd <username>
###### Edit sudoers file to enable users of the wheel group to use sudo command ######
EDITOR=nvim visudo
# Uncomment: %wheel ALL=(ALL:ALL) ALL
###### Link timezone with localtime ######
ln -sf /usr/share/zoneinfo/<Continent>/<City> /etc/localtime # (e.g., /usr/share/zoneinfo/Asia/Kolkata)
hwclock --systohc
###### Set system language by specifying a locale ######
nvim /etc/locale.gen
# Uncomment line for your locale (e.g., en_US.UTF-8 UTF-8)
locale-gen
nvim /etc/locale.conf
# Add: LANG=en_US.UTF-8 (or your desired locale configuration)
###### Set up hosts ######
nvim /etc/hostname
# Add system hostname (e.g., archlinux)
nvim /etc/hosts
# Add content replacing <hostname> with system hostname
127.0.0.1 localhost
::1 localhost
127.0.1.1 <hostname>.localdomain <hostname>
###### Install required and additional software ######
pacman -Sy htop mesa intel-media-driver intel-ucode neovim bluez bluez-utils networkmanager network-manager-applet gnome-keyring openssh grub efibootmgr dosfstools mtools git os-prober
###### Install GRUB Bootloader ######
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=GRUB
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg
nvim /etc/default/grub
# Set: GRUB_DISABLE_OS_PROBER=false
grub-mkconfig -o /boot/grub/grub.cfg
###### Enable Bluetooth and Network Manager services ######
systemctl enable bluetooth
systemctl enable NetworkManager
###### Exit chroot environment and unmount partitions ######
exit
umount -lR /mnt
###### Shutdown system, eject flash drive, and reboot #####
shutdown now
##########################
# Installing a WM #
##########################
# Login with <username> credentials
# Adjust terminal font size
setfont -d
###### Connect to Wi-Fi using nmcli if Ethernet is unavailable ######
# Check device status
nmcli dev status
# Enable Wi-Fi
nmcli radio wifi on
# List nearby Wi-Fi networks
nmcli dev wifi list
# Connect to Wi-Fi using SSID and password
sudo nmcli dev wifi connect <ssid> password "<pass>"
###### Install i3 Window Manager ######
sudo pacman -Syy
sudo pacman -S i3-gaps xorg-server xorg-xinit xorg-xrandr ttf-dejavu dmenu kitty fish starship eza ranger thunar gvfs gvfs-mtp xarchiver lxappearance arc-gtk-theme feh xdg-user-dirs
yay -S brave-bin visual-studio-code-bin
cp /etc/X11/xinit/xinitrc /home/<username>/.xinitrc
# Edit .xinitrc, remove existing WM lines, and add:
# exec i3
###### Install Login Manager ######
sudo pacman -S lightdm lightdm-webkit2-greeter
yay -S lightdm-webkit-theme-aether
sudo systemctl enable --now lightdm
sudo nvim /etc/lightdm/lightdm.conf # (change greeter-session=lightdm-webkit2-greeter)
sudo nvim /etc/lightdm/lightdm-webkit2-greeter.conf # (change webkit_theme = lightdm-webkit-theme-aether)
# If /etc/lightdm/lightdm-webkit2-greeter.conf doesn't exist, create and add:
[Seat:*]
allow-guest=false
greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session
greeter-session=lightdm-webkit2-greeter
allow-user-switching=true
session-wrapper=/etc/lightdm/Xsession
# Autostart systemd default session on tty1, add to /etc/profile
if [[ "$(tty)" == '/dev/tty1' ]]; then
exec startx
fi
###### Reboot and hope for the best, asking for forgiveness and mercy from the Almighty for system stability #####
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment