How to install laravel homestead
Laravel Homestead is an one of the delightful officail pre-package vagrant box for laravel development and It is open sourced, So it will runs on all the operating systems.
Vagrant box which is used to run laravel project in local virtual machines. So that user no need to install php , apache, wamp, xampp or mamp.
Vagrant box is defaultly having php and ngix server to develop a project.
Before you install homestead make sure you have installed below packages
Install Vagrant :
Download and Install Vagrant which suits your operating system.
Install Virtualbox :
Download and Install Virtualbox
Double click Orcle VM virtual box Icon, It will open virtual box.
Lets start to install Homestead for your project.
Install Laravel Homestead to Vagrant box
Once Virtual box has installed, Now we need to add Laravel Homestead to Vagrant box by running the below command.
vagrant box add laravel/homestead
If this command gets fails, Please make sure are you using updated vagrant.
Now we have added homestead box, So we need to start installing homestead.
Just we need to clone the homestead folder within your home directory.
git clone https://github.com/laravel/homestead.git Homestead
Once you cloned run bash.init.sh inside homested directory, It will create the Homestead.yaml
How to configure Homestead :
There are two ways of accessing projects using Homestead box.
1. Access all the sides by using common box.
2. Creating induvidual box for each projects.
I will prefer the second way, Because you can easily access this project by another system also.
Step 1 :
Create Laravel project in your Home directory :
composer create-project laravel/laravel MyApplication --prefer-dist
Step 2 :
Add Homestead to your laravel folder
composer require laravel/homestead --dev
It will add Laravel homestead to your folder
broadband:MyApplication marimuthu$ composer require laravel/homestead --dev
Using version ^3.0 for laravel/homestead
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing laravel/homestead (v3.0.2)
Loading from cache
Writing lock file
Generating autoload files
> php artisan optimize
Generating optimized class loader
Compiling common classes
Step 3 :
Create Homestead.yaml and Vagrant by running below command
For Linux or MAc
php vendor/bin/homestead make
broadband:MyApplication marimuthu$ php vendor/bin/homestead make
My Homestead file:
- map: "/Users/marimuthu/secondApp"
- map: secondapp.dev
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
My Vagrant file :
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
if File.exists? homesteadYamlPath then
elsif File.exists? homesteadJsonPath then
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
Step 4 :
Run Vagrant up command.
broadband:secondApp marimuthu$ vagrant up
It will add your laravel project to vagrant box and create local virtual server.
Step 5 :
Add your hosts to hosts file
For Mac or Linux :
sudo nano /etc/hosts
For Windows :
Add your hosts in your hosts file
Step 6 :
Now you have successfully added homestead for laravel.
Open your browser and enter url as myApplication.dev and run it will run the Laravel project.
Thanks for reading this article. If you like this article don’t forget to share and comment.