If you are unknown about vagrant :p

According to Vagrant website :-

Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.

Follow up the download and installation instructions in the site. There's pretty good documentation.

I like PHP but not that much that I would take trouble setting up LAMP in my archlinux. So, I used vagrant which is one of the easiest way. Wondering around github and I found this repo by mattandersen. Thanks man!

Simply I cloned the repo in my computer.

git clone [email protected]:mattandersen/vagrant-lamp.git

Now, I just cd into vagrant-lamp folder and start vagrant and let it do it's work..

vagrant up

I watched a movie while vagrant did it's work. First of all it downloads the virtual box image and so on and on….. If you want to change how vagrant do its work, change the Vagrantfile or provision.sh file which is a bash script file.

When everything was complete i just needed to browse into http://localhost:8888 and apache server was up and running. Now , where do i keep my source code ? Then, what mattandersen did was kept a folder name src in the vagrant-lamp (It's the folder you might be currently on ) and the server inside the box was hosting the code from that folder. Of course this can be changed into anything else by editing the Vagrantfile.

I was thinking to test and edit some of the projects but did not want to copy all my projects to that src folder. So , I edited the Vagrantfile to change the synced folder config.

config.vm.synced_folder "/path/to/my/projects" "/vagrant/src/projects"

Now , to view the web app in the browser i would just provide the path of the project with http://localhost:8888/projects. Just edit the Vagrantfile if you want to change the port. And that's it, I was able to run my projects and test them easily.

To install phpMyadmin in the box i just ssh into it. From that vagrant-lamp folder:

vagrant ssh

Then install phpmyadmin

sudo apt install phpmyadmin

Then choose apache during the phpmyadmin installation process.And that's it you are now able to login to phpmyadmin interface by simply browsing to http://localhost:8889/phpmyadmin. The default username and password is root. And , that's it.