Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shwheelz's avatar

Trouble Installing Laravel on Windows 7 with Vagrant / Virtual Box

I've been following the Laravel tutorial found here: https://laracasts.com/series/laravel-5-from-scratch/episodes/3

I'm having trouble getting Laravel up and running, so maybe someone here can help me out. I don't know very much about setting up dev environments in general, so please try to explain what you can in layman's terms.

To begin, I guess I'll copy in my Homestead.yaml file:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: C:\laravel_code
      to: /home/vagrant/code

sites:
    - map: learn.app
      to: /home/vagrant/Code/my-first-app/public

variables:
    - key: APP_ENV
      value: local

c:\laravel_code is where the Homestead folder exists, so I think that's what I need to map the folders to. I set up my private key with Git for a past Rails project, so I'm guessing that is okay. I'm not sure I fully understand the code under sites, as the narrator of the tutorial never created a my-first-app folder and the only reference to learn.app is right there in Homestead.

I'm running into trouble when I run the vagrant up command. The command seems to launch the virtual machine fine; it turns on and looks like it's running successfully. However, in my command prompt, I see:

C:\laravel_code\Homestead>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...

and the last line repeats itself until it eventually gives up. I'm not really sure what potential problem areas could be. When I run the command, I get a prompt from Windows Firewall, but I can "Allow Access" so I don't think that's necessarily the problem. I've run virtual machines on this PC before, so I don't think I need to reconfigure anything in BIOS like many other Windows users that have trouble with installation. Can anyone identify even potential trouble spots with my code?

0 likes
51 replies
bashy's avatar

Open VirtualBox and see if it's actually on?

Shwheelz's avatar

Homestead_default virtual machine is Running. After vagrant up gives up, I run it again and see

C:\laravel_code\Homestead>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: VirtualBox VM is already running.

But when I try to connect to learn.app:8000 the page can't be found.

bashy's avatar

What's the actual error for the page? Name not resolved or time out etc?

fraserk's avatar

Did you edit you etc\hosts file? 127.0.0.1 learn.app

Shwheelz's avatar

@fraserk I have this line already added to the end of etc\hosts: 127.0.0.1 learn.app

bashy's avatar

What happens when you view or ping the IP?

Shwheelz's avatar

Looks good to me

C:\laravel_code\Homestead>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
bashy's avatar

127.0.0.1 will always work, it's your local.

Try > ping 192.168.10.10

keevitaja's avatar

small note: in /etc/hosts you must point to vm ip

192.168.10.10 learn.app

EDIT:

In windows hosts file is windows/system32/something

Shwheelz's avatar

VirtualBox has two adapters set up in File > Preferences > Network > Host-only Networks.

The first has IPV4 of 192.168.56.1 and the second has 192.168.10.1

Do one of these need changed to 192.168.10.10?

EDIT:

hosts is located in C:\Windows\System32\drivers\etc for future reference

fraserk's avatar

@Shwheelz my host-only networks is setup similar to yours. None is pointing to 192.168.10.10 so I wouldn't change that.

Shwheelz's avatar

Just a note, pinging both of the IPv4 addresses I mentioned above work, 192.168.10.10 obviously does not. @fraserk is your hosts file using either of those IPv4 addresses?

bashy's avatar

You've set the IP as

ip: "192.168.10.10"

1 like
Shwheelz's avatar

Thanks @bashy, I'm sure that was one of the problems. Still no dice though. @fraserk, http://localhost:8000/ leaves me the same "Webpage not found" error as mentioned earlier. Which IP do you set at the top of your host file? Adapter 1 or 2?

fraserk's avatar

I'm using 127.0.0.1 in my host file and ip: "192.168.10.10" in Homestead file . I'm stump.. The only other thing I can think of is the network setting on the VM network to Nat?

bandgeekndb's avatar

For my Homestead VM, I have Adapter 1 as NAT and Adapter 2 as Host-only Adapter. The NAT adapter is where all of the forwarding ports are set, so if you don't have a NAT adapter, things won't work.

We need to figure out why you don't have a NAT adapter, let me take a closer look at my Homestead environment and get back to you. I'd say just change it manually, but we probably won't get the port forwarding right, and it's better to figure out why the auto-provisioning isn't working.

collapsarzhang's avatar

try to uninstall virtualbox then install VirtualBox-4.3.12.

this solves my problem, and the problem was exactly the same.

Shwheelz's avatar

@zzzcollapsar I tried your suggestion, but now Vagrant can't detect VirtualBox at all. Is there something else I need to configure?

C:\laravel_code\Homestead>vagrant up
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.

Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
collapsarzhang's avatar

did you reboot your system? if so, probably redo the whole git Homestead, edit yaml, vagrant up process? if that still not working, check if your CPU supports vt-x?

ratiw's avatar

Did you enable Virtualization option in your BIOS?

ratiw's avatar

It is running but it's not responding. I think I used to have the same problem of getting 'Connection timeout' repeatedly, until I recheck my computer BIOS and found out that I didn't enable the Virtualization option.

Please see this:

https://gist.github.com/ratiw/1428d432877d745aa49d

Also, using 127.0.0.1 in hosts file seems to be better than 192.168.10.10, otherwise, you will have problem with your VM when your notebook resume from sleep or hibernation. With 127.0.0.1 you will not have such problem.

jehad's avatar

I've had the same issue on my mac today. Deleted the homestead box, downloaded it again and it worked. No idea what caused this or if the issue will return.

Worth mentioning is the fact that I also did a clean install if virtualbox, vagrant and homestead on my Windows 8.1 work laptop yesterday with no issues at all, not a single timeout.

Shwheelz's avatar

@ratiw I'll check that next time I turn on my computer, but I've successfully used virtual machines on this computer in the past with VMWarePlayer, so I'm skeptical that the problem lies in BIOS.

@jehad I downloaded everything for the first time yesterday. Today, I uninstalled VB 4.3.16 and installed 4.3.12. I also deleted Homestead and re-cloned it.

Next

Please or to participate in this conversation.