Skip to content

Instantly share code, notes, and snippets.

@terryoy
Last active December 10, 2015 16:28
Show Gist options
  • Save terryoy/4461444 to your computer and use it in GitHub Desktop.
Save terryoy/4461444 to your computer and use it in GitHub Desktop.
Archlinux Installation Script
# create and format the partitions
fdisk /dev/sda
# n (new partition)
# +100M (for /boot)
# n
# +15G (for / including /usr)
# n
# +8G (for /var)
# n
# (for the rest, extended)
# n (create the partition /dev/sda5 under extended /dev/sda4)
mkfs -t ext4 /dev/sda1
mkfs -t ext4 /dev/sda2
mkfs -t ext4 /dev/sda3
mkfs -t ext4 /dev/sda5
# mount partitions
mount /dev/sda2 /mnt
mkdir /mnt/boot
mkdir /mnt/var
mkdir /mnt/home
mkdir /mnt/usr
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/var
mount /dev/sda5 /mnt/home
# (optional) configure wifi
wifi-menu
# edit /etc/pacman.d/mirrorlist to move your favourite mirror in the first line!
# install base system
pacstrap /mnt base base-devel
# install GRUB
arch-chroot /mnt pacman -S grub-bios
# generate fstab for file system
genfstab -p /mnt >> /mnt/etc/fstab
# chroot into the newly created system
arch-chroot /mnt
# write down your hostname
echo "myhost" >> /etc/hostname
# set your timezone
ln -s /usr/share/zoneinfo/PRC /etc/localtime
# set locale
echo ‘LANG="en_US.UTF-8"’ >> /etc/locale.conf
# uncomment the charsets in /etc/locale.gen, and
locale-gen
# create an initial RAM disk (Configure /etc/mkinitcpio.conf if needed), and configure GRUB again??
mkinitcpio -p linux
# install grub to /dev/sda !!
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
# set root password
passwd
# (optional) install virtualbox-guest
pacman -S virtualbox-guest-utils
modprobe -a vboxguest vboxsf vboxvideo
# get out of chroot, ^D or:
exit
# umount all
umount --all
reboot
################
# after reboot, login with root
# create user
useradd -m -g users -s /bin/bash terryoy
passwd terryoy
# setup network
ip link set eth0 up
# check: ip addr show dev eth0
dhcpcd eth0
# start eth0 DHCP at boot(, or manually: systemctl start dhcpcd@eth0)
systemctl enable dhcpcd@eth0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment