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
Related
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
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.
I used to work with homestead on a mac machine, but since i don't have access to that mac machine anymore i'm back on my windows machine.
So today i installed homestead with no problems, ran vagrant up and got: No input file specified.
which is normal because i didn't set my homestead.yaml to the right folders. so this i where i started to ran into problems.
I have a .Projects folder in my user directory and there i have a laravel 5.4 installation called test
this is my homestead.yaml (only the folder's and site's section)
folders:
- map: ~/Projects
to: /home/vagrant/Projects
sites:
- map: test.dev
to: /home/vagrant/Projects/test/public
Still the same message and i realy don't know why i hope someone with homestead + windows can help me !
You need to serve your site from homestead ssh.
serve test.dev /home/vagrant/Projects/test/public
then sudo nginx restart
You need to register your site from homestead first.
I have been trying to set up Laravel Homestead Environment on a local machine. But I was unable to do it.I faced several errors in the installation process. Actually,I am confused with the installation procedure from configuring the SSH Key in the "homestead.yaml" file step.
In the "homestead.yaml" file,How to configure the authorize and keys components according to my local SSH file location against the standard Absolute Path location?
And what exactly is the use of Composer which is being mentioned as a package managing tool?
Is there a good tutorial out there regarding the installation procedure?
Its the first task in my new job and I am really struggling. Any help is really appreciated.
Thanks,
Sri
As you're asking for SSH i assume that you already downloaded Homestead completely (box & clone)and that a Homestead folder is present in you home directory.
First make sure you have Git Bash installed if you're on Windows, Go to your Homestead folder, right click and chose Git Bash then type in this command ssh-keygen -t rsa -C "you#homestead" this will create an SSH key in your folder.
You have to make sure that the keys are named like id_rsa.pub and id_rsa and place them in C:/Users/{username}/.SSH if they're somewhere else, install Composer if you don't have yet go to the folder you want laravel to be in, right click use composer here in next window put this command composer create-project laravel/laravel --prefer-dist
For your authorize key path question this is what you need to put in the Homestead.yaml file authorize: C:/Users/{username}/.ssh/homestead_rsa.pub
for the folders :
folders:
- map: C:/path/to/{local_laravel_project_folder}
to: /home/vagrant/Code
type: "nfs"
sites:
- map: sitename.dev
to: /home/vagrant/Code/Laravel/public
hhvm: true
Open notebook with administrative rights and go to C:\Windows\System32\drivers\etc\hosts and add this line 192.168.10.10 : sitename.dev save the file, run Homestead then in Bash put this command vagrant upand you should see the laravel homepage when you visit sitename.dev .
Is it possible to run homestead with an older version of PHP and Laravel 4.1? I need to set up my VM to replicate our production server, as closely as possible.
I find myself in 2021. According to the official docs and with the current Laravel homestead v10.17.0 you have the possibility to explicitly set the PHP version required right at the Homestead.yml file:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
php: "7.1"
- map: project2.test
to: /home/vagrant/project2/public
php: "5.6"
- map: default.test
to: /home/vagrant/project1/public
Then, don't forget to apply the changes with
% vagrant provision
Moreover, you could change dynamically the PHP version used in your Laravel Homestead Ubuntu virtual machine
$ sudo update-alternatives --config PHP
$ php -i | grep "Loaded Configuration File"
$ php -v
But that only works for composer update, it doesn't seem to work for an application. So changing the Homestead.yml file is the way to go.
Homestead is just a prepackaged version of Vagrant with PHP5.6, ngnix, mySQL etc already installed and configurable.
If you need a specific environment that is "different" to Homestead, you just create your own Vagrant environment with a bashscript that installs the versions of software that closely matches your production environment.
This guide here provides specific information for Laravel - but any Vagrant guide will be able to help.