Proxmox Arch VM install

For security I wanted to expose a VM on Proxmox to the web rather than a container. Ubuntu is rather heavy, so I settled on an Arch Linux VM.

Easiest way to install Arch - a prebuilt qcow2 file!

This takes a just a couple minutes and requires minimal thought and effort... but the hard drive will be 40GB. If that's a dealbreaker see below on how to install your own instance of Arch.

  1. Download the basic qcow2 image from https://gitlab.archlinux.org/archlinux/arch-boxes/-/jobs/106936/artifacts/browse/output to your Proxmox server
    e.g., wget https://gitlab.archlinux.org/archlinux/arch-boxes/-/jobs/106936/artifacts/raw/output/Arch-Linux-x86_64-basic-20221201.106936.qcow2?inline=false
  2. In the PRoxmox GUS Click Create: VM
  3. On the OS Selection page choose "Do not use any media"
  4. Continue the VM creation flow
  5. Once complete, go to the Hardware tab and select the hard drive - remove it!
  6. From the terminal run (where 134 is the appropriate instance id and local-zfs the location you want the virtual drive stored).
    qm importdisk 134 Arch-Linux-x86_64-basic-20221105.99990.qcow2 local-zfs
  7. Start the VM and log in with the username/password arch/arch

Harder but more flexible: Install your own instance of Arch

Download the Arch installable iso

  1. Create: VM
  2. Select a disk size of whatever you want (but at the very least 2 GiB - I'd suggest something like 6 GiB so you have some flexibility if you don't expect to need a lot of space.
  3. Select at least 750 MB ram (while 512M should work, I receive an error "Waiting 30 seconds for device....device did not show up..."
  4. Select the Arch iso as an attached disk
  5. Once the bootable iso boots run:
    cfdisk /dev/sda
    then run the following commands (note we're installing a Bootable

> dos
> hit "Enter" on free space
> hit new > (continue using the remainder of the disk) 
> primary
> left arrow to Bootable
> Enter on Bootable (should now see an asterisk in the table under "Boot")
> write > yes > quit
Partitioning the disk

6. to confirm, you can run lsblk to see your partitions

mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt
Format and mount the new partition

7. update package lists

pacman -Syy
Update package lists

8. Install needed packages to your new virtual hard drive

pacstrap /mnt base linux linux-firmware sudo nano openssh networkmanager grub os-prober mtools
Install arch on new partition
# OPTIONAL: if you run into an error about invalid keys then make sure you have up to date keys
pacman -Sy archlinux-keyring

pacstrap /mnt base linux linux-firmware sudo nano openssh networkmanager grub os-prober mtools
OPTIONAL (Only if you run into an issue with keys)

9. Create the fstab

genfstab -U /mnt >> /mnt/etc/fstab
Create fstab

10. Change root to /mnt so you can configure your new system

arch-chroot /mnt
Treat your new partition as root for install

11. Configure and install grub (again, this is WITHIN chroot session)

grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Configure and install grub

12. Set the root password and create your own user (if you want)

# set your own root password
passwd

#create a new user and set it's password
useradd -m -G wheel myuser
passwd myuser
Set root password and create a new user

13. Enable NetworkManager so  you have internet access once you reboot

systemctl enable NetworkManager
exit and then reboot! 

13. Exit chroot and shutdown

exit

shutdown
exit and then reboot! 

14. Remove the arch install CD (iso) and start up the new VM!

After install you might be able to lower memory to even 300MB!