Setting up a VM on Mac OS M1/M2/M3 has been a bit of a challenge. To save you some time, I'll provide a streamlined method that I’ve refined through my own experience.
We're setting up a basic virtual machine (VM) using two essential tools:
VMware Fusion: This hypervisor will allow us to run and maintain the VM. While it provides the necessary environment, using VMware Fusion alone means you'll need to handle the setup and configuration manually.
Vagrant: This automation tool simplifies the process of configuring and managing VMs, streamlining your workflow.
Operating System Choices for the VM
Ubuntu: A user-friendly Linux distribution.
CentOS/Fedora: Reliable Linux distributions, with CentOS known for stability and Fedora for its cutting-edge features.
Follow the steps below to create your VM.
Install rosetta - its a tool which helps you run x86 based apps on arm CPU
Open terminal and execute below command
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Install vagrant with homebrew - Automation Tool.
Open terminal and execute below command brew
install vagrant
Create an account on Broadcom Open the link in the browser and click on register. https://support.broadcom.com
VMware was acquired by Broadcom, so all the tools we need to get it from here only.
After logging in, on the left side of the navbar click on - VMware Cloud Foundation
Click on My Downloads, and select VMware Fusion>Select VMware Fusion 13 Pro for Personal Use>Download. PS. make sure you select the T&C.
Complete the download.
Make sure you give it the Accessibility access.
-
Now we need to download some Plugins
Installing vagrant VMware provider - So that Vagrant knows that we need to use these VMware tools.
Open terminal and execute below command
brew install --cask vagrant-vmware-utility
Install vmware plugin for vagrant
Open terminal and execute below command.
vagrant plugin install vagrant-vmware-desktop
Create folder for ubuntu vm
Open terminal and execute below command.
mkdir -p Desktop/vms/ubuntu
cd Desktop/vms/ubuntu
Create a Vagrant file
vim vagrantfile
Click on button ‘i’, to get into insert mode of the file.
Now just Copy Paste the below comands
Vagrant.configure("2") do |config|
config.vm.box
= "spox/ubuntu-arm"
config.vm.box
_version = "1.0.0"
config.vm.network
"private_network", ip: "192.168.56.11"
config.vm.provider "vmware_desktop" do |vmware|
vmware.gui = true
vmware.allowlist_verified = true
end
end
and then hit ‘esc’, write ‘:wq’, and hit ‘enter’ - this will save and exit.
Bring up vm Make sure in the terminal, you are in the same folder where Vagrantfile is created.
vagrant up
Entering the VM
vagrant ssh
Now exit the VM.
exit
Powering off the VM.
vagrant halt
Destroy the VM.
vagrant destroy
If we want to create the VM again, we can just write vagrant up
, and it will create the VM again.
This should cover everything you need to get your VM up and running smoothly!