Created
March 6, 2021 19:04
-
-
Save pipelinedave/7a6b368e18df72ed9206268124ea34c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DISK="/dev/$1" | |
PARTITION="${DISK}1" | |
echo DISK="$DISK", PARTITION="$PARTITION" | |
parted -s "$DISK" mklabel msdos | |
parted -s -a optimal "$DISK" mkpart primary ext4 0% 100% | |
parted -s "$DISK" set 1 boot on | |
mkfs.ext4 -F "$PARTITION" | |
# you can find your closest server from: https://www.archlinux.org/mirrorlist/all/ | |
echo 'Server = http://mirror.internode.on.net/pub/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist | |
mount "$PARTITION" /mnt | |
pacman -Syy | |
# would recommend to use linux-lts kernel if you are running a server environment, otherwise just use "linux" | |
pacstrap /mnt $(pacman -Sqg base | sed 's/^linux$/&-lts/') base-devel grub openssh sudo ntp wget vim | |
genfstab -p /mnt >> /mnt/etc/fstab | |
cp ./chroot.sh /mnt | |
cp ~/.ssh/authorized_keys /mnt | |
arch-chroot /mnt ./chroot.sh "$DISK" | |
rm /mnt/chroot.sh | |
rm /mnt/authorized_keys | |
umount -R /mnt | |
systemctl reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment