Skip to content

Instantly share code, notes, and snippets.

@midascodebreaker
Last active March 15, 2022 10:09
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save midascodebreaker/95d5e30012c2f875840481442e7eb04c to your computer and use it in GitHub Desktop.
Save midascodebreaker/95d5e30012c2f875840481442e7eb04c to your computer and use it in GitHub Desktop.
Laravel Homestead per Project Installation on Windows 10
Prerequisite:
  • Php7
  • Composer
  • Gulp
  • Npm
  • Vagrant
  • Virtual Box
  • Laravel Installer

1.) Create a New Laravel App

laravel new blog

2.) Create a New Homestead Installation

composer require "laravel/homestead" --dev

3.) Update Composer

composer update

4.) Generate Homestead.yaml file

vendor\\bin\\homestead make

5.) Edit Homestead.yaml file

OPTIONS

A.) ENABLE NFS
folders:
    - map: "C:/Users/USER/Code/project"
      to: "/home/vagrant/project"
      type: nfs
      mount_options: [nolock,vers=3,udp,noatime]
B. HHVM ENABLED
sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
      hhvm: true
C.) CRON ENABLED
sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
      schedule: true
D.) MARIADB ENABLED
mariadb:true

6.) PROVISION SERVER

vagrant up

7.) SSH TO SERVER

vagrant ssh

8.) Configure Vagrant Based On Options Enabled

A.) Make sure You Have NFS Installed Follow this Instruction
https://github.com/winnfsd/vagrant-winnfsd
B.) HHVM Enabled
hhvm --version

it should show something like this.

HipHop VM 3.14.1 (rel)
Compiler: tags/HHVM-3.14.1-0-gd99b370804b7e0234ab794869d1ba1774c848e85
Repo schema: ac0c6851ba5643ce00ae67bbe67c50973efd65d6
C.) Cron Enabled
cd /etc/cron.d

add this

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
D.) MARIA DB Enabled

check if maria db installed

mysql -u homestead -p
password: secret

it should show something like

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 41818
Server version: 10.1.14-MariaDB-1~xenial mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

9.) Edit Host File (Local Machine)

add ip address based on your Homestead.yml file

192.168.XX.XX domainname.app

10.) Run Npm Install (Local Machine)

npm install

11.) Test to Run Gulp (Local Machine)

gulp

1.) Add MariaDB in Your Homestead.yml

mariadb:true

2.) Provision Server

vagrant u p

3.) Manually Install HHVM

SSH to Server
vagrant ssh
Change to Root User
sudo su -
Install HHVM
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add -
apt-get update
apt-get install -y hhvm
Configure HHVM To Run As Homestead
service hhvm stop
sed -i 's/#RUN_AS_USER="www-data"/RUN_AS_USER="vagrant"/' /etc/default/hhvm
service hhvm start
Start HHVM On System Start
update-rc.d hhvm defaults
Logout Root
exit
Edit Homestead.yaml
hhvm: true
Provision Again Vagrant
vagrant reload --provision
@quynv-rikkei
Copy link

I have a question: I still have to install PHP, Composer on Local machine to can use Homestead per Laravel project ? If use globally Homestead config, I don't have to install PHP, Composer on Local machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment