The Arch wiki install guide is a well-written, comprehensive guide to installing Arch. However, as it should, it goes in to a variety of possible setups. This guide chooses some hopefully sane defaults, while showing one way to install Arch. This particular one is being done on a FreeBSD vm-bhyve VM, with UEFI boot, 20GB in size, an ext4 file system, and the grub boot loader. It should work on any size Arch install, whether a VM or bare metal.
The first step is getting the latest Arch ISO. A list of download mirrors can be found here. Once you have the ISO, burn it to disk or USB, or if using a VM, just use the file, and start your install.
We're assuming you have an Internet connection on the machine installing Arch. Much of this will follow the installation guide linked above.
Once you boot, you're put into a root shell. First step is to partition the disk. My usual setup, as mentioned, is a 20G VM doing a UEFI install, so, I'll have a 1GB /boot, 1G of swap, and an 18GB partition for root. With FreeBSD's bhyve, a disk's name is /dev/vda, so use whatever name your system gives the disk you plan to use for installation.
fdisk /dev/vda |
You will then be in the fdisk interface. The commands we use are n for new partition, p to choose a primary rather than logical partition, t for toggle the type of partition, and w to write the when we're done.. So, we start with our 1GB /boot partition.
n |
It will ask if you want a primary or logical partition. Hit p for primary. Actually, p is the default so you can just hit enter. Then it will ask you to select a partition and show the default is partition one. Then it will show the default starting position, hit enter to accept. Then it will show the default ending position which is usually the entire disk. You can choose the size by entering something here. We want a 1G /boot, so when it asks for default end position enter
+1G |
Next we want to change the type of partition so hit t to toggle
t |
Again it will ask partition number choose 1, the default. It then asks you to enter the Hex code or alias with the option to type L to list all Hex codes. We can choose 0c for fat 32.
Then, once again hit n, and choose the default. Again, it will ask primary or logical, choose p. These days, on a VM, I usually just use 1G of swap, so it will ask which partition, choose the default of 2, hit enter again to accept the default starting point, and once again, when it asks for ending point use the +1G. (Fdisk will show the option of choosing by size with a +<size><unit>).
Once again we'll toggle the type, so hit t to toggle, choose partition 2 and when asked for the hex code enter 82 for Linux swap.
Lastly we'll use the rest for root. So once more, hit n for new, accept the default for partition 3, make it a primary partition, accept the default starting point and the default ending point which will be the rest of the disk. We don't have to toggle the type because the default is 83, Linux. When done, hit p to print what you have to the console, and if it's what you want, now hit w to write it to disk.
Next we format the partions. First we'll make the boot partition Fat 32 to use it as an EFI partition, then, we'll make swap on /dev/vda2 and lastly format partition 3 as ext4.
mkfs.fat -F 32 /dev/vda1 mkswap /dev/vda2 mkfs.ext4 /dev/vda3 |
Next we mount the partitions.
mount /dev/vda3 /mnt mount --mkdir /dev/vda1 /mnt/boot swapon /dev/vda2 |
Next we'll install the system. These days pacman does a pretty good job of selecting the best mirror, but you can always doublecheck /etc/pacman.d/mirrorlist.
The example I give is for my system and my tastes. I install amd-ucode, if you have Intel, install intel-ucode. I install vi, if you prefer nano, substitute it for vi. I have a standard partition setup with ext4fs, so I install e2fsprogs, but if you're using LVM, or BTRFS, you'll need utilities to manage them. If you don't want the man pages, leave out man-db, man-pages and texinfo. Also, I am choosing dhcpcd, you might choose NetworkManager, and if on wireless, wpa_supplicant or iwd. I include the which command as well, as it's not in the basic linux install. These options are covered more thoroughly in the wiki's guide, under the "Install essential packages" section. So, for my system (and taste) to install what is necessary, no Wayland or X, as this guide is just to get a basic non-GUI Arch install
pacstrap -K /mnt base linux linux-firmware vi which dhcpcd e2fsprogs amd-ucode man-db man-pages texinfo |
Much of the next part is going to be quite similar to the wiki's guide.
Now create the fstab file. I'm using -U, to name partitions by UUID, another option is -L for label.
genfstab -U /mnt >> /mnt/etc/fstab |
When done, check that /mnt/etc/fstab looks correct.
Now we chroot into the system we've created.
arch-chroot /mnt |
First, set the time.
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime |
For example, I'm in the NY area, so I do ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime.
Next we set the locale. There is a file /etc/locale.gen with all available locales. You can edit this file and uncomment the locale you want. If you know it, you could also do, using en_US.UTF-8 as an example
sed -i 's/#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen |
Regardless of what method you use, when done run the command
locale-gen |
There should be info on the screen that it's generating the desired locale(s).
Next, create an /etc/locale.conf file. Again, using en_US.UTF-8 as an example
echo 'LANG=en_US.UTF-8' > /etc/locale.conf |
Next set the hostname. Say you're calling this arch.example.com.
echo 'arch.example.com' > /etc/hostname |
As I use dhcpcd, I will also edit /etc/dhcpcd.conf. You should configure your network, possibly to boot with dhcp, possibly to have a static IP (which is what I do with dcpcd.conf). The arch wiki's link to various networking software is here if you need help deciding what to use. In my case, I setup dhcpcd and set to to run at next boot with systemctl enable dhcpcd.service, which is fine if you choose to use dhcpcd.
Next, set the root password. This is simple just type
passwd |
It will ask you to put in a password and then ask you to input it a second time.
Lastly, we'll install grub.
pacman -S grub efibootmgr |
Install grub.
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=boot |
(if your browser breaks that up, it should be one one line). I use boot as the id rather than the wiki's suggested GRUB to avoid problems with a vm-bhyve VM install. Usually the name shouldn't matter and if you're not using vm-bhyve, you can name the bootloader-id GRUB.
Generate the configuration file.
grub-mkconfig -o /boot/grub/grub.cfg |
As I'll probably spam this artcle on FreeBSD forums, I'll mention here that if using vm-bhyve, to be sure that the install will boot, cd into /boot/EFI/boot and copy grubx4.efi to bootx64.efi. This is ONLY for people running an Arch vm on vm-bhyve. Otherwise, the grub-mkconfig -o command should be sufficient.
For more information about why you should change the name on vm-bhyve see my vm-bhyve page.
Now we can type exit to get out of the chroot and then type reboot to (obviously) reboot the machine.
So that's it for a quick install of Arch Linux. The Arch wiki is an invaluable resource, and has much more detail on installation, but this guide should work for those in a hurry.