Skip to content

Instantly share code, notes, and snippets.

@elimerl
Created December 6, 2021 05:08
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 elimerl/96ddf0880a4c72f2dfa618f0fa5ed739 to your computer and use it in GitHub Desktop.
Save elimerl/96ddf0880a4c72f2dfa618f0fa5ed739 to your computer and use it in GitHub Desktop.
Arch Linux install script (probably works)
(
echo n
echo p
echo 1
echo
echo +10G
echo n
echo p
echo 2
echo
echo
echo w
) | fdisk /dev/sda
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
reflector -c "US" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
mount /dev/sda2 /mnt
pacstrap /mnt base linux linux-firmware
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
pacman -S --noconfirm grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
printf "Enter hostname: "
read hostname
echo $hostname > /etc/hostname
printf "Enter root password: "
read passw
echo "root:$passw" | chpasswd
echo "Do you want to create a user?: "
read wants_to_create_user
if wants_to_create_user == "y"
then
echo "Create user: "
read username
useradd -m -g users -G wheel -s /bin/bash $username
printf "Enter user password: "
read passw
echo "$username:$passw" | chpasswd
echo "user $username" >> /etc/sudoers
fi
echo "Arch Linux installed successfully! Rebooting in 5 seconds..."
sleep 5
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment