Contact Information


We're Available 24/ 7. Drop us an email.

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 // 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: 2048cpus: 1provider: virtualboxauthorize: ~/.ssh/id_rsa.pubkeys: - ~/.ssh/id_rsafolders: - map: ~/Code to: /home/vagrant/Codesites: - map: to: /home/vagrant/Code/ - map: to: /home/vagrant/Code/ - 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/ 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: maps the domain to the directory to: /home/vagrant/Code/ 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 // links to the directory Note: the domain // 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


  • is the virtual machine IP address that is specified in ~/.homestead/Homestead.yaml. it is mapped to the site name Remember the site is mapped to the directory /home/vagrant/Code/ This means when a user access //, they will be able to see the contents of /home/vagrant/Code/ 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

01vagrant --versionGives you the version of vagrant vagrant –version, vagrant -v
2vagrant --helpDisplays the help menuvagrant login
3vagrant loginAllows you to login to your HashiCorp Atlas account.(id)Display product detailed based on product id
4vagrant statusGives you the current state of the machines. If the machine is running, you will get running. If it is not running, you will get poweroffDvagrant status
5vagrant global-statusLists all know vagrant boxes on your machinevagrant global-status
6vagrant box add {name}Download the named vagrant box from vagrant cloud repositoryvagrant box add laravel/homestead
7vagrant box listList all of the available boxesvagrant box list
8vagrant box updateUpdates the available vagrant boxes to the latest versionsvagrant box update
9vagrant box remove {name}Removes the named box from vagrantvagrant box remove laravel/homestead --box-version=0.1.7
10vagrant box outdatedGives you a list of outdated boxesvagrant box outdated
11vagrant init {name}Used to create a vagrantfile for the specified vagrant boxvagrant init laravel/homestead
12vagrant shareShare your vagrant virtual machine with othersvagrant share
13vagrant haltGracefully shuts down the virtual machinevagrant halt
14vagrant suspendSuspends the virtual machine. Similar to hibernating your computervagrant suspend
15vagrant resumeBrings the machine back to life from a suspended statevagrant resume
16vagrant destroyComplete deletes the virtual machinevagrant destroy
17vagrant provisionReconfigure the machine after you have made some changes to the configuration file. Useful when you add a new site etcvagrant provision
18vagrant reloadReloads the virtual machine. This comes in handy when you have modified network settings or the synced foldersvagrant reload
19vagrant pushAllows you to deploy your code to your server. This could be a production server or some other serversvagrant push
20vagrant packagePackage the running vagrant environment into a boxvagrant package

Vagrant has excellent documentation which you can find at //


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.

Rodrick is a developer who works on Desktop, Web and Mobile Applications. He is familiar with Python, Java, JavaScript, C++, C#, Kotlin, PHP, Python and the list goes on. Rodrick enjoys sharing knowledge especially when it comes to technology.

Homestead Laravel Hello World

Leave A Reply