Installing, Setting up Vagrant and Run Validation Scripts

Hi Everyone,

Anyone struggling with setting up vagrant or running mongod on vagrant or running validation scripts. Please look at the steps below:

Setting Up Vagrant

  1. To install and setup vagrant/Virtual Box, please go through the docs in the links provided below for detailed process over the respective platforms.

    For Windows users - Windows Vagrant:VBox installation (Jun-2019).pdf (749.0 KB)
    [Last Updated - September, 2019]

    For Linux users - Linux Vagrant:Vbox installation (Jun-2019).pdf (130.7 KB)
    [Last Updated - September, 2019]

    For MacOS users - MacOS Vagrant:Vbox installation (Jun-2019).pdf (128.5 KB)
    [Last Updated - September, 2019]

  2. After you run vagrant ssh as mentioned in the docs above, you will see something like this:

    m103-vagrant-env$ vagrant ssh
    Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-153-generic x86_64)

    <–some text–>
    Swap usage: 0% IP address for eth1: 192.168.103.100

    <–some more text–>
    vagrant@m103:~$

    If you see output like above, then Congratulations you have setup the vagrant environment for this course.

  3. If the IP address(192.168.103.100) mentioned in the above point differs for some reason, then destroy your vagrant using:

    vagrant@m103:~ exit m103-vagrant-env vagrant halt
    m103-vagrant-env$ vagrant destroy

    Then re-provision your vagrant and try and up again as mentioned in the docs. If it still don’t work,
    then don’t hesitate to post on discussion forum.

  4. Now, mongo is already installed in this vagrant box, so you don’t need to do anything. You can check by running:

    vagrant@m103:~$ mongo --version
    
  5. If it asks for password (in Windows mostly), then credentials are:

    username: vagrant
    password: vagrant

RUNNING VALIDATION SCRIPT

  • For first lab: Lab: Setting up the Vagrant Environment , you need to run validate command from your vagrant box i.e after you have ssh into you vagrant as below:

    vagrant@m103:~$ validate_box

  • If by any chance, above command results into error like:

    vagrant@m103:~$ validate_box
    validate_box: command not found

    Run below command from your vagrant box like:

    vagrant@m103:~$ download_validators

    It will download the required validation scripts. If by any bad luck, that too doesn’t work, re-provision vagrant. If it still doesn’t work, then don’t hesitate to post on the discussion forum.

    The validation scripts need to be run from outside the mongo shell but in the vagrant box, it won’t work from your local machine.

For the most common issues faced for setting up vagrant, please look at Chapter 0: Introduction and Setup - Lecture: Troubleshooting the Vagrant Environment for reference.

Still, if you have problems setting up your vagrant, please don’t hesitate to post here!

Happy Learning!

Thanks,
Kanika

6 Likes