Routing Vagrant


I'm starting with Vagrant and I think I'm a bit lost.

I tell you the scenario, to see if you can guide me in a correct way.

2 environments with 2 online machines:

  • staging
  • production

These 2 machines have GIT installed.

We are 4 users to work with a Vagrant with Ubuntu 14.04 with LAMP installed.

The idea is to map a local folder to be displayed by port 8080 to work with localhost: 8080

How do I create a box with Ubuntu + LAMP and to provision each Vagrant of each user with said box?

How can I include in the Vagrant config the ss-key of each user so that they can upload via GIT to remote staging + production machines?

I do not know how to enforce this config .. if with YAML or in the Vagrantfile.

Thank you.

asked by Marc Torres 13.02.2017 в 17:16

1 answer


To create a box with Ubuntu + LAMP I suggest you use the box of Ubuntu maintained by > Ubuntu , for example:


... and in the provision section execute the missing steps to have the LAMP :

export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install apache2 libapache2-mod-php mysql-server

In this way, the image is maintained Ubuntu and you always install the latest version of the packages at the start of your development journey.

The codes of the application can be found in the host under a sub-directory where your Vagranfile is, for example, app/ and it will remain within the VM in /vagrant/app that you can sym-link to DocumentRoot from Apache :

rm -R /var/www/hmtl 
ln -s /vagrant/app /var/www/html

... and you can work with your editing tools ( IDE , GIT , etc.) that you have on your host; it is the idea of Vagrant : That you work and program in the environment and known tools, being Vagrant a simple means to run / test / integrate the application.

Another thing that can quickly configure your development environment is Vaprobash that decomposing a couple of lines is going to leave the LAMP installed.

answered by 26.05.2017 / 04:22