Start a Project

Vagrant Implementation….!!!

As I told you in my last article I will provide a very simple way that you can follow to get your vagrant machine up and running, Today lets implement it:

Firstly the question is, how to install vagrants?

Open the terminal then go to the root user by typing:

then you have to install VirtualBox by typing:

Installing Vagrant:

Now check the version of your vagrant application by typing:

the output should be “vagrant 1.7.4”

Note:- “If you get the lower version of vagrant then upgrade it to 1.7.4, otherwise, your vagrant file will not work perfectly”

To get the latest version, you need to download its updated package on the mentioned site below:

https://www.vagrantup.com/downloads.html

I am using ubuntu 14.04. So I have downloaded the Debian package and now let’s install the updated package by typing:


Now check the version:

The output should be 1.7.4

Now let’s get the vagrant box from its official site:

http://www.vagrantbox.es/

Now copy the URL of the box which you want to download then hit the command on the terminal:

After downloading this box, you will have to come back to your user.

Note:-  If you will create your machine from the root user, then you will not get the UI of your machine in VirtualBox.

Now let’s create a directory in which you will create your machine by typing:

Now we will enter in the directory ‘what you just made’ by typing:

Let’s initialize the vagrant by typing:

Now check your directory by typing the “ls” command, you will see a file named Vagrantfile.

Just open it with your editor, I will open it with nano editor by typing:

Now search the line named config.vm.box = “base” and change that base word with your box_name that you gave at the time of downloading the vagrant box.

Now in the next line, add your username & password by typing:

Note:- You can keep your username & password by your choice, I kept vagrant because its default… 🙂

Now let’s give the IP address to your machine.

Find out the line “config.vm.network public_network”, firstly uncomment this line and then modify this line and it should be like this:

config.vm.network “public_network”, ip: “YOUR_IP_ADDRESS”

Now save this file and exit…!!!

Now let’s get your vagrant box up by typing:

After getting it up, access your machine by typing:

and now check your virtual box, you will get the GUI of your machine there. Similarly, you can create your machine in just a few steps how much you want….:)

Now if you want to destroy your vagrant box, hit the command:

To halt your machine type:

Restart your machine type:

To check your currently running machines, type:

Check the total number of vagrant machines that you have in your system type:

Now let’s talk about the backup of your machine box.

Yes, You can take a backup of your vagrant machine for the future, if your os gets corrupted, reinstalled, or upgraded, then your machine will not get corrupted and You will not lose your pre-installed application, for this, you just need to take a backup of your machine by typing:

Firstly shut down the machine.

To do that go to the directory in which you initialized your vagrant machine and then shut down thE machine by typing:

Now copy the name of your vagrant machine.

To know the name of your machine type:

It will show the name and UID of your all VM machine.

Now copy the name of your vagrant machine whose you want to take backup and then type:

after this command, you will get your virtual machine’s backup box now you can keep it anywhere in your local, in your cloud and the next time you will run it, you will have to give the path of this box in your vagrant file and then your vagrant machine will be ready to use.

FOR ANY TYPE OF QUERY OR HELP, KINDLY CONTACT US

Exit mobile version