Learning Management Platform for Written Tutorial Series.

Homestead Install

Homestead Install


We covered the basics of virtualization, vagrant and homestead Laravel in the previous tutorial. Let’s now get our hands dirty. In this tutorial, we will use vagrant to add a Laravel homestead box to our virtual machine. We covered the basics of virtualization, vagrant and how to install it in the previous tutorial.

By the end of this tutorial, you will have a fully functional Laravel homestead virtual machine. The following image shows you what you will have by the time that you are done with this tutorial.

Vagrant ssh

Topics to be covered

In this tutorial, we will cover the following topics.

  • Tutorial Pre-requisites
  • Installing Laravel Homestead
  • Vagrant common commands

Tutorial Pre-requisites

The following prerequisites will help you to successfully complete this tutorial.

  • You should be familiar with the basics of virtualization, vagrant and Laravel homestead. If you are not familiar with these concepts, then read the previous tutorial
  • Sufficient internet bandwidth. The homestead box download is close to 1GB. You will have to be prepared to download such a large file.
  • Basic knowledge of the command line will be an added advantage
  • Basic knowledge is Linux commands will be an added advantage
  • You have installed, virtual box, vagrant and Git.
  • You will need a text editor

Installing Laravel Homestead Vagrant Box

Open the command prompt / terminal. I am using windows for these tutorials and I will be using Git bash.

Run the following command

vagrant box add laravel/homestead


  • vagrant box add adds the pre-packaged vagrant box laravel/homestead. This command may take a while if it is the first time that you are downloading the image. The download size is close to 1GB so be cautious on your internet bandwidth and if you have a slow connection the process may take longer.

Wait for the download to complete then proceed to the next section.

Installing Homestead

We will now use Git to clone the homestead repository. The project contains the necessary configurations that will enable the host to communicate with the vagrant box.

Run the following command to browser to the home directory

cd ~

HERE, - ~ represents the home directory. On windows, if your user name is Medusa, the ~ will correspond to the directory C:\Users\Medusa

Run the following git command

git clone https://github.com/laravel/homestead.git Homestead


  • the above command clones the homestead repository into a directory Homestead in the home directory. The above command will also create a configuration directory ~/.homestead

Let’s now have a look at the contents of ~/.homestead directory

Open the file ~/.homestead/Homestead.yaml. Note: on windows, ~ represents C:\Users\{Username}

You should be able to see the following contents

ip: ""
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

    - ~/.ssh/id_rsa

    - map: ~/Code
      to: /home/vagrant/Code

    - map: homestead.app
      to: /home/vagrant/Code/homestead.app/public
    - map: laradmin.app
      to: /home/vagrant/Code/laradmin.app/public

    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp


  • ip: "" sets the IP address that we will be using with our virtual box
  • memory: 2048 sets the memory to 2GB. You can adjust it based on your requirements and availability of RAM on the host machine.
  • cpus: 1 the number of CPUs to use
  • provider: virtualbox sets the provider
  • authorize: ~/.ssh/id_rsa.pub sets the pass to the ssh public key
  • keys:… sets the key for ssh
  • folders:… this is used to map shared folders between the host and virtual machine. The default shared directory for the host operating system is ~/Code and the corresponding directories on the virtual machine is /home/vagrant/Code. You can change them if you want but we will keep the default settings as they are.
  • sites:… maps the sitenames to the public directories in the virtual machine. For example, map: homestead.app maps the domain homestead.app to the directory to: /home/vagrant/Code/homestead.app/public in the virtual machine. Notice the name of the site is the same as the name of the project directory. This is not mandatory but makes logical sense. It is easier to identical that the domain http://homestead.app links to the directory homestead.app. Note: the domain http://homestead.app is only accessible on the local machine
  • databases:… is used to specify the databases that should be created.

We will now map the site name in the configuration file to the IP address. This will be done in the hosts file in C:\Windows\System32\drivers\etc\hosts. On a Mac or Linux, the hosts file is located in /etc/hosts

On windows, search for Notepad and open it as an administrator as shown in the image below

Open notepas as administrator

Click on file menu then select open

Select the file C:\Windows\System32\drivers\etc\hosts

Add the following line homestead.app


  • is the virtual machine IP address that is specified in ~/.homestead/Homestead.yaml. it is mapped to the site name homestead.app. Remember the site homestead.app is mapped to the directory /home/vagrant/Code/homestead.app/public. This means when a user access http://homestead.app, they will be able to see the contents of /home/vagrant/Code/homestead.app/public on the virtual machine.

Let’s now get back to the command line and run the following command

cd ~/Homestead

Run the following vagrant command

vagrant up


  • The up command boots up the vagrant box

Wait for the command to complete. If you run into any errors, use the comments section below to ask.

Assuming the above command executed successfully, you can now login into your virtual machine using the following command

vagrant ssh


  • The above command connects to the virtual machine via SSH.

Vagrant ssh

You should be able to see the following

The above image shows that we have 149 packages that can be updated. The number may vary depending on when you install the package.

Run the following command to update the Ubuntu packages

sudo apt-get update

let’s now look at the contents of the home directory. Run the following command



  • The above directory should show you a directory named Code on the desktop,

Run the following code

cd Code && ls


  • The above command will change the directory to Code and list its contents. You should be able to view the mapped directories that are defined in homestead.yaml

If you want to log out from the virtual machine, run the following command.


Vagrant common commands

The following are some of the most commonly used vagrant commands

S/N Command Description Example
01 vagrant --version Gives you the version of vagrant vagrant –version, vagrant -v
2 vagrant --help Displays the help menu vagrant login
3 vagrant login Allows you to login to your HashiCorp Atlas account.(id) Display product detailed based on product id
4 vagrant status Gives you the current state of the machines. If the machine is running, you will get running. If it is not running, you will get poweroff Dvagrant status
5 vagrant global-status Lists all know vagrant boxes on your machine vagrant global-status
6 vagrant box add {name} Download the named vagrant box from vagrant cloud repository vagrant box add laravel/homestead
7 vagrant box list List all of the available boxes vagrant box list
8 vagrant box update Updates the available vagrant boxes to the latest versions vagrant box update
9 vagrant box remove {name} Removes the named box from vagrant vagrant box remove laravel/homestead --box-version=0.1.7
10 vagrant box outdated Gives you a list of outdated boxes vagrant box outdated
11 vagrant init {name} Used to create a vagrantfile for the specified vagrant box vagrant init laravel/homestead
12 vagrant share Share your vagrant virtual machine with others vagrant share
13 vagrant halt Gracefully shuts down the virtual machine vagrant halt
14 vagrant suspend Suspends the virtual machine. Similar to hibernating your computer vagrant suspend
15 vagrant resume Brings the machine back to life from a suspended state vagrant resume
16 vagrant destroy Complete deletes the virtual machine vagrant destroy
17 vagrant provision Reconfigure the machine after you have made some changes to the configuration file. Useful when you add a new site etc vagrant provision
18 vagrant reload Reloads the virtual machine. This comes in handy when you have modified network settings or the synced folders vagrant reload
19 vagrant push Allows you to deploy your code to your server. This could be a production server or some other servers vagrant push
20 vagrant package Package the running vagrant environment into a box vagrant package

Vagrant has excellent documentation which you can find at https://www.vagrantup.com/docs/


In this tutorial, we have successfully installed and configured a homestead box. We also configured sites and mapped shared directories between the host and the virtual machine.

What’s next?

The next tutorial will look at how to create a new project in Laravel homestead.

Kode Blog Tutorials is dedicated to bring you update to date, high quality free tutorials. You can support us by using the social media buttons to like and share the tutorial and subscribing to our newsletter. Please use the comments section below to give us feedback.

You can sign up for a free account on our site and you will be able to keep track of your progress as you go through the tutorial series.