Create Multiple Linux Machines using Vagrant

Create Multiple Linux Machines using Vagrant

Any type of demo or learning in the big data area needs multiple machines to be fully configured and setup. The initial setup task of configuring the IPs and connecting all the machines to the internet is fairly laborious and time-consuming.

In this post, I will provide simple step by step instructions on how to have multiple machines fully configured using Vagrant. The below steps have been tried by me on Windows 10 laptop, but the steps should be similar on alternative desktops / laptops.

Pre-Requisites (Software Needed)

You will need the following software to be installed on your desktop/laptop.

Pre-Requisites (Fist Time Setup)

Vagrant First Time Setup ( )

If you are using Windows, please run the below steps on the Dos Command Prompt. Or use the appropriate steps for your Operating System.

  • cmd> mkdir testing-vagrant
  • cmd> cd testing-vagrant
  • cmd> vagrant init

This will create a Vagrantfile . We will replace its contents later.

Create Vagratfile

Place below “Vagrantfile” on any windows folder say c:\testing-vagrant2
Contents of Vagrantfile below:

Vagrant.configure("2") do |config|
## = "bento/centos-7.2"
    config.vm.define "kfdmc1" do |kfdmc1| = "bento/centos-7.2" "private_network", ip:""
        kfdmc1.vm.hostname = "kfdmc1"
        kfdmc1.vm.provider :virtualbox do |vb|
  = "kfdmc1"
                                 vb.memory = 2048
                                 vb.cpus = 1
    config.vm.define "kfdmc2" do |kfdmc2| = "bento/centos-7.2" "private_network", ip:""
        kfdmc2.vm.hostname = "kfdmc2"
        kfdmc2.vm.provider :virtualbox do |vb|
  = "kfdmc2"
                                 vb.memory = 2048
                                 vb.cpus = 1
    config.vm.define "kfdmc3" do |kfdmc3| = "bento/centos-7.2" "private_network", ip:""
        kfdmc3.vm.hostname = "kfdmc3"
        kfdmc3.vm.provider :virtualbox do |vb|
  = "kfdmc3"
                                 vb.memory = 2048
                                 vb.cpus = 1

Start the Vagrant Machines

  • cmd> cd c:\testing-vagrant2
  • cmd> vagrant up

That is it .. vagrant will create the machines and start them up for you

The Machine Details

Please note the below in the machines created as per the details of the vagrantfile

Please note that there are 3 machines created 
Please note that the Memory is 2048 Mb each
Please note that we have assigned 1 CPU to each machine
The hostname of the machines are kfdmc1, kfdmc2 and kfdmc3 as per the vagrantfile
The IP addresses of the machines are,, as per the vagrantfile
We can create more machines if our laptop/desktop has enough RAM
Please leave 4 GB for your host OS – Windows in my case
The Operating System Image used is “centos-7.2


Connect to the Machines using Putty

  • c:\testing-vagrant2> vagrant ssh kfdmc1


  • Use putty to connect to the machines

IP “”
port “22”
Connection Type SSH

  • Alternatively use Putty to connect using

IP “”
port “2222” or something similar
Check the Port details displayed after “vagrant up”
Connection Type SSH

  • UID/Password


Check that you can connect to the Internet

$ ping -c1
$ ping -c1 | grep –color “0% packet loss”

Setup the /etc/ hosts on all the machines so that you can ssh using machine names

# vi /etc/hosts localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 kfdmc1 kfdmc2 kfdmc3


As mentioned earlier speed
You can create, destroy and recreate machines quickly
You will be able to try out with different versions of the operating system
This is just the beginning


Author: Pathik Paul

Webmaster: Ella Paul

One thought on “Create Multiple Linux Machines using Vagrant

Leave a Reply

Your email address will not be published. Required fields are marked *