Vagrant/Homestead ssh Identity file not accessible: no such file or directory - laravel

I'm having an issue when trying to run
vagrant ssh
I keep getting
Warning: Identity file C:/Users/Firstnamenot accessible: No such file or directory.
bash: Lastname/Homestead/.vagrant/machines/homestead-7/virtualbox/private_key: No such file or directory
I normally try to stick to one word usernames, but work set this computer so I'm stuck with that space there. At least I'm guessing that the command is seeing the space and thinking that's the end of the directory path. Is there a way to hard code this path, or a way around it?
Edit:
I'm running on windows
and my homestead.yaml is:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Projects
to: /home/vagrant/Projects
sites:
- map: homestead.app
to: /home/vagrant/Projects/Laravel/public
databases:
- homestead

I had to install homestead again in a different directory, to do so I followed
Change VAGRANT_HOME directory on windows
setx VAGRANT_HOME="X:\your\path"
Then as indicated at the manual I created the box again
vagrant box add laravel/homestead
I also created a Homestead dir outside my users folder and follow the manual:
git clone https://github.com/laravel/homestead.git Homestead
git chechout vX.Y.Z
bash init.sh
So if you can make directories outside your user directory, this should work.

Related

Laravel and Vagrant: Don't have /home/vagrant folder

I've successfully created a laravel app with the $ laravel new blog command on my Ubuntu 16.04. All app files are located at the ~/Code folder.
Here's my Homestead.yaml file:
---
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: devbase.app
to: /home/vagrant/Code/blog/public
databases:
- homestead
The problem is I don't have this /home/vagrant folder on my computer. And, of course, the blog app source files are not shared to this folder.
Do I have to manually create this folder? And how to make the ~/Code folder share files with it then?
Or there occurred a problem while installing VirtualBox, Vagrant or Homestead?
What I have to do to make it work properly?
You don't have to have /home/vagrant on your machine, it's the folder inside vagrant box (Homestead). Run vagrant ssh (password is vagrant) command to connect to the VM and you'll find /home/vagrant directory there.

Laravel Homestead (Windows)

Today I have been trying to install the Laravel library together with Laravel Homestead.. But I can't seem to get it working.
The first thing, Laravel documentation tells you to do: composer global require "laravel/homestead=~2.0", but it didn't work.
So I searched the internet some and found: composer global require "laravel/homestead=~3.0", which actually worked.
But now when I try to run the homestead command in my command line, it gives me this: http://prntscr.com/9perhj, that's the only thing it's giving me.
I have added the directory to my path variable.
I hope someone can help me.
Thanks in advance!
Homestead itself command will return this expected screen. You would need to pass the command you want to run.
At first, run homestead init so that it will create the Homestead.yaml configuration file
This is an old question but I thought I'd put up my answer since it took me multiple tries to get it right and I documented the process while I was doing it so I wouldn't have such a hard time in the future.
Note: You should NOT have NginX, PHP, MySQL, etc. installed on your machine. The Vagrant Homestead virtual box provides all of this functionality. I had some issues where I had NginX and MySQL on my machine and it was connecting to my local machine's MySQL when it should be connecting to the virtual box's MySQL.
Without further ado, this is how I set it up for my Windows 7 machine:
Prerequisites:
VirtualBox:
https://www.virtualbox.org/wiki/Downloads
Vagrant:
https://www.vagrantup.com/downloads.html
Git Bash: A terminal that feels like a Linux terminal. You can do everything you do on an Ubuntu server in Windows.
https://git-scm.com/downloads
Putty: Telnet client that I used for connecting to my VirtualBox Homestead server
http://www.putty.org/
create project folder
open terminal in project folder (something like E:\Projects\Vagrant)
type 'vagrant box add laravel/homestead'
type 'git clone https://github.com/laravel/homestead.git Homestead'
This installs Homestead in the designated project folder.
type 'cd Homestead'
type 'bash init.sh' OR 'init.bat'
This creates a folder in:
C:\Users\USERNAME\.homestead
which has the file:
Homestead.yaml
If you open the Homestead.yaml file it should look something like this:
---
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
The '~/' folder is the equivalent of:
C:\Users\USERNAME\
Change:
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
To:
folders:
- map: E:/Projects/Vagrant/Homestead
to: /home/vagrant/Homestead
sites:
- map: WEBSITE.dev
to: /home/vagrant/Homestead/Laravel/public
goto C:\Windows\System32\drivers\etc
open the file 'hosts' in a text editor
add '192.168.10.10 WEBSITE.dev' (the IP address should match the IP address in the Homestead.yaml file)
open a terminal in E:/Projects/Vagrant/Homestead folder
type 'ssh-keygen -t rsa -C "USERNAME#gmail.com"'
This creates the folder C:\Users\USERNAME.ssh and sets up your SSH Key
type 'vagrant init laravel/homestead'
type 'vagrant up'
You should see Homestead running in VirtualBox
You can use 'vagrant destroy' to kill it when done
Use putty.exe to log in to Homestead
IP Address: 127.0.0.1
Port: 2222
login as: vagrant
password: vagrant
Everything is now ready

