First Published 31/10/2019

Contents

Prerequisites

Installation

  1. In the Homestead.yaml file create a new site mapping to this directory: to: /home/vagrant/[project_dir]/[project_name]/public/web.
  2. Create new homestead site composer create-project --prefer-dist laravel/laravel [project_name]
  3. Create a new database for the Homestead site called craft_homestead
  4. Create a second database for the Craft installation called craft
  5. Navigate to your new site’s public directory and edit the .env file. Add the credentials for the craft_homestead database.
  6. Navigate to the Homestead directory and run vagrant ssh. Now move into the new project directory cd [project_dir]/[project_name]and run the migration: php artisan migrate. Once this has completed exit the ssh connection.
  7. Navigate to your new site’s public directory and empty the contents cd [project_name]/public then run sudo rm -rf *
  8. Move back to the root of the new site and install Craft in the public directory composer create-project craftcms/craft public/
  9. You can now run the Craft setup wizard from the browser, go to http://[project_name]/index.php?p=admin/install. When prompted for the database details enter the credentials for the craft database we created earlier.
  10. Once installed your site will be ready at http://[project_name]/.

Updating php.ini directives

  1. Once installed Craft may show some errors in the Requirements area of the System Report — admin > Utilities > System Report. To fix these we need to make changes to the php.ini file on the vm.
  2. Navigate to the Homestead directory and run vagrant ssh.
  3. The php version Craft is using can be found at the top of the System Report page.