Homestead
We are currently unable to offer support for the configuration of Homestead, or any issues associated during the installation process.
Laravel Homestead is a pre-packaged Vagrant box that provides a development environment without requiring you to install any server software on your local machine.
Step 1: Enable hardware virtualization
Modern CPUs include hardware virtualization features that help accelerate virtual machines created in VirtualBox. We recommend consulting your computer's user guide on how to enable VT-x/AMD-V in your BIOS or UEFI firmware.
Step 2: Install VirtualBox and Vagrant
Firstly, you'll need to download VirtualBox 6.x. Select the Windows hosts binary and run the installer.
Next we'll head over to the Vagrant download page and select the Windows link. Follow the prompts on the installation wizard.
Once complete, you can confirm Vagrant is on your machine by typing the following command into a PowerShell window:
vagrant -v
Step 3: Install the Homestead Vagrant box
Open up a PowerShell window and run the following command:
vagrant box add laravel/homestead
The download may take several minutes, depending on your internet connection.
Step 4: Install Homestead
The Homestead GitHub repository needs to be cloned to your local machine.
If you have not yet installed Git on your machine, head over to gitforwindows.org to download.
With Git available on your machine, run the following command from within a PowerShell window:
git clone https://github.com/laravel/homestead.git ~/Homestead
This will create a copy of the repository in a new folder named Homestead
within your home directory.
Next, you'll need to create a default Homestead.yaml
file which will serve as the instructions to configure your virtual machine. This can be done using the following commands:
cd ~/Homestead
git checkout release
./init.bat
If you open the newly created Homestead.yaml file, you should see a format similar to this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: C:\Users\user\.ssh\id_rsa.pub
keys:
- C:\Users\user\.ssh\id_rsa
folders:
- map: C:\Users\user\Code\myfirststore
to: /home/vagrant/myfirststore
type: "nfs"
sites:
- map: myfirststore.test
to: /home/vagrant/myfirststore/public
php: "7.4"
databases:
- homestead
features:
- elasticsearch:
version: "6.8.6"
The authorize
and keys
properties specify the SSH key pair that will be used to connect to the virtual machine. You can generate the id_rsa
files using the command below in a PowerShell window. There is no need to enter any information when prompted, so just hit enter to use the default values.
ssh-keygen
The folders
property lists all of the folders to be shared between your Windows host and the virtual machine. This allows you to develop using your local IDE (code editor), whilst also providing the web server and other services on the virtual machine access to the project files.
The ~/
syntax is not valid when running on Windows. Instead use the full path, e.g. C:\Users\user\myfirststore
In the example Homestead.yaml
shown above, we've specified to share the C:\Users\user\Code\myfirststore
folder. This is going to be the local directory of our new Aero project, however the folder does not yet exist. Create a directory using Windows Explorer and update the Homestead.yaml
file.
This empty directory will be populated later on, from within the virtual machine. The to
value of this folder mapping is the project's path on the virtual machine, e.g. /home/vagrant/[project-name]
.
The sites
property allows you to define which domains will provide access to the projects. Using the example above, you can see the myfirststore.test
domain is configured to point to the project's public
directory, which is the web server entry point to the project. Ensure the to
value is the virtual machine's project path and not the local one, i.e. /home/vagrant/[project-name]/public
. Remember to replace [project-name]
with the name of your project.
Homestead will automatically create the databases listed in the database
property of the configuration file. By default, the database name is homestead
. The installer will automatically detect this database later on, however, if you plan on developing multiple projects, you should name the databases in this list to match your projects.
Finally, you need to ensure that your Homestead.yaml
configuration file contains elasticsearch
in the features
property, along with the version: 6
declaration.
Step 5: Add the domain to the hosts file
As the project is hosted locally, we need to add an entry to the C:\Windows\System32\drivers\etc\hosts
file, which will route all requests made to the development domain to your project.
Press the Windows key and type notepad in the search field. Right-click on Notepad in the search results and select Run as administrator. Open the C:\Windows\System32\Drivers\etc\hosts
file and add the following line, replacing [project-name]
with the domain name entered in the sites property of your Homestead.yaml
configuration file:
192.168.10.10 [project-name].test
Save the file and close Notepad.
Step 6: Add the NFS for Vagrant plugin
A plugin is required when using NFS to sync folders on Windows and will maintain the correct user / group permissions. To install the plugin, run the command in a PowerShell window:
vagrant plugin install vagrant-winnfsd
You'll then need to open up the Vagrantfile
found in your Homestead directory and add the following line to the end of the file (within the config area):
config.vm.network "private_network", type: "dhcp"
Step 7: Provision the virtual machine
You are now ready to boot up the virtual machine. To do so, open a PowerShell window and navigate to the directory that Homestead was installed in earlier. You can then run the vagrant up
command, which will read from the Homestead.yaml
file and configure the virtual machine. The virtual machine must be ran with administrator privileges to ensure files are synced correctly.
cd ~/Homestead
Start-Process powershell -Verb runAs
vagrant up
Step 8: Install the Aero Commerce CLI tool
The CLI tool needs to be installed on the virtual machine. To do this, SSH into the virtual machine using the following command from a PowerShell window:
vagrant ssh
From within the virtual machine you will need to set the default PHP version by running:
php74
Next, download the command‑line tool using Composer:
composer global require aerocommerce/cli
Once installed, you'll have access to the aero new
command, which needs to be ran from within the project directory on the virtual machine. For instance, running aero new .
from within the directory myfirststore
will scaffold an Aero project with all dependencies installed:
cd ~/myfirststore
aero new .
During installation, you'll need to enter the package repository credentials and database connection details for the project. The installer will setup the database tables and seed the project with essential information.
You can now open your web browser and visit your newly created ecommerce store!