After installing Homestead I get "No input file specified" in the browser. How can I access my laravel project

I think I finally got homestead installed on my laptop! Now, I am trying to view my laravel project in the browser.
When I open "dev.app" in the browser I get a message that say "No input file specified." which I think means that my homestead is working but the laravel project is not there/setup.
I have created a folder called Projects on my local laptop (i.e. ~/Projects). Then from inside of it i executed this command
laravel new dev
But I still get the same error message in the browser i.e. "No input file specified." I have also tried to open this link "dev.app"/dev" but I still get the same message.
What I am doing wrong?
Here is the content of my Homestead.yaml file
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Projects
to: /home/vagrant/Code
sites:
- map: dev.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Additional, when I execute the following 2 commands in order
cd ~/Projects
ls
I see the following directories dev homestead
What should I do to see my project when I go to dev.app ? Do I need to do anything from my Ubuntu VM or I should be able to edit the files directly in located on ~\Projects\dev" from my laptop?
Add an entry in /etc/hosts on your local machine
192.168.10.10 dev.app
Correct the path to the public folder in the sites section of your Homestead.yaml
sites:
- map: dev.app
to: /home/vagrant/Code/dev/public

Homestead virtualbox error, the host path of the shared folder is missing: ~/Code

Iam trying to use homestead laravel, seems some issue that am feeling strange.
root#seetha-H81M-S:/home# homestead 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 host path of the shared folder is missing: ~/Code
homestead.yaml
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/Homestead
sites:
- map: nal.app
to: /home/seetha/Homestead/nal/public
There is a folder named Homestead in /home/Homestead , still seems not working.
I have find similar questions in stack-overflow but nothing seems working for me.
Can anyone help me to solve this issue.
Thanks in advance.
OS Ubuntu 14.04
I had the same problem and fixed it by bash init.sh
Run the bash init.sh command from the Homestead directory to create the Homestead.yaml configuration file. The Homestead.yaml file will be placed in the ~/.homestead hidden directory.
If you are changing Homestead.yaml again, you have to re-run bash init.sh again. It will ask for overwrite, say yes.
You have this issue when your folders are not properly mapped.
This is how to map your folders in vagrant Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
~/Code means /home/yourUsername/Code must exist in your host computer.
The code folder will house all your Laravel apps.
Example you could have the following apps in Code folder which are on your host
/home/vagrant/Code/laravelapp
/home/vagrant/Code/laravelapp2
Homestead.yaml may now look like this
---
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/laravelapp/public
- map: laravel.dev2
to: /home/vagrant/Code/laravelapp2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar

The host path of the shared folder is missing: ~/Code

I'd like to use laravel homestead for my development machine and installed virtualbox and vagrant successfully, but when I run vagrant up I get this error:
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 host path of the shared folder is missing: ~/Code
The Homestead.yaml file looks like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
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
hhvm: true
databases:
- homestead
variables:
- key: APP_ENV
value: local
These are the default settings, but they don't really work for my machine - I don't even have /home/vagrant folder nor do I have ~/Code anywhere where I can see. I'm using ubuntu 12.04 - can you please point me to how I should configure my settings because by the official documentation I'm kind of lost.
Inside the homestead directory, you have to run the command bash init.sh.
This will generate the Homestead.yaml file (and after.sh and aliases) inside your home directory (~).
If you are changing Homestead.yaml again, you have to re-run bash init.sh again. It will ask for overwrite, say yes.
(and as mentioned in other answers, be sure that the directory for folders: - map: exists)
In your Ubuntu machine you have to let Homestead know where your actual code is located. Example:
If you code is located in a seperate partition called WORKSPACE you need to type the following:
- map: /Volumes/WORKSPACE/YourProject
to: /home/vagrant/Code
In Windows case I used this:
- map: e:/GIT/PHP/mathmaps/Code
to: /home/vagrant/Code
P.S. GIT is my workspace folder
running bash init.sh a second time will prompt to overwrite the initial setup, this will also output the directory path you require to edit the correct Homestead.yaml file.
The map: attribute has to be set to the location to where you want to keep your code. For example, I will be saving my code in a folder called code within the Homestead folder therefore, map is:
folders:
- map: ~/Development/Homestead/Code
to: /home/vagrant/Code
Where 'Development' is simply a folder in my home directory where I keep all my code

Resources