Skip to content

Instantly share code, notes, and snippets.

@manuel-baumgartner
Forked from sq3/archlinux-install.sh
Last active February 1, 2018 19:11
Show Gist options
  • Save manuel-baumgartner/c50fb952bc397e94635fa7fad8a11b73 to your computer and use it in GitHub Desktop.
Save manuel-baumgartner/c50fb952bc397e94635fa7fad8a11b73 to your computer and use it in GitHub Desktop.
# confirm you can access the internet
if [[ ! $(curl -Is http://www.google.com/ | head -n 1) =~ "200 OK" ]]; then
echo "Your Internet seems broken. Press Ctrl-C to abort or enter to continue."
read
fi
# make partition on the disk.
parted -s /dev/sda mktable GPT
parted -s /dev/sda mkpart primary 0% 100%
# make filesystems
# /
mkfs.ext4 /dev/sda1
# set up /mnt
mount /dev/sda1 /mnt
# Force arch mirror of hs-esslingen
#echo 'Server = http://ftp-stud.hs-esslingen.de/pub/Mirrors/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
pacman -Syy
# install base packages (take a coffee break if you have slow internet)
pacstrap /mnt base
#base-devel
# install grub
arch-chroot /mnt pacman -S grub --noconfirm
# copy ranked mirrorlist over
cp /etc/pacman.d/mirrorlist* /mnt/etc/pacman.d
# generate fstab
genfstab -p /mnt >>/mnt/etc/fstab
# chroot
arch-chroot /mnt /bin/bash <<EOF
# set initial hostname
echo "archlinux-$(date -I)" >/etc/hostname
# set initial timezone to Europe/Berlin
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# set initial locale
locale >/etc/locale.conf
echo "de_DE.UTF-8 UTF-8" >>/etc/locale.gen
#echo "en_US ISO-8859-1" >>/etc/locale.gen
locale-gen
# no modifications to mkinitcpio.conf should be needed
#mkinitcpio -p linux #no need for that after fresh installation
# install grub bootloader
grub-install --target=i386-pc /dev/sda
# generate grub config
grub-mkconfig -o /boot/grub/grub.cfg
# set root password to "root"
echo root:root | chpasswd -e
#no
# end section sent to chroot
EOF
# unmount
umount /mnt/
echo "Done! Unmount the CD image from the VM, then type 'exit' and 'reboot'."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment