Skip to content

Instantly share code, notes, and snippets.

@1eedaegon
Last active May 20, 2024 04:02
Show Gist options
  • Save 1eedaegon/6a5a2ab64f09b0800eadf3f84dad96f8 to your computer and use it in GitHub Desktop.
Save 1eedaegon/6a5a2ab64f09b0800eadf3f84dad96f8 to your computer and use it in GitHub Desktop.
Install vagrant with vmware for windows 11
# 1. Download and install go
https://golang.org/doc/install
# 2. Download and install VMware workstation player
https://www.vmware.com/products/workstation-player.html
# 3. Download and install vagrant
https://www.vagrantup.com/downloads
# 4. Download vagrant vmware utility
https://developer.hashicorp.com/vagrant/downloads/vmware
# 5. Install vagrant-vmware-desktop
vagrant plugin install vagrant-vmware-desktop
# 6. Update vagrant-vmware-desktop
vagrant plugin update vagrant-vmware-desktop
# 7. Start service vagrant-vmware-desktop(Need administrator)
net.exe start vagrant-vmware-utility
# 8. Vagrant init and make vagrantfile with failure
cd [ANY_YOU_WANT]
vagrant init
# 9. Install base box
vagrant box add hashicorp/bionic64
PS C:\Users\[CUSTOM_PATH]> vagrant box add hashicorp/bionic64
==> box: Loading metadata for box 'hashicorp/bionic64'
box: URL: https://vagrantcloud.com/hashicorp/bionic64
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) virtualbox
3) vmware_desktop
Enter your choice: 3
==> box: Adding box 'hashicorp/bionic64' (v1.0.282) for provider: vmware_desktop
box: Downloading: https://vagrantcloud.com/hashicorp/boxes/bionic64/versions/1.0.282/providers/vmware_desktop.box
box:
==> box: Successfully added box 'hashicorp/bionic64' (v1.0.282) for 'vmware_desktop'!
# 10. Edit vagrant file
# Edit this: config.vm.box = "hashicorp/bionic64"
# 11. Vagrant up
vagrant up --provider vmware_desktop
# 12. Check VM is running
vagrant status
Current machine states:
default running (vmware_desktop)
# 13. Connect to VM
vagrant ssh
vagrant@vagrant:~$
# 14. Happy linux
grep . /etc/*-release
@NL-TCH
Copy link

NL-TCH commented Jan 17, 2023

4. Download vagrant vmware utility

https://developer.hashicorp.com/vagrant/downloads/vmware

This is the new link, the old one does not work

@1eedaegon
Copy link
Author

4. Download vagrant vmware utility

https://developer.hashicorp.com/vagrant/downloads/vmware

This is the new link, the old one does not work

@NL-TCH
Thanks for your comment.
I fixed it. 😊

@adamiro
Copy link

adamiro commented Sep 28, 2023

Thanks for posting this. So Im am trying to install vagrant to allow me provision 3 virtual machines. By default the instructions is to use oracle virtual box. I have a paid version of VMware Workstation Pro 17. im new to all of this but my question is, is this set of instruction current and can it do the job im looking for?

@1eedaegon
Copy link
Author

Here is a RHEL image and a virtualbox, but you can apply it in Oracle + Vmware by looking at the image name and network settings.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Base Image
BOX_IMAGE = "rhel8.6-4.18.0-372"
BOX_VERSION = "0"
#BOX_IMAGE = "ubuntu/focal64"
#BOX_VERSION = "20220315.0.0"

# max number of Worker nodes
N = 3

Vagrant.configure("2") do |config|
#-----Bastion Node
    config.vm.define "Bastion" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--groups", "/closed-network"]
        v.name = "Bastion"
        v.memory = 1024
        v.cpus = 1
        v.linked_clone = true
      end
      subconfig.vm.hostname = "Bastion"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.56.254"
      subconfig.vm.network "forwarded_port", guest: 22, host: 50000, auto_correct: true, id: "ssh"
    end

#-----Single Node
    config.vm.define "Single" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--groups", "/closed-network"]
        v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
        v.name = "Single"
        v.memory = 4096
        v.cpus = 2
        v.linked_clone = true
      end
      subconfig.vm.hostname = "Single"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.56.20", virtualbox__intnet: true
      subconfig.vm.provision "shell", run: "always", inline: "route del default"
      subconfig.vm.provision "shell", run: "always", inline: "route add default gw 192.168.56.254"
    end

#-----Controlplane Node
    config.vm.define "Controlplane" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--groups", "/closed-network"]
        v.name = "Controlplane"
        v.memory = 2048
        v.cpus = 2
        v.linked_clone = true
      end
      subconfig.vm.hostname = "Controlplane"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.56.10", virtualbox__intnet: true
      subconfig.vm.provision "shell", run: "always", inline: "route del default"
      subconfig.vm.provision "shell", run: "always", inline: "route add default gw 192.168.56.254"
    end

#-----Worker Node Subnet1
  (1..N).each do |i|
    config.vm.define "Worker-#{i}" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.vm.box_version = BOX_VERSION
      subconfig.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--groups", "/closed-network"]
        v.name = "Worker-#{i}"
        v.memory = 4096
        v.cpus = 2
        v.linked_clone = true
      end
      subconfig.vm.hostname = "Worker-#{i}"
      subconfig.vm.synced_folder "./", "/vagrant", disabled: true
      subconfig.vm.network "private_network", ip: "192.168.56.1#{i}", virtualbox__intnet: true
      subconfig.vm.provision "shell", run: "always", inline: "route del default"
      subconfig.vm.provision "shell", run: "always", inline: "route add default gw 192.168.56.254"
    end
  end

end

@adamiro
Copy link

adamiro commented Sep 29, 2023

Thanks for your prompt response. I was able to to find a file generator online and I think I should be able to build upon that file from what I am learning thus far. I will most likely update on here as I progress. As mentioned, I am new to all of this and it can be overwhelming at times but im not giving up. I think this is the best way to learn and im loving the challenge.

To be clear when I am trying to do is provision 3 VM for a Kubernetes cluster that will include a single 1 master node and 2 worker nodes. The instructions I have is to use virtual box but I want to use VMware workstation but I noticed that I also have to install some utility and plugin. I think the first part is to spin up the VM and instead spinning them up manually, I want to have the hands ion experience to install them with a vagrant file.

I will most likely be documenting my progress on my profile and share the information with anyone that's interested.

Thanks for your help.

@1eedaegon
Copy link
Author

I hope this answer helps you on your journey, good luck 👍

@adamiro
Copy link

adamiro commented Sep 29, 2023

I was able to figure it out eventually. I’m surprised there are not many videos or materials out there to explain the process. I saw a video and it discussed using chocolates, downloading it and doing some crazy stuff another one discussed using brewers or some name like that but I didn’t have to go through all that.

I’m going to write a blog to document it and so that people can use it should in case they want to stick to VMware workstation pro 17 as the provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment