Customizing a vagrant box

Recently, I got to know an excellent ready virtual machines solution known as Vagrant. The solution I was looking for was that I can create a custom virtual machine and install my development environment on that e.g. LAMP or MEAN so that new developers can easily download that machine and can start work on that straight away.

If we follow default vagrant instructions, we will end up having and Ubuntu virtual machine. My target was to have a Centos 7 machine with Apache, PHP and MySQL.

So I installed a basic Centos 7 virtual machine, the instructions are available on Instead of “hashicorp/precise32”, I choose serveit/centos-7. After adding the box, I installed the required tools, now my machine is ready so it’s time to export my VM as a vagrant box, it is so simple:

We can package a box using command:

That’s it, the above command will will create a VM for virtual box. Now you can delete the existing box using:

Delete the Vagrantfile and can use this new box with the following command:

You can add your distribution to vagrant repo if you want.