Install Vagrant in your operating system
#Build vulnerable VMs#Vagrant Setup
Vagrant
- Vagrant is a tool for building and managing virtual machine environments in a single workflow.
- more info click here
Download
- Head up to this link and download vagrant for your operating system
- After installing you can access it via terminal
- check if it’s downloaded properly vagrant -v
## Setup
- You can install whatever you want
- Go to this link and choose your box

- Also you can select the provider, so vagrant will run it in that provider
- Here I’m going to select Virtual box, because I have installed that in my system

- Let’s download this Box vagrant box add ubuntu/focal64
- Run this command on your terminal to install this box.
- Wait few minutes for the download.
- I’m using Windows as my base machine, Commands are pretty simlar, so don’t worry :)

- Now run these two commands to setup that box
- Before running this commands create two directories mkidr box data
- Now go to box directory
vagrant init ubuntu/focal64
- And run this command

- This command generates a Vagrantfile
- Which you can use to configure the vm size,networks,synced folders and more…
- datafolder has shared files between your Vm and your base machine
- You can put your custom binaries, setup.sh, required files to setup the vulnerable site and more in datafolderconfig.vm.synced_folder "../data", "/vagrant_data"
- Uncomment the above line in Vagrantfile to share those files to your VM
- Also I’m setting a public network to access my VM in local config.vm.network "public_network"
- Uncomment this line to do that :)
- Now time to start this VM

- You can run vagrant upto start your VM
- Now you can simply ssh into this machine using vagrant sshcommand

- Great that’s all, Now you can use this :D

- Here you can see, vargrant uses Virtualbox to host this.

- You can also login into this VM with default credentials
- user: vagrant:vagrant
- root: root:vagrant

- You can shutdown your VM using vagrant halt
- If you want to force shutdown, then use vagrant destroycommand

- Let’s setup our vm with a build script in next article :)
It would be appreciated if you give me a respect+ on HTB