Laravel Homestead automatically destroys VM - php

I followed all the instructions on how to setup laravel homestead.
I am using windows 7 and am trying to install laravel homestead on my system.
I have install virtualbox and vagrant.
Every thing seems to go very well however when i run vagrant up homestead VM boots up but fail at some point.
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/digitlimit/Homestead
default: /home/vagrant/Code => C:/server/www
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/giyiT0RlisfYwMdHfL7lUSxZtO
kEWX5dJwmwwru5dUQda/xknMa9oHKqAlv//V+VvzQ0JKv4eA3xbCgrlj4NAwoZrEjqVC2P0M3HqT2JKF
M76/WCU4Ki7TQnMQz5ff3aRIqFphNC0LZWXz9v92QjJYohODlOAxIhw94PUimnt3BIzOKxT+kqPuBCOc
+oTJTZwduQsCIb+ArmKVDxNMj1LCL65WrSTaO4CmqqVqiTJ3LkzKm4nNluvy26w5usAKhFs8zrPV0+Jh
DXPI6w9crKzs7y/zSspsENgDdNTuh8wRflUrfGgJMq6LbDVf+Kp6lsjvJMadpn2ABXBY9pr5F emailme#yahoo.com
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
I have provided the full bash commands and logs here:
http://pastebin.com/hcKpF9kA
Kindly view the log above and advise.

