Skip to content

Instantly share code, notes, and snippets.

@lancechentw
Last active August 29, 2015 14:03
Show Gist options
  • Save lancechentw/5e22bdce8515310f805c to your computer and use it in GitHub Desktop.
Save lancechentw/5e22bdce8515310f805c to your computer and use it in GitHub Desktop.
Arch Linux One Step Installer
echo "nameserver 140.113.235.1" > /etc/resolv.conf
echo "nameserver 140.113.235.1" > /etc/resolv.conf.head
sgdisk -l flex-partition-table /dev/sda
sgdisk -G /dev/sda
mkfs.ext2 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
swapon /dev/sda2
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
sed -i '1 iServer = http://archlinux.cs.nctu.edu.tw/$repo/os/$arch' /etc/pacman.d/mirrorlist
pacman -Sy --noconfirm archlinux-keyring
pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
cp setup.sh /mnt/root/setup.sh
arch-chroot /mnt /root/setup.sh
rm /mnt/root/setup.sh
umount -R /mnt
swapoff /dev/sda2
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
hwclock --systohc --utc
mkinitcpio -p linux
pacman -S --noconfirm grub
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
pacman -S --noconfirm openssh
systemctl enable sshd
pacman -S --noconfirm ntp
ntpdate tick.stdtime.gov.tw
systemctl enable ntpd
ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment