A Blog Of Random Coding Techniques & Experiments Robert Askam

Installing Homestead and Laravel 5 Post Installing Homestead and Laravel 5 1 year ago

A guide to install Laravel 5.4 on Linux but can be applied to any operating system.

Virtual Box


Install Virtual Box. In this tutoial I'm using VB 5.1.

Vagrant


Install Vagrant.
Once they have been installed we add the homestead box to Vagrant
vagrant box add laravel/homestead
Choose the option for virtual box and allow it to install fully before moving to the next step.

Homestead


Now clone the Repository from Git that contains homestead. Go to your Home Directory in Terminal. Copy and Run.
$git clone https://github.com/laravel/homestead.git Homestead
$cd Homestead
//Mac/Linux
$bash init.sh
//Windows
init.bat

Laravel


In your Home Directory make a directory called Code and go into it.
$mkdir Code
cd Code
If you have composer installed then skip this code.
sudo apt install composer
To install Laravel run:
composer create-project --prefer-dist laravel/laravel YourBlog
//Error laravel/framework v5.3.10 requires ext-mbstring
sudo apt-get install libapache2-mod-php php
sudo apt-get install php-mbstring
//Install Dom Extension
sudo apt-get install php-xml
If you want to run your project using your local PHP you can just run inside your directory
$cd YourBlog
$php artisan serve

Else in your Homestead/src/stubs/Homestead.yaml and (hidden)Home/.homestead/Homestead.yaml change the sites section to have.
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: local.blog
to: /home/vagrant/Code/MyBlog/public
In your terminal type
sudo nano /etc/hosts
and add at the bottom(IP Address is from top of the YAML file so change accordignly
192.168.10.10 local.blog
Return to Home and into your Homestead Directory and run:
//If you havent created an SSH Key run and hit enter till its done
$ssh-keygen
//Then run
$vagrant up


Go to local.blog in your browser and you should be able to see your new Laravel Site.