Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Last active July 17, 2023 11:58
Show Gist options
  • Save SamuelDavis/b97fa334048cfb5c75e32be8f34387cf to your computer and use it in GitHub Desktop.
Save SamuelDavis/b97fa334048cfb5c75e32be8f34387cf to your computer and use it in GitHub Desktop.
Arch Linux Installation
# Internet access
#################
iwctl station list # list devices
NET_DEVICE="MyDevice"
iwctl station $NET_DEVICE scan
iwctl station $NET_DEVICE get-networks # list networks
NET_NAME="MyNetwork"
NET_PASS="MyPassword"
iwctl --passphrase $NET_PASS station $NET_DEVICE connect $NET_NAME
## Update Clock
###############
timedatectl set-ntp true
# Partition Disk
################
fdisk -l # list disks
PART_DISK="/dev/mydisk"
fdisk $PART_DISK
# interactively:
# m: list help
# p: list partitions
# n: create new partition
# d: delete partition
# w: write partitions
# q: quit without writing partitions
PART_EFI="{$PART_DISK}p1"
PART_ROOT="{$PART_DISK}p5"
mkfs.ext4 $PART_ROOT # format the root partition
# Mount Filesystem
##################
mount $PART_ROOT /mnt
mount --mkdir $PART_EFI /mnt/boot
################
# Installation #
################
pacstrap /mnt \
base linux linux-firmware \ # base
neovim \ # editor
reflector \ # updating pacman
networkmanager \ # internet
nvidia xf86-video-intel \ # graphics card drivers
vim \ # editor
sudo \ # visudo for creating users
grub efibootmgr os-prober # bootloader
#############
# Configure #
#############
genfstab -U /mnt >> /mnt/etc/fstab
# Chroot
########
arch-chroot /mnt
# rebuild kernels so nvidia video driver is used
mkinitcpio -P
# Paralellize Pacman
sed -i 's/#Parallel/Parallel/' /etc/pacman.conf
# Timezone
##########
$TIMEZONE="America/New_York"
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
hwclock --systohc
ENC="UTF-8"
LANG="en_US.$ENC"
echo "$LANG $ENC" >> /etc/locale.gen
locale-gen
echo "LANG=$LANG" >> /etc/locale.conf
# Networking
############
HOSTNAME="MyHostname"
echo $HOSTNAME >> /etc/hostname
echo -e "127.0.0.1\tlocalhost" >> /etc/hosts
echo -e "::1\t\tlocalhost" >> /etc/hosts
echo -e "127.0.1.1\t${HOSTNAME}.localdomain\t${HOSTNAME}" >> /etc/hosts
# Root Password
###############
passwd
# Swap File
###########
SWAP_SIZE="4GB"
fallocate -l $SWAP_SIZE /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
# Boot loader
#############
echo "GRUB_DISABLE_OS_PROBER=false" >> /etc/default/grub
grub-install \
--target=x86_64-efi \
--efi-directory=/boot \
--bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# Background Services
#####################
systemctl enable NetworkManager
# Add User
######
USERNAME="MyUsername"
useradd \
--groups wheel \
--create-home \
$USERNAME
passwd $USERNAME
EDITOR=nvim visudo
# interactively
# uncomment %wheel ALL=(ALL:ALL) ALL
# Switch user
#####################
exit # exit installer
umount --all --lazy # unmount everything
reboot # restart the machine
# log into new user
# Connect to Internet
#####################
nmcli device wifi connect $NET_NAME password $NET_PASS
# User interface
################
sudo pacman --sync \
i3 \ # window manager
xterm # terminal emulator
# Display Server
################
sudo pacman --sync \
xorg-server \ # display-server
xorg-xinit \ # setup X systems
xorg-xrandr # configuring displays
Xorg :0 -configure
mv /root/xorg.conf.new /etc/X11/xorg.conf
sed -i 's/Keyboard0/LaptopKeyboard/' /etc/X11/xorg.conf
sed -i 's/Mouse0/LaptopTrackpad/' /etc/X11/xorg.conf
sed -i 's/Monitor0/HDMIMonitor/' /etc/X11/xorg.conf
sed -i 's/Monitor1/LaptopMonitor/' /etc/X11/xorg.conf
sed -i 's/Screen0/HDMIScreen/' /etc/X11/xorg.conf
sed -i 's/Screen1/LaptopScreen/' /etc/X11/xorg.conf
sed -i 's/Card1/IntegratedCard/' /etc/X11/xorg.conf
sed -i 's/Card0/DiscreteCard/' /etc/X11/xorg.conf
sudo nvidia-xconfig -o /etc/X11/xorg.conf.d/20-nvidia.conf
cp /etc/X11/xinit/xinitrc ~/.xinitrc
# Appearance
############
# scale the UI
echo "Xft.dpi: 220" >> ~/.Xresources
# scale the Terminal
echo "XTerm*faceName: xft:monospace:pixelsize=24" >> ~/.Xresources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment