Arch Linux installation note

The Installation guide is useful.

This installation note will do install minimal things can let a VirtualBox virtual machine runs.

You will need an Oracle VirtualBox, some disk spaces, and, of course, an Arch Linux ISO.

Before install

In Oracle VirtualBox, the default booting mode for a virtual machine is, BIOS unless EFI mode enabled(which will not be introduced in this article).

Add the Arch Linux ISO file to the virtual machine we just created. After seeing a command line, type following commands:

ping archlinux.org # To confirm that the virtual machine can link to the Internet.
timedatectl set-ntp true # To enable NTP which set the clock automatically.

Set partitions

As the virtual machine uses BIOS, we need to have a MBR table. Type fdisk -l to check the disk partitions, then use cfdisk to make a partition. In cfdisk, choose dos if we want to make an MBR table.

The most important things for cfdisk are:

  1. Have a swap partition with Linux swap/Solaris type.
  2. Have a bootable main partition with Linux type.
  3. Write this partition table to the disk.

Type fdisk -l to check the disk partitions again. You should watch at least two partitions: One is swap and the other one is the main data.

When everything's fine, format the disk now:

mkfs.ext4 /dev/root_partition
mkswap /dev/swap_partition

Install

Mount

To let the ISO know where should software installed, we need to mount.

swapon /dev/swap_partition
mount /dev/root_partition /mnt

The disk is now ready to install.

Install packages

Install packages to our mounting point:

pacstrap /mnt base linux linux-firmware vim man-db man-pages dhcpcd

Configure

Now we need to set some configs.

genfstab -U /mnt >> /mnt/etc/fstab # Decide mounting stuffs I guess
arch-chroot /mnt # Change root into the new system by the manual
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime # Set timezone to Asia/Taipei
hwclock --systohc # Set the clock
passwd # Add a password to the user root

Make a boot loader: GRUB

A boot loader will inform the OS how to turn our computer on.

Before approaching, you know we are still using MBR, right?

pacman -S grub
fdisk -l
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Reboot

Finally! we can shutdown or reboot, then check our Arch Linux.

If the Arch Linux working successfully, good; Otherwise, we will need to access by ISO to troubleshoot.

What if the installation failed

Assume that we still have the ISO disk file.

  1. Boot from CD
  2. mount /dev/root_partition /mnt. If fails, the problem is from the partition setting.
  3. arch-chroot /mnt.
  4. Check if there's something missed. Mostly I fail on the boot loader.