Its working now!
I ended up doing a fresh installation of both vagrant and virtualbox.
I took the following steps:
1.
I uninstalled vagrant and Virtualbox and deleted their folders from my system.
I also deleted the following folders:
C:\Users\mysername\.homestead
C:\Users\username\Homestead - vagrant environment
I deleted all the network adapters install by VM
Open Virtualbox and click File -> Preferences, click Network tab and then Host-only networks. Click on each item and click delete button
I download and install fresh copies of Vagrant and Virtualbox.
Am using Windows 7 (32bit)
https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2.msi
http://dlc-cdn.sun.com/virtualbox/4.3.22/VirtualBox-4.3.22-98236-Win.exe
I also download laravel/homestead manually
https://vagrantcloud.com/laravel/boxes/homestead/versions/0.2.2/providers/virtualbox.box
to my downloads folder C:\Downloads\homestead-0-2-2.box
After i have install Virtualbox and Vagrant. I installed laravel/homestead by running the following command in git bash (you can download git bash here: http://git-scm.com/downloads).
vagrant box add laravel/homestead /c/downloads/homestead-0-2-2.box
Then i downloaded vagrant environment so i can run vagrant commands:
Run this command in Git bash. I run this command inside C:\users\yourusername
git clone https://github.com/laravel/homestead.git Homestead
NB: This will create this folder: C:\Users\yourusername\Homestead
With some files.
Still in Git bash, cd into C:\Users\yourusername\Homestead and run this command:
bash init.sh
NB: this will create a folder C:\Users\yourusername\.homestead that contains Homestead.yaml and some other files
Then Generate an SSH key which you will need when you want to login to your VM by running this command:
ssh-keygen -t rsa -C "youremailaddress#youremail.com"
NB: This will ask some question simply hit enter or type yes and hit enter.
This will create your ssh key inside C:\Users\yourusername\.ssh
Then you need to configure homestead by editing.
C:\Users\digitlimit\Homestead\Homestead.yaml
You can right-click Homestead.yaml file then click open then choose to open with wordpad.
My Homestead.yaml looks this after editing:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /wamp/www
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
NB: To understand the mapping which is a process of sharing a folder between the host and the VM:
My laravel project is located at C:\wamp\www\laravel
This directory /home/vagrant/Code will be inside the VM after installation.
So what am telling VM is, whenever you see /home/vagrant/Code reference this folder C:\wamp\www\laravel
Also in this:
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
What we are saying here is when i go to my browser and type http://laravel.dev display the content of /home/vagrant/Code/laravel/public which is actually pointing to C:\www\wamp\laravel\public
After editing Homestead.yaml file save your chnages
NB: Before we can use http://laravel.dev in the host web browser to view our laravel project, we need to add this the following to the hosts file located in
C:\Windows\System32\drivers\etc\hosts
Add this ip address under the list of other ip address listed if any:
192.168.10.10 laravel.dev
Finally, go back to your Git bash, ensure you are in
/c/Users/yourusername/homestead and type:
vagrant up
Wait for vagrant to complete its processes. Click yes when you see any dialog box asking for permission to create network adapter on your system
Well thats all i did. Working for me

Related

Laravel Homestead - site cant be reached. Windows 10

Im getting started with Laravel Homestead and spend half a day working with tutorials and manuals.
The problem is that everything looks perfect - without any errors, but still I cant see laravel welcom page.
I've installed vagrant and virtual box.
at c:/windows/system32/drivers/etc/hosts added line like:
# 192.168.10.10 homestead.test
My directory tree looks like:
~/Server/.ssh
~/Server/Code
~/Server/Homestead
I made .ssh keys and using git bash:
cd Server
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
bash init.sh
and configured homestead.yaml file:
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/Server/.ssh/id_rsa.pub
keys:
- ~/Server/.ssh/id_rsa
folders:
- map: ~/Server/Code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/homestead/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Everything looks fine to me so far, is it?
Next in shell:
vagrant up
vagrant ssh
successfully logged to laravel and changed directory to only one existing code, then:
laravel new homestead
Finished iwth message Application ready! Build something amazing.
Did also another one project with different names, but when I type in my chrome browser homestead.test or whatever I call my project -> This site can't be reached.
Thanks for your help.
It sounds like you made the vagrant box first then created a new app after ssh into the vagrant box. I usually take different steps.
Make sure vagrant is installed. https://www.vagrantup.com/downloads.html
Make sure the laravel/homested box has been added to vagrant vagrant box add laravel/homestead
Make sure homestead is installed on the home directory in a file named Homestead git clone https://github.com/laravel/homestead.git ~/Homestead https://laravel.com/docs/7.x/homestead#first-steps
install homestead into your project composer require laravel/homestead --dev
use the make command to generate the vagrant and homestead.yaml files (for windows vendor\\bin\\homestead make) https://laravel.com/docs/7.x/homestead#per-project-installation
Configure the vagrant, homestead.yaml, and hosts file as you have done.
vagrant up

No input files specified - symfony app set up with homestead

I tried to use homestead to iset up Symfony using instruction here. Everything seemed to run correctly in git bash, but after php bin/console server:start, I get "No input files specified" when I go to localhost:8000 or http://127.0.0.1:8000 or symfony-demo.test. I have searched around and tried different approaches for the past 6 hours, but still can't get it work. I'm quite new to virtual machine and vagrant, and complete newbie to Symfony so any help would be highly appreciated!
Here is my Homestead.yaml file:
folders:
- map: C:\php-apps
to: /home/vagrant/code
sites:
# - map: homestead.test
# to: /home/vagrant/code/homestead/public
- map: symfony-demo.test
to: /home/vagrant/code/symfony_demo/web
type: symfony
Here is the host file:
#192.168.10.10 homestead.test
192.168.10.10 symfony-demo.test
Here is latest commands I ran in git bash:
vagrant#homestead:~$ ls
code
vagrant#homestead:~$ cd code/
vagrant#homestead:~/code$ cd symfony_demo/
vagrant#homestead:~/code/symfony_demo$ ls
symfony symfony-demo
vagrant#homestead:~/code/symfony_demo$ cd symfony-demo/
vagrant#homestead:~/code/symfony_demo/symfony-demo$ ls
app bin composer.json composer.lock phpunit.xml.dist README.md src tests var vendor web
vagrant#homestead:~/code/symfony_demo/symfony-demo$ php bin/console server:start
[OK] Server listening on http://127.0.0.1:8000
vagrant#homestead:~/code/symfony_demo/symfony-demo$
I tested Laravel before and it worked fine, though http://127.0.0.1:8000 was also showing laravel after started the symfony server in symfony-demo, so I commented out Laravel site in host file and Homestead.yaml and ran vagrant --provision. Afterwards when I went back to symfony-demo directory and launched the server again, everything starts to show "No input files specified".
I have figured it out so I want to post my solution here just in case someone else ran into the same issues as me. So I'm on a windows 10, before my own config files, please do read careful through these 3 resources:
Using homestead to install Symfony on various version documentation by Symfony
Installing Symfony 3 with vagrant and homestead by Sanket Patel
Set up homestead on windows by JBorbón
Here is what I did:
Create a homestead folder on my C drive.
Install symfony installer on C drive and move it into the homestead
folder above.
Create my project inside of homestead folder above (my project is
called autotrader).
Download vagrant, virtual box and set up homestead according to
their documentation. I set up a directory called
homesteadserver where I cloned homestead in.
Configure my Homestead.yaml file as below:
folders:
# - map: ~/code
# to: /home/vagrant/code
- map: C:\homestead
to: /home/vagrant/homestead
sites:
# - map: homestead.test
# to: /home/vagrant/code/public
- map: autotrader.test
to: /home/vagrant/homestead/autotrader/web
type: symfony
Configure my host file as below:
192.168.10.10 autotrader.test
Go to my homestead server and vagrant up and provision.

Laravel project is not opening in browser using Homestead

I know this question may be overlapping but I have tried most of all answers in online that I could find. But no success so far. So, anyone please help me out.
I am new to both Homestead and Laravel. This is my configuration and details about installation below:
Homestead 7 installed
Vagrant 2.0.3 installed
Composer 1.6.4 installed
Oracle VM VirtualBox 5.2.8 installed
git bash 2.16.1.windows.4 installed
Windows 10 O/S is my Main base O/S
On VirtualBox Manager I got these data=> Name: homestead-7, O/S: Ubuntu (64-bit), Base Memory: 2048 MB, Boot Order: Hard Disk, Optical, Acceleration: VT-x/AMD-V, Nested Paging, PAE/NX, KVM Paravirtualization..... so on
In c:/Laravel_P folder I installed Laravel using Composer in Git Bash:
cd /c/Laravel_P
composer create-project --prefer-dist laravel/laravel wetest
After about command, i got 26.3 MB wetest folder in Laravel_P folder, which was successful installation of Laravel.
Then I backdown from folders to my root by cd command and go to Homestead folder by cd Homestead. After I enter the Homestead folder, I run command:
vagrant up
This runs my Homestead Vagrant successfully (I checked in VB) and when processing this command no any error was shown.
I change my homestead.yaml file to this as my system placements.
authorize: C:/Users/my_user/.ssh/id_rsa.pub
keys:
- C:/Users/my_user/.ssh/id_rsa
folders:
- map: C:/Laravel_P
to: /home/vagrant/code
sites:
- map: homestead.wetest
to: /home/vagrant/code/wetest/public
Also changed my host file and saved the change:
127.0.0.1 localhost
::1 localhost
192.168.10.10 homestead.wetest
Then i run another command:
vagrant provision
I have tried also vagrant reload --provision command also
Now, when i tried to access my Laravel project from
http://homestead.wetest
I got Error:
This site can’t be reached
homestead.wetest’s server IP address could not be found.
In my knowledge, I tried every step as found in web and documentation in Laravel, but why am I not getting the desired result? Please anyone help me in this.
folders:
- map: C:/Laravel_P
to: /home/vagrant/code
sites:
- map: homestead.wetest
to: /home/vagrant/code/wetest/public
should be to: /home/vagrant/code/public

Homestead/Vagrant `* The host path of the shared folder is missing: ~/Code`

I am getting the below error while running the vagrant up command within ~/Homestead -
The host path of the shared folder is missing: ~/Code`
Here's the output from my terminal after running vagrant up within ~/Homestead
Josephs-MBP:Homestead Joey$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Box 'laravel/homestead' could not be found. Attempting to find and install...
homestead-7: Box Provider: virtualbox
homestead-7: Box Version: >= 0.4.0
==> homestead-7: Loading metadata for box 'laravel/homestead'
homestead-7: URL: https://atlas.hashicorp.com/laravel/homestead
==> homestead-7: Adding box 'laravel/homestead' (v1.0.1) for provider: virtualbox
homestead-7: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/1.0.1/providers/virtualbox.box
==> homestead-7: Successfully added box laravel/homestead' (v1.0.1) for 'virtualbox'!
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The host path of the shared folder is missing: ~/Code
How do I fix my issue with the host path?
Your truly,
Total Newb
You have a synced folder configured from your Vagrantfile but this folder does not exists.
Create the folder ~/Code on your mac and run again (you can run mkdir -pv ~/Code)

Vagrant error while mounting nfs shared folders following roots bedrock+trellis+sage tutorial

Im following this repo https://github.com/roots/roots-example-project.com.
I did all steps till the vargrant up to see the development part.
It gives me this error after a few seconds:
==> default: Preparing to edit /etc/exports. Administrator privileges will be required... sudo: /etc/init.d/nfs-kernel-server: command not
found
==> default: Mounting NFS shared folders... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means
the command failed!
mount -o 'vers=3,udp'
192.168.50.1:'/home/miguelrebola/projects/work/example.com/site' /vagrant-nfs-roots-example-project.com
Stdout from the command:
Stderr from the command:
stdin: is not a tty mount.nfs: requested NFS version or transport
protocol is not supported
I need to get that going and i've tried everything i found on internet.
It only gives this error once after that it only shows this when running vagrant up.
--- work/example.com » vagrant up Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: VirtualBox VM is already running.
==> default: Checking for host entries
--- work/example.com »
any idea whats happening?
PS. Im on Ubuntu.
It looks like nfsd is not running on your host machine (ubuntu does not install by default, mac os does)
install with sudo apt-get install nfs-kernel-server
most probably it will be enough, if not follow the instructions from https://help.ubuntu.com/community/SettingUpNFSHowTo to setup everything.
Second option : if you do not want to setup nfs, you can remove , type: 'nfs' from the Vagrantfile and let vagrant use the default sharing folder mechanism.

Categories