Best Vagrant Lamp Stack

imagine setting up a vagrant and playing around with the vagrant config file. boots up and some libraries are not working, dependencies not working…etc.

thanks to scotch box, a vagrant lamp stack that just works

https://box.scotch.io/

Vagrant Authentication fails

Sometimes things go wrong during vagrant setup especially if have set it up already. You might get errors like “Authentication Failure” during “vagrant up” command. It is troublesome to get into the VM if there is no ssh key.

Type in

vagrant ssh-config

To see whats happening.

make sure u have ssh keys already.

then get into the vm with user “vagrant” and passwd “vagrant”

put id_rsa.pub into ~/.ssh/authorized_keys

you should be able to ssh into vagrant vm with “vagrant ssh” now.

Speeding up vagrant virtualbox disk access

Virtualbox driver is very slow. You can google about this all over the internet.

There are 2 ways to speed up vagrant disk access using nfs, one way is to use vagrant-bindfs plugin and another way is the traditional way to change permissions in vm. This method outlines the later.

shutdown vagrant using “vagrant halt”
In puphpet folder, update config.yaml
synced_type: nfs
then “vagrant up”
If you are seeing mount nfs error, check your /etc/hosts file. make sure 127.0.0.1 points to localhost

sudo -s, CHANGE THE ROOT PASSWD first so that you can log in again if things break.
then
change the permission for the /var/www (vagrant folder) so that they are the user_id and grp_id of the user in mac, for example,
IN your mac,
the user id is 502 and group id in 20
IN your vm,
vagrant id is 1000 and www-data id is 33
edit etc/passwd and /etc/group and change the id of 1000 to 502 and /etc/group so that the id of www-data is 20
change the own dir to that permission as well, ie /var/www and their files.
change the session dir, ie /var/lib/php/session
exit and do a “vagrant halt” and “vagrant up” again to test.