Skip to content

Instantly share code, notes, and snippets.

@bouroo
Last active October 19, 2023 12:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bouroo/b750d3fa357362772082407cfa21fb4a to your computer and use it in GitHub Desktop.
Save bouroo/b750d3fa357362772082407cfa21fb4a to your computer and use it in GitHub Desktop.
Init arch linux pacman
#!/usr/bin/env bash
# Enable networkd and resolved
systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl restart systemd-networkd
systemctl restart systemd-resolved
# Init pacman mirror
curl -s -L "https://www.archlinux.org/mirrorlist/?country=TH&country=SG&country=IN&country=JP&protocol=https&ip_version=4" | sed -e 's/^#Server/Server/' -e '/^#/d' > /etc/pacman.d/mirrorlist
# Init key
pacman-key --init
# Init archlinux key
pacman-key --populate archlinux
# Sync repo
yes '' | pacman -Syyu
# Install commom package
yes '' | pacman -S sudo htop iftop mtr tmux dkms lz4 bash-completion base-devel pacman-contrib
# Sort repo by speed
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
rankmirrors -n 5 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
# Create non root user
useradd admin -m
passwd admin
# Add admin to wheel group
usermod -aG wheel admin
# Allow wheel group sudo
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment