My attempts to install Laravel Homestead on Windows 7
I’ve got a fresh install of Windows 7. I’ve already been using Laravel/Homestead on previous Windows 7 & 8 installations, I was looking forward to a quick install.
Immediately below I show the a step by step guide to carry out a successful install with working node on my VM.
Below that I report on what went wrong for me in case anyone else is getting the asme issues.
Guide to Installing Laravel Homestead on Windows 7
Install these versions:
- Composer – latest verison
- Git/Gitbash – latest version
- Vagrant – 1.7.4 (latest version)
- VirtualBox – 4.3.20
Run GitBash. You should by default be in your user folder ( “/c/Users/youruser/”)
composer global require "laravel/homestead"
Now ensure that Homestead is added to the main Windows PATH variable.
Add C:\Users\\AppData\Roaming\Composer\vendor\bin to the PATH Environment variable.
(creates the homestead yaml file in “C:\Users\youruser\.homestead”)
Edit the homestead.yaml file in Windows “C:\Users\youruser\.homestead” so that we have something like this below. Note your mappings should be setup for you.
--- --- ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa folders: - map: ~/Code to: /home/vagrant/Code sites: - map: homestead.app to: /home/vagrant/Code/Laravel/public databases: - homestead variables: - key: APP_ENV value: local # blackfire: # - id: foo # token: bar # client-id: foo # client-token: bar # ports: # - send: 93000 # to: 9300 # - send: 7777 # to: 777 # protocol: udp
Now you should be able to add your Homestead box. vagrant box add “laravel/homestead”
Ensure you have your RSA key setup:
ssh-keygen -t rsa -C "you@homestead"
We can now startup our Homestead box with the commmand.
(This will install the required Virtualbox if it isn’t already loaded.)
Now we are ready to access and use our Vagrant/Homestead instance.
Homestead ssh freezes problem
Normally we should be able to use Homestead to access our vagrant homestead machine, but I’ve noticed that under Windows this freezes after a minute or so nearly every time.
My workaround for this is to use a Vagrant command instead, and as well as working, this shows that the problem lies in the Homestead SSH wrapper for Windows.
We get the name of the homestead vagrant machine by typing;
Then we can access the machine directly using
From here we can now do everything we need to run Homestead.
Logged into Homestead
We can now install the Laravel installer globally:
composer global require "laravel/installer=~1.1"
As a test we can now install a Laravel Project.
laravel new Laravel
Now we ensure that the homestead.app entry is made in the Windows hosts file (c:\windows\system32\drivers\etc\hosts)
# For example: # # 126.96.36.199 rhino.acme.com # source server # 188.8.131.52 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 192.168.10.10 homestead.app
Now from our browser we should get the Laravel welcome screen when we visit the url http://homestead.app/
[divider style=”none” icon=”wrench”]
Laravel Homestead Windows 7 issues
At the time of writing, the latest versions of the installation requirements are:
- Composer – Self updated to latest version (still reports as 1.0-dev)
- Vagrant – 1.7.4
- VirtualBox – 5.0.2
- Git (with Gitbash) – 2.5.1
To get started I use GitBash to give me a Linux type terminal on Windows.
First I used Composer to install the Homestead setup.
composer global require "laravel/homestead"
The I initialise Homestead to setup the configuration files.
(This should create the homestead.yaml file in “C:\Users\youruser\.homestead”)
Then I attempt to add the vagrant Homestead box and I run into trouble. I typed;
vagrant box add "laravel/homestead"
Which resulted in the error;
“Vagrant is attempting to interface with the UI in a way that requires a TTY. Most actions in Vagrant that require a TTY have configuration switches to disable this requirement. Please do that or run Vagrant with TTY.”
After a good deal of searching the problem, I tried the same command at normal Windows Command line. It worked but it did give me a new choice;
“Which provider will you be working with”.
Considering I don’t have Vmware or hyperv on this machine I found that strange, however I chose Virtualbox and the new box added just perfectly.
I then removed Gitbash and replaced with the older 1.9.5 preview version and everything seemed to be working fine – I could now add other Vagrant boxes, but in retrospect this wasn’t the actual issue.
The choice from the Windows command line updated my Homestead.yaml file. It now contained the “provider” as below. I’ve since moved back to the latest version of Git/GitBash.
--- ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa
This issue here was that the “provider” configuration is required. I’m not sure if thiss didn’t originally work for me because I may have copied yaml files, or if it’s a normal bug. I can now replicate the error though if I remove the line.