Installing and configuring Vagrant on your own laptop and/or PC may seem complicated, but it is not at all.
To get Vagrant working, you need to perform 7 steps. I have described these 7 steps below. I myself work with Vagrant within Windows. Hopefully I have described all steps for MACos correctly. If not, please let me know !
I make the assumption that VMware Workstation Pro or VMware Fusion Pro is installed. If not, this should be done first. VMware Workstation Pro and VMWare Fusion Pro is now free for personal use. So that shouldn't be a problem.
VMWare Workstation 17.6 Pro for Windows Download
VMware Workstation 17.6 Pro for Linux Download
VMware Fusion 13.6 Pro for MACos Download
Download Vagrant 2.4.3 Download
Download Vagrant VMware Plugin Download
Download Vagrant 2.4.3 Download
Download Vagrant VMware Plugin Download
Install Vagrant 2.4.3 and reboot your laptop or PC (don't skip the reboot!]
Just click Next, Next, Finish during the installation (default settings).
Install Vagrant VMware Plugin (this time no reboot is needed !)
Just click Next, Next, Finish during the installation.
Start Terminal
setx /M VAGRANT_DEFAULT_PROVIDER "vmware_desktop"
setx /M VAGRANT_EXPERIMENTAL "1"
setx /M VAGRANT_SUPPRESS_GO_EXPERIMENTAL_WARNING "1"
setx /M VAGRANT_VAGRANTFILE "Vagrantfile-latest.rb"
exitConfigure VMWare Workstation PRO (or Fusion PRO) to be the default hypervisor for the virtual machines.
I want to use the latest options of Vagrant, so i set the Experimental settings to ON using 1.
The default name of the vagrantfile is set to Vagrantfile-latest.rb.
It is very important to close the terminal. Otherwise the settings are not loaded !
setx VAGRANT_CWD "C:\Users\ [your username] "
setx VAGRANT_VMWARE_CLONE_DIRECTORY "x:\Directory of your choice where virtual machines should be stored"
setx VAGRANT_HOME "x:\Directory of your choice where Vagrant stores the settings and downloaded boxes"
exitThe VAGRANT_CWD is the location where VAGRANT searches for the vagrantfile (the configuration file for Vagrant).
The VAGRANT_VMWARE_CLONE_DIRECTORY is the location where VAGRANT stores the created virtual machines by Vagrant.
Examples:
setx VAGRANT_CWD "C:\Users\John" (I use my standard user directory for this)
setx VAGRANT_VMWARE_CLONE_DIRECTORY "D:\VirtualMachines\Vagrant" (I want to store the virtual machines on drive D:)
It is very important to close the terminal. Otherwise the settings are not loaded !
More information at Vagrant Docs
del %userprofile%\Vagrantfile-latest.rb
vagrant init
exitvagrant plugin install vagrant-vmware-desktop
exitTerminal must be closed to load the environment variables
Download My Custom Vagrantfile.
Put this file in the folder Downloads (Windows).
Remove the default vagrantfile
del %HOMEDRIVE%\vagrantfil*.*
exitReplace the default vagrantfile with the one i created
copy %HOMEDRIVE%\Downloads\Vagrantfile-latest.rb %HOMEDRIVE%
exitdel ~/vagrant.d/vagrantfil*.*
exit! DON'T FORGET !
Store the custom vagrantfile (Vagrantfile-latest.rb) in ~/vagrant.d/
vagrant global-status
exitThe message should be:
There are no active Vagrant environments on this computer!
Or, you haven't destroyed and recreated Vagrant environments that were started with an older version of Vagrant.
Start terminal
vagrant box add gusztavvargadr/ubuntu-server-2404-lts --clean --provider vmware_desktop
vagrant box add gusztavvargadr/ubuntu-desktop-2404-lts --clean --provider vmware_desktop
exitThe Linux boxes use about 4 gigabyte of diskspace per box.
Start terminal
vagrant box add xenov/windows-10 --clean --architecture amd64 --provider vmware_desktop --box-version 2202.1740574724
vagrant box add gusztavvargadr/windows-11 --clean --architecture amd64 --provider vmware_desktop
vagrant box add gusztavvargadr/windows-server-2022-standard --clean --architecture amd64 --provider vmware_desktop --box-version 2102.0.2503
exitEach box takes about 5 to 10 minutes to download and install ! Time for a drink .. or snack .. or both !
The Windows boxes use about 15 gigabyte of diskspace per box.
That was it then. You're all set with the installation and configuration of the environment.
Let's start the fun !
vagrant up U24-LTS-S-BCV-XL-001vagrant up U24-LTS-S-DCKR-001
vagrant ssh U24-LTS-S-DCKR-001
sudo ~/ubuntu-config-V3-latest.sh docker
exit
vagrant ssh U24-LTS-S-DCKR-001
docker stop portainer
docker start portainer
ip addr show eth0The ubuntu-config-V3-latest.sh script does the installation of the latest version of Docker within the box.
Start your webbrowser and go to https://xxx.xxx.xxx.xxx:9443 (use the ip address from ETH0:)
For the password use something simple like Password1234
Use pwsh to start Microsoft Powershell 7.5.x within the box.
Want to use Cockpit ? The go to https://xxx.xxx.xxx.xxx:1234 (use the ip address from ETH0:)
vagrant up W10-ENT-D-B-XV-L001Go to VMWare Workstation and login with the user vagrant and password vagrant
Right click on the START button and select Windows Powershell(Admin)
cmd
winget update
Y
winget install Microsoft.PowerShell
winget install Microsoft.DotNet.DesktopRuntime.8
winget install Microsoft.WindowsTerminal
winget install Microsoft.VisualStudio.Code
winget install GNU.Nano
exit
exitvagrant up W22-STD-S-B-GR-L001Powershell 7 can also be installed within the Windows Server 2022 Standard virtual machine.
Follow the instructions as described above under Windows 10.
For Example:
vagrant ssh W10-ENT-D-B-XV-L001
vagrant ssh W22-STD-S-B-GR-L001For Example:
vagrant halt W10-ENT-D-B-XV-L001
vagrant halt W22-STD-S-B-GR-L001For Example:
vagrant halt W10-ENT-D-B-XV-L001
vagrant destroy W10-ENT-D-B-XV-L001 --forceMore information on Vagrant configuration files can be found on Vagrant docs
- Vagrant by Hashicorp Inc. (hashicorp.com)
- Virtualbox by Oracle Corporation (oracle.com)
- VMware by VMware Company (vmware.com) / Broadcom (broadcom.com)
- Windows by Microsoft Corporation (microsoft.com)
Everything I describe is intended for personal or educational use. In my case, that is primarily educational use.
All references to and quotations from external sources are licensed and/or copyright the respective owners. I make no claim to ownership of these sources. References to and quotations from these sources have been used on the basis of assumption of reasonableness and fair use. To my knowledge, no copyright or other rights have been infringed. If it is believed that references to and/or quotations from certain external sources violate any rules, rights or interests, please contact.