Why use Vagrant instead of XAMPP for local development?

Table of Contents

For all PHP developers, setting up a local environment is a common practice. I had been using XMAPP on my Windows laptop for many years and it really limited me from improving my skills.

By enabling a Linux Virtual Machine (VM) for local development process, we gain a lot of benefits

You may never get this done by using XAMPP

And Vagrant was born to make your life with VM extremely easy.

According to vagrant homepage, you will see these introductions

I will not bother you by more text of “why Vagrant” anymore, you can see more detail in Vagrant.com from its author. I know it is not easy for getting a new stuff or concept. I have built a simple “Hello Vagrant”  project that can help you start working with vagrant in some minutes. Please follow the guide below to see how you can replace XAMPP and old bad habits.

Install Vagrant and VirtualBox on Ubuntu

sudo apt-get install virtualbox
sudo apt-get install vagrant

Install Vagrant and VirtualBox on Windows

Install Vagrant and VirtualBox on Mac OS

You can follow this blog to install vagrant on your Mac

Open your terminal and test your vagrant is running

vagrant -v

Install vagrant hostmanager plugin

vagrant plugin install vagrant-hostmanager

Clone hello vagrant project from github

git clone git@github.com:giappv/hello_vagrant.git

Create & Config Virtual Machine

cd hello_vagrant/devops/vagrant
$ vagrant up

You will see this, which is familiar if you install a software on Ubuntu with

apt-get install

After vagrant runs successfully, please visit hellovagrant.dev, take a looks at the screen and more information is there

then you are ready to develop your awesome php projects with Vagrant on Linux environment without using XAMPP anymore.

Last updated: