Yusuf Khadijat
Posted on May 19, 2023
Creating and Managing VMs manually on platforms such as Virtual box and Vmware workstation can be time consuming, especially when handling multiple VMs at the same time where speed and consistency is required. Automating VM creations using tools like Vagrant makes this process easier and seamless.
In this tutorial, I will be showing you how to set up and create a CentOS7 operating system in your Windows machine with Virtual box and vagrant in minutes!
First, the Prerequisites:
- Ensure you have chocolatey installed on your windows machine. You can install here
- Also, install Virtual Box software on your windows system.
- Install git bash. This will allow us to run Linux commands on our windows system.
Step 1: With Chocolatey installed, we can easily download Vagrant into our system. Open up powershell with administrative privilege, and run the following command:
Step 2: Once Vagrant is installed, Create a directory where your VM will be setup in git bash. Vagrant cloud provides a list of different vagrant boxes. Each box includes an operating system at its base to set up a working environment, while other specialised boxes will have configurations like Laravel, Lamp stacks, Ruby etc already provided. Search for “CentOS7” and select a box with that name. Ensure that the box supports the provider (Virtual box, vmware, hyperv, etc) you are using.
Step 3: In git bash, we will initialise the box
Step 4: Once the box has been initialised, a Vagrantfile that contains the configuration of the centos 7 operating system will be added to our directory. You can also modify the configurations as needed.
Step 5: Once the configurations are good to go, bring up the operating system with vagrant using “vagrant up” command
Here, your Vm is up and running as can be seen on Virtual box:
Step 6: Using “Vagrant ssh”, we will be able to access and interact with the centos 7 machine
You can also use “Vagrant halt” to pause the CentOS VM when not in use and “vagrant destroy” to delete the VM completely.
So there you have it, Techies😎. You can create VMs automatically in minutes with Vagrant🎊.
Thanks for reading! Please leave a comment.
Posted on May 19, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.