How to create a CentOS 7 Virtual Machine on Windows using Vagrant

Share on:

Vagrant is an open-source command-line tool for creating and managing virtual machine environments. Although virtualization can be time-consuming, especially with open-source software, using Vagrant and VirtualBox can help you virtualize more efficiently and save time.

In this blog, I have outlined the procedures to create a CentOS 7 virtual machine without the need for operating system installation procedures.



The following prerequisites must be met before proceeding with the steps to create a CentOS 7 Virtual Machine using Vagrant:

  • VirtualBox is installed on your Windows Machine
  • Windows 10/x64 Operating System


1. Download and execute the Vagrant 2.4.0 for Windows from Google.



2. Accept the user license agreement and click next



3. Wait for the installation to complete




4. Create a directory to store the Vagrant files. 

I created a vagrant directory on C:\Users\workuser\.


5. Add the CentOS7 image to the local Vagrant Environment. 

Change to the newly created directory and execute “vagrant box add centos/7” to download the CentOS7 image. 



6. Run the Vagrant init command

This command initializes the CentOS7 image OS from the repository that has been downloaded in step 5.



7. Modify the vagrant file 

Edit the newly created Vagrant File and add the following entry. Ensure that the IP address is in the same subnet as the network interface of your existing VirtualBox setup. Specify the desired hostname; in this demo, I have used “oracleprem” as the hostname of my VM. Also, indicate the provider and the amount of memory to be used.



8. Update the /etc/hosts file with the IP address



9. Bring up the CentOS7 virtual machine. 

Execute the “vagrant up” command from the command prompt to configure and start the VM.



10. Confirm that the CentOS7 is running on the VirtualBox.

Check on the Virtual box interface and you will see the newly created CentOS7 virtual machine.



11. Confirm that the CentOS7 VM is reachable.

Ping the IP address of the newly created CentOS7 VM to confirm that it is reachable.



12. Connect to the CentOS7 Virtual Machine from the command prompt. 

From the command prompt, run “vagrant ssh” to log in to the newly created VM.



13. Switch to Root User 

You can execute “sudo su –” from the vagrant user to switch to the root user. 


Share on:

More from this Author

How to Delete Older Kernel Versions in Red Hat Enterprise Linux (RHEL)

How to Delete Older Kernel Versions in Red Hat Enterprise Linux (RHEL)

In Oracle Red Hat Enterprise Linux (RHEL), the conventional method for removing old kernels involves using the yum package manager. Here are the ... Read More


How to resolve ORA-19751: Could not create the change tracking file error after RMAN Restore and Recovery

The following steps can be taken to address the “ORA-19751: could not create the change tracking file” error when attempting to open the ... Read More

Back to Top