Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stop using MAMP. Here's a laughably simple way to get setup with a LAMP stack with PHP 5.5.
alias lamp="curl -L -o 'install.sh' http://bit.ly/1hBfq57 && curl -L -o 'Vagrantfile' http://bit.ly/1mE3Qt9 && vagrant up"
@maxxscho
Copy link

maxxscho commented Mar 7, 2014

@ronnyandre I had the same problem but the trick with the mount_options seems to work for me. Thank you!

@phaberest
Copy link

phaberest commented Mar 15, 2014

Same as @ronnyandre, tried chmod -R 0777 app/storage and even chown -R www-data:www-data /vagrant but still getting /app/storage/meta/services.json): failed to open stream: Permission denied

EDIT:
Solved by doing the chmod command on the host

@kristjaningi
Copy link

kristjaningi commented Mar 17, 2014

When I setup "Extra Credit 5: Laravel Setup" it works for about 5 mins, then I get a white screen with this console error.

"Uncaught TypeError: Cannot call method 'create' of undefined"

I tried restarting vagrant box but nothing works.

Anyone knows whats wrong?

PS.
It happens when I refresh the page.

@kristjaningi
Copy link

kristjaningi commented Mar 17, 2014

I fixed it by using: sudo chmod -R guo+w app/storage

Does anyone know why?

@nicoeg
Copy link

nicoeg commented Mar 21, 2014

Getting blank screen on Laravel. Tried chmod on storage, but doesn't seem to help.
Echoing in routes.php file works, but nothing happens when using return.

What could do the trick?

@bradykeeling
Copy link

bradykeeling commented Mar 27, 2014

@nicoeg this worked for me:

$ cd app/storage
$ sudo chmod 777 *
$ sudo chmod 666 /

