Updated: 2014-12-5 Lastest version of Homestead is not working in this article. But it is still possible to install Homestead into your windows environment by checkout to old version of Homestead. I will show you how to do it in this article.
Latest version of Vagrant 1.6.3 and VirtualBox 4.3.14 seems to get working in Windows environment. In this article, I want to tell you that you are able to install Laravel Homestead in Windows within 20 minutes (15 minutes for downloading Vagrant box and time for toilet). Well, hope you are able to get every work in 20 minutes.
1. Download the required software
Download all the software on below, we required it when installing Homestead and Laravel
putty and puttygen both softwares are needed. You are able to download on same website, same page. After downloading, install VirtualBox and Vagrant.
2. Adding Homestead Vagrant box
After Vagrant is installed, open the command prompt and execute following commands to adding Homestead Vagrant Box. It take quite a long time to download. For me, I take almost 15 minutes to download.
vagrant box add laravel/homestead
3. Clone The Homestead Repository (v1.0.0)
Updated: 2014-12-5 Make sure you have git installed as we required some git command to change Homestead version. First, clone the repository then move to repository and checkout to v1.0.0 in order to make Homestead work.
git clone https://github.com/laravel/homestead.git Homestead cd Homestead git checkout tags/v1.0.0
4. Generate SSH private and public key by puttygen
Next, open puttygen and you will see the following window. Click Generate button to generate the key.
After you have generate the key, click Save private key and name the key “id_rsa” and click Save public key and name the key “id_rsa.pub”. Be careful, don’t save it in .ppk extension.
Make sure there are two key, public key and private key is generated and not saving in ppk extension.
5. Convert insecure_private_key to insecure_private_key.ppk
We are using putty to secure login to Homestead environment, so we needs to change insecure_private_key to insecure_private_key.ppk to adapt the key to putty. How we do it? By open puttygen up, and click Load button. Load the insecure_private_key located in .vagrant.d directory and click Save private key button to save it in insecure_private_key.ppk. Make sure the ppk extension is attached.
6. Create your shared folder
Create a folder name “Code” and located it at HOME_DIRECTORY. We are going to make this “Code” folder be sharing folder between Homestead environment and Windows environment.
7. Configure Homestead.yaml
Open the configuration file Homestead.yaml located in Homestead Repository. There are few things you needs to change.
--- ip: "192.168.10.10" memory: 2048 cpus: 1 authorize: ~/.ssh/id_rsa.pub # configure your ssh key path keys: - ~/.ssh/id_rsa # configure your ssh key path folders: - map: ~/Code # change to your shared folder path to: /home/vagrant/Code sites: - map: localhost # change homestead.app to localhost to: /home/vagrant/Code/Laravel/public variables: - key: APP_ENV value: local
6. Vagrant Up & Vagrant SSH
Open command prompt and execute Vagrant Up. Make sure you see the following messages.
Next, open putty and set insecure_private_key.ppk path by Connection > SSH > Auth.
Then, go to Session and set the IP address to “127.0.0.1” and Port to “2222”, that showed on command prompt just now.
Then, click “Open” button and login as username “vagrant”. If you are able to secure login. You are almost there.
7. Install Laravel
After you have login into Homestead environment. Move to Code directory and install Laravel by Composer.
cd Code composer create-project laravel/laravel --prefer-dist
It take quite a long time to install. For me, i take almost 3~5 minutes to install it.
8. Run it
After installation is done, run it on your browser by http://localhost:8000/! If you see the message “You have arrived”.
You can start coding in Laravel. Happy coding.
Can’t get it working …
There are many reasons that you can’t get it work. One of the most common problems, is “default: Error: Connection timeout. Retrying…”. I found the answer on stackoverflow, you can give a try on it.
My advice is to do a simple vagrant test before you tried to install Homestead. Maybe if you get the vagrant problems solved, you will get Homestead problems solved too.