Logo

dev-resources.site

for different kinds of informations.

Run Vagrant VMs in a M1/M2/M3 Apple Sillicon Chip

Published at
2/18/2024
Categories
vagrant
hashicorp
mac
vmware
Author
houssambourkane
Categories
4 categories in total
vagrant
open
hashicorp
open
mac
open
vmware
open
Author
15 person written this
houssambourkane
open
Run Vagrant VMs in a M1/M2/M3 Apple Sillicon Chip

If you're a Mac user equipped with an Apple Silicon chip (M1/M2/M3...) and facing challenges setting up a Vagrant infrastructure due to the lack of supported hypervisors, this tutorial is tailored for you. It will guide you through configuring Vagrant to run using VMware Fusion technology as a hypervisor. Simply follow the steps outlined, and should you encounter any issues along the way, feel free to reach out to me for assistance.

Step 1: Install Rosetta

/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Enter fullscreen mode Exit fullscreen mode

Step 2: Install VMware Fusion tech (you will have to create a VMware account)

https://customerconnect.vmware.com/downloads/get-download?downloadGroup=FUS-TP2023
Enter fullscreen mode Exit fullscreen mode

You may also need to provide a license key, you can opt for the free one.

Step 3: Create a symbolic link

ln -s /Applications/VMWare\ Fusion\ Tech\ Preview.app /Applications/VMWare\ Fusion.app
Enter fullscreen mode Exit fullscreen mode

Step 4: Install vagrant (on MacOS)

brew tap hashicorp/tap
brew install hashicorp/tap/hashicorp-vagrant
Enter fullscreen mode Exit fullscreen mode

Step 5: Install vagrant vmware utility

https://releases.hashicorp.com/vagrant-vmware-utility/1.0.22/vagrant-vmware-utility_1.0.22_darwin_amd64.dmg
Enter fullscreen mode Exit fullscreen mode

Step 6: Install vagrant plugin

vagrant plugin install vagrant-vmware-desktop
Enter fullscreen mode Exit fullscreen mode

Step 7: Create a Vagrantfile

This configuration will create 2 VMs (master and slave)

mkdir vagrant-project
cd vagrant-project
touch Vagrantfile
cat << EOF > Vagrantfile
Vagrant.configure("2") do |config|
    config.vm.define "master" do |master|
        master.vm.box = "spox/ubuntu-arm" 
        master.vm.box_version = "1.0.0"
        master.vm.hostname = 'master'
        master.vm.provision "docker"

        master.vm.network :private_network, ip: "192.168.56.101"

        master.vm.provider "vmware_desktop" do |v|
            v.allowlist_verified = true
            v.gui = false
            v.vmx["memsize"] = "2048"
            v.vmx["numvcpus"] = "2"
      end
    end

    config.vm.define "slave" do |slave|
        slave.vm.box = "spox/ubuntu-arm" 
        slave.vm.box_version = "1.0.0"
        slave.vm.hostname = 'slave'
        slave.vm.provision "docker"

        slave.vm.network :private_network, ip: "192.168.56.102"

        slave.vm.provider "vmware_desktop" do |v|
            v.allowlist_verified = true
            v.gui = false
            v.vmx["memsize"] = "2048"
            v.vmx["numvcpus"] = "2"
      end
    end
  end
EOF
Enter fullscreen mode Exit fullscreen mode

Note: gui parameter is mandatory

Step 8: Now you can run the vagrant program

vagrant up
Enter fullscreen mode Exit fullscreen mode

Additional commands

Check the status of the VMs
vagrant status
Enter fullscreen mode Exit fullscreen mode
Connect to the VMs
vagrant ssh <hostname>
Enter fullscreen mode Exit fullscreen mode

In our example we can use either

vagrant ssh master
Enter fullscreen mode Exit fullscreen mode

Or

vagrant ssh slave
Enter fullscreen mode Exit fullscreen mode
Stop the VMs
vagrant halt
Enter fullscreen mode Exit fullscreen mode
Delete the VMs
vagrant destroy
Enter fullscreen mode Exit fullscreen mode
hashicorp Article's
30 articles in total
Favicon
What is HashiCorp Vault? Features, Benefits, and Know How Does it Work
Favicon
Nomad 101: The Simpler, Smarter Way to Orchestrate Applications
Favicon
Vault Secret Engines: A Guide to HashiCorp Vault's Path to Secure Secrets Management
Favicon
HashiCorp Vault: Unlocking the Essentials of Secrets Management
Favicon
S3 Cross region replication with Terraform stacks
Favicon
Two Years in the Vault: 4 Best Practices 🔒
Favicon
Terraform Authoring and Operations Professional certification
Favicon
Managing Terraform State for AWS workloads with v1.10.0-beta1
Favicon
[Top-2024]! HashiCorp Terraform-Associate-003 Practice Exam To Prepare Yourself
Favicon
Vault CLI in Containers
Favicon
Introduction to Vault
Favicon
What is HashiCorp Vault?
Favicon
Mastering Terraform testing, a layered approach to testing complex infrastructure
Favicon
Hashicorp Boundary with Azure SQL Server
Favicon
Centralized TLS Certificate Management with HashiCorp Vault PKI and Cert Manager
Favicon
Run Vagrant VMs in a M1/M2/M3 Apple Sillicon Chip
Favicon
Terraform Cloud Agents - Podman
Favicon
The Reluctant Software Developer: Contributing to HashiCorp Vault
Favicon
Terraform is making my day impossible
Favicon
Deploy a HashiCorp Vault in Minutes using Spheron Compute
Favicon
Mastering Terraform: Best Practices for Scalable, Secure, and Reliable Infrastructure as Code
Favicon
Test permutations with Terraform and GitHub Actions
Favicon
Terraform Cloud Project Bootcamp with Andrew Brown - Creating a command alias
Favicon
Testing Framework in Terraform 1.6: A deep-dive
Favicon
Terraform Cloud Project Bootcamp with Andrew Brown - Configuring Terraform & AWS CLI on Gitpod
Favicon
Terraform Cloud Project Bootcamp with Andrew Brown - Week 0, 1 & 2 Journal
Favicon
Infrastructure as Code - HashiCorp Terraform
Favicon
What is HashiCorp Terraform?
Favicon
HashiCorp Developer AI
Favicon
A Comprehensive Guide to Testing in Terraform: Keep your tests, validations, checks, and policies in order

Featured ones: