Skip to content

Instantly share code, notes, and snippets.

@jcchikikomori
Forked from bouroo/pacman-init.sh
Last active September 25, 2023 13:27
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 jcchikikomori/0984ae8111496ea7544b6452adbbe180 to your computer and use it in GitHub Desktop.
Save jcchikikomori/0984ae8111496ea7544b6452adbbe180 to your computer and use it in GitHub Desktop.
Initialize 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://archlinux.org/mirrorlist/?country=CN&country=JP&country=SG&country=KR&protocol=https&ip_version=4&use_mirror_status=on" | 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
pacman -Syyu --noconfirm --noprogressbar
# Install commom package
pacman -S --noconfirm --noprogressbar sudo htop iftop mtr dkms lz4 bash-completion base-devel pacman-contrib git
# 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