(not sure if it's best practice or not...)

@bradykeeling
Copy link

bradykeeling commented Mar 27, 2014

oops, that didn't show up right... should be a * on both sides of the slash.

See here (http://laravel-recipes.com/recipes/43)

@ren-
Copy link

ren- commented Mar 30, 2014

Why Guest additions are only on version 4.2 not 4.3? Can this cause problems to folder sharing?

@ashleywnj
Copy link

ashleywnj commented Apr 6, 2014

Thank you so much. Love laracasts. I am curious why, in step 5, Laravel is setup from the local host rather than from within the guest environment - is this required or could you run all steps after vagrant ssh?

I also experience the same issue as @nicoeg, the laravel screen appears on first load, but then loads a blank page with no errors. If I shut my mac down, come back, vagrant up etc then the laravel image loads when I goto the root of the page, but it will not reload again with a refresh, no matter how many tries. Permissions on app/storage are wide open. Any help or insight appreciated.

Finally figured it out - it was permissions related, but permissions on the vendor folder and below - it worked the first time because it had read access, but I guess a refresh triggered a write within the log folder - for similarities sake I ran chmod -R 777 on the vendor folder. Although it sucked up some hours, it was a great learning experience (I'm new). Great video - loving Laracasts.

@davecoggins
Copy link

davecoggins commented Apr 8, 2014

I was having a similar permissions problem as those described above. Initially I thought I solved it by doing sudo chmod -R 0777 app/storage on host computer rather than vagrant box. However, the blank white screens returned whenever laravel tried to write to the sessions file.

After some Googling the following solution worked for me. Change the Vagrant config file to read like this on line 12:

config.vm.synced_folder ".", "/var/www", owner: "www-data", group: "www-data"

Run vagrant reload and the problem should be solved.

@alesanabriav
Copy link

alesanabriav commented Apr 11, 2014

Thank you @davecoggins

@aurelkurtula
Copy link

aurelkurtula commented Apr 14, 2014

This is fantastic.
When I ran lamp it took about half an hour to download - no idea why. By going though your video tutorial on laracasts, I got the impression that it is a good idea to install the lamp stack for every new project. I'm just wondering, is there a reason not run lamp once and then add those files in git hub and clone it for ever project (so download the lamp stack once and then duplicate it for every project).

Also the sql databases, are they stored inside the project in question, or are they stored globally in mac. Using mamp , there have been times when I added a project to git and forgot to export the DB, in this case is the DB within the same folder,

Hope I am making sense
Thanks

@sicktastic
Copy link

sicktastic commented Apr 22, 2014

Humm... all of sudden "lamp" command installs nothing...

@ODelibalta
Copy link

ODelibalta commented May 9, 2014

I managed to get both sites working - sort of.

I have one that is local.dev which refers to the vagrant directory (var/www on the vm) and index.php shows up there.
I have another on the same vm that is codeshare.dev which refers to the codeshare folder inside vagrant directory (/var/www/codeshare on the vm) but that one displays the directory list instead of the laravel installation. I did the chmod thing and no luck. I ran php artisan serve and it says its already doing that.

@carltondickson
Copy link

carltondickson commented Jun 18, 2014

Thanks for this.
I am running this on Windows 8 and running this command in Git Bash.

I would add that it was hanging on the message "Verifying Hyper-V is enabled", this is because vboxmanage wasn't available and meant I had to add "C:\Program Files\Oracle\VirtualBox" to my Path environment variable

@ceesco53
Copy link

ceesco53 commented Jul 8, 2014

Another thank you to @davecoggins

EDIT: I just reverted my config.vm.synced_folder line in vagrant back to the original settings. I opted to edit /etc/apache2/envvars and have apache2 run as vagrant user and group.

@szainmehdi
Copy link

szainmehdi commented Jul 14, 2014

Can anyone confirm if this still works? I haven't been able to get it to work at all.

To clarify: Running the script works fine and vagrant seems to be set up properly, but navigating to the server's IP address results in a 403 Forbidden error. I've followed to steps carefully, repeatedly, but no luck.

If anyone can confirm this still works properly, I guess I'll look into troubleshooting it further. Thanks.

@iClosedz
Copy link

iClosedz commented Jul 27, 2014

Yes this is work.

@mikoop79
Copy link

mikoop79 commented Jul 29, 2014

Thanks heaps for this.... Can anyone please help me access the mysql from an IDE such as Sequel Pro. what is the ssh username and password?

@kylescousin
Copy link

kylescousin commented Jul 31, 2014

In windows, make lamp.bat and put this in:

curl -L -o install.sh http://bit.ly/1hBfq57
curl -L -o Vagrantfile http://bit.ly/1mE3Qt9
vagrant up

@premendrasingh
Copy link

premendrasingh commented Nov 23, 2014

vagrant ssh
mysql -u root -p
Follow steps to allow remote connection to my sql http://stackoverflow.com/questions/15663001/remote-connections-mysql-ubuntu
Next connect from remote client Sequel Pro/MySQL Workbench to 192..168.33.21:3306

@RavenousPett
Copy link

RavenousPett commented Nov 24, 2014

Does anyone know what the username and password is for the VM? If say I wanted to SSH in without using Vagrant.

Great walkthrough by the way, and thanks @davecoggins, lifesaver!

@RavenousPett
Copy link

RavenousPett commented Nov 26, 2014

Found it, username = vagrant, password = vagrant. Sequel Pro now connects to the remote mysql without any extra configuration.

@JeffreyWay and @fideloper what are your thoughts on hosting the DB on the virtual server, now that it's so easy to set up its also easy to destroy, and lose all of your development data.

@hadifarnoud
Copy link

hadifarnoud commented Feb 17, 2015

are we updating this alias and setup?

@hadifarnoud
Copy link

hadifarnoud commented Feb 18, 2015

would be great if someone creates an install.sh for nginx php-fpm.

@tskamath
Copy link

tskamath commented May 7, 2015

could get the install to work.. Fixed the File with http://foo-o-rama.com/vagrant--stdin-is-not-a-tty--fix.html#

edited the Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.provision "fix-no-tty", type: "shell" do |s|
    s.privileged = false
    s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
  end
  config.vm.box = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
  config.vm.network :private_network, ip: "192.168.101.101"
  config.vm.provision :shell, :path => "install.sh"
  config.vm.synced_folder ".", "/var/www"
end

@saqueib
Copy link

saqueib commented Aug 29, 2015

@JeffreyWay How can I install node.js on this box to use Elixir

@anonRegions
Copy link

anonRegions commented Dec 3, 2015

I think I've done something wrong. When I get to Step 4 above, here's what happens:

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:

  • The box 'hashicorp/precise32' could not be found.

Please advise.

Thanks.

@jrvaja
Copy link

jrvaja commented Dec 29, 2015

Hi,
For Ubuntu 14.04 stack

alias lamp="curl -L -o 'install.sh' https://goo.gl/xQR4ud && curl -L -o 'Vagrantfile' https://goo.gl/TMPyh2 && vagrant up"

Thanks,

@devonmather
Copy link

devonmather commented May 5, 2016

Getting errors when running this culminating in the following;

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Full log here https://gist.github.com/devonmather/6c50c824ad89efac15e85a323c52c879

I've listed the errors from the console output that were red below the gist in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment