Table of Contents

This page was archived on 2020-02-21. It's still mostly relevant for pre-UEFI systems, but will no longer be updated.

Installing

  1. Enable ssh: ip addr , passwd , systemctl start sshd , ssh into VM
  2. Partition drive:
    cfdisk /dev/sda

    (DOS table, one partition, bootable.)

  3. Format:
    mkfs.ext4 /dev/sda1
  4. Mount root:
    mount /dev/sda1 /mnt
  5. Install:
    pacstrap /mnt base base-devel htop tmux sudo wget grub elinks
  6. Generate fstab:
    genfstab -Up /mnt >> /mnt/etc/fstab
  7. chroot:
    arch-chroot /mnt /bin/bash
  8. set locale:
    echo en_US.UTF-8 UTF-8 > /etc/locale.gen ; locale-gen
  9. Set time zone
    ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
  10. set hostname:
    echo hostname > /etc/hostname

    (You should probably add it to /etc/hosts too)

  11. create netctl profile:
    echo -e "Interface=ens32\nConnection=ethernet\nIP=static\nAddress='10.0.0.15/8'\nGateway='10.0.0.1'\nDNS='10.0.0.1'" > /etc/netctl/enet
  12. if DHCP is required, edit /etc/netctl/examples/ethernet-dhcp instead
  13. enable netctl:
    systemctl enable netctl
  14. enable profile:
    netctl enable enet
  15. set root passwd
  16. create user
    useradd -m -G wheel -s /bin/bash user
  17. set user passwd
  18. configure sudo
     echo %wheel ALL=\(ALL\) ALL >> /etc/sudoers
  19. install bootloader
    grub-install --target=i386-pc /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
  20. enable ssh:
    systemctl enable sshd
  21. enable vmtools:
    systemctl enable vmtoolsd
  22. exit chroot
  23. umount /mnt
  24. sync
  25. reboot & disconnect ISO

Other Options

As with everything else linux related, there are many different ways to go about this. Listed below are a few alternatives to the above steps.

Partitioning

A very quick way to create one partition with fdisk can be to echo keystrokes to it:

echo -e "o\nn\n\n\n\n\nw" | fdisk /dev/sda

This can be done even faster when combined directly with mkfs & mounting:

echo -e "o\nn\n\n\n\n\nw" | fdisk /dev/sda; mkfs.btrfs /dev/sda1; mount /dev/sda1 /mnt

Mirror

Ctrl-K-ing all of the mirrorlist can take some time, and is unnecessary.

echo Server = http:\/\/10.0.0.35\/archlinux\/\$repo\/os\/\$arch > /etc/pacman.d/mirrorlist

Note: This will wipe ALL of the mirrors from the mirrorlist.

The Whole Kaboodle

If you really wanted to, you could do it all in one fell swoop. I've added in a few extras.

dd if=/dev/zero of=/dev/sda count=100000; echo -e "o\nn\n\n\n\n\nw" | fdisk /dev/sda; mkfs.btrfs /dev/sda1; mount /dev/sda1 /mnt;
echo Server = http:\/\/10.0.0.35\/archlinux\/\$repo\/os\/\$arch > /etc/pacman.d/mirrorlist;
pacstrap /mnt base base-devel syslinux openssh tmux open-vm-tools sudo wget; genfstab -Up /mnt >> /mnt/etc/fstab; 
arch-chroot /mnt /bin/bash; echo en_US.UTF-8 UTF-8 > /etc/locale.gen; locale-gen; ln -s /usr/share/zoneinfo/America/New_York /etc/localtime; 
hwclock --systohc --utc; echo hostname > /etc/hostname; 
echo -e "Interface=ens32\nConnection=ethernet\nIP=static\nAddress='10.0.0.x/8'\nGateway='10.0.0.1'\nDNS='10.0.0.1'" > /etc/netctl/enet; 
netctl enable enet; systemctl enable netctl; systemctl enable vmtoolsd; systemctl enable sshd; useradd -m -G wheel -s /bin/bash user; 
echo %wheel ALL=\(ALL\) ALL >> /etc/sudoers; syslinux-install_update -iam

This does not include setting passwords for root or the new user, or changing /dev/sda3 to /dev/sda1 in syslinux.cfg. Chroot can be exited and /mnt umounted after this is done.