Install Arch Linux on VirtualBox


Contrary to its reputation, building an Arch installation only takes about 15 minutes. Try it in VirtualBox.

I initially took the plunge and installed Arch right on my hard drive next to Windows, using their beginner’s guide.

Most of the installation time is spent learning its glorious innards.

However, I recently had to install Arch Linux on VirtualBox to help reproduce and debug an issue I reported for the Lollypop music player. I have compiled the meat of its actual installation process just to prove it’s not the monster people think it is.

Pregaming

  1. Download and install VirtualBox, and get the Arch ISO
  2. Create a new VDI in VirtualBox, boot it, select the Arch .iso as the startup disk

Within five seconds, a root shell is born.

Installation

Initial Preparation (5 min)

  1. Verify Internet Connection: ping google.com
  2. Update System Clock: timedatectl set-ntp true
  3. Identify the “hard drive”: lsblk
  4. Open “hard drive” in Parted: parted /dev/sda
  5. Assign a Label: (parted) mklabel msdos
  6. Create Partition: (parted) mkpart primary ext4 1M 100%
  7. Set Boot Flag: (parted) set 1 boot on
  8. Verify Partition: (parted) print
  9. Exit Parted: ctrl+C
  10. Format Partition: mkfs.ext4 /dev/sda1
  11. Mount Partition: mount /dev/sda1 /mnt

Package Installation (5 min of waiting)

  1. Install Base Packages: pacstrap -i /mnt base base-devel
  2. Hit enter, enter, Y

Configuration (5 min)

  1. Generate fstab: genfstab -U /mnt > /mnt/etc/fstab
  2. Change to Root in New System: arch-chroot /mnt /bin/bash
  3. Set Locale: echo "LANG=en_US.UTF-8" > /etc/local.conf
  4. Download Boot Loader: pacman -S grub os-prober
  5. Install Boot Loader: grub-install --target=i386-pc --recheck /dev/sda
  6. Generate Boot Config: grub-mkconfig -o /boot/grub/grub.cfg
  7. Set Some Hostname: echo "myhostname" > /etc/hostname
  8. Get NIC Name: ip link
  9. Autostart Internet Connectivity: systemctl enable dhcpcd@xxx.service
    1. Where xxx is the NIC name from ip link
  10. Set Root Password: passwd
  11. Exit New System: exit
  12. Reboot: reboot
    1. Select option 3 “Boot existing OS” to boot into Arch
    2. Login as root

GUI (10 min, of mostly waiting)

  1. Install OpenGL Drivers
    1. Enable Multilib
      1. Edit the pacman config: vi /etc/pacman.conf
      2. Uncomment the two multilib lines:
       #[multilib]
       #Include = /etc/pacman.d/mirrorlist
      
      1. To:
       [multilib]
       Include = /etc/pacman.d/mirrorlist
      
    2. Update Pacman: pacman -Syu
    3. Install OpenGL: pacman -S mesa-libgl
    4. Install 32 bit OpenGL: pacman -S lib32-mesa-libgl
  2. Install VirtualBox Guest Utilities: pacman -S virtualbox-guest-utils
  3. Install Gnome: pacman -S gnome gnome-extra
    1. Hit enter, enter, enter, enter, Y
  4. Enable GDM: systemctl enable gdm.service
  5. Install Gnome Tweak Tool: pacman -S gnome-tweak-tool
  6. The Final Reboot Before Things Become Civilized: reboot

And that’s all there is to it.