Set up Laravel 5.6 environment in under 5 minutes on Mac / Ubuntu

in #laravel6 years ago

Why Laravel?

Laravel is one of the most popular php frameworks. When I first started learning Laravel I found that the setting up of the dev environment was the hardest part. I have created a tutorial below which I believe is the fastest and easiest way to get started on a mac. It should also work on Ubuntu.

Requirements

Before starting make sure you have the following installed

Install Laravel

  • Open terminal and navigate to the folder where you would like to create your project (using 'cd' if you're a total beginner see https://computers.tutsplus.com/tutorials/navigating-the-terminal-a-gentle-introduction--mac-3855 step 5)
  • composer create-project --prefer-dist laravel/laravel blog to create a folder called blog which contains your new laravel project. Replace blog at the end of the command with the name of your project.
  • Cd into your project cd blog
  • run composer require laravel/homestead --dev which will set up homestead to run laravel on your machine
  • run php vendor/bin/homestead make
  • run vagrant up this can take some time to download the virtual machine
  • next you should run the command sudo nano /etc/hosts it will ask for your password. This is the password that you use to log into your mac.
  • use the down arrow to go to the bottom of the file and add a new row in and paste the following 192.168.10.10 homestead.test
  • Press Ctrl + o to save the document and Ctrl+x to exit
  • You should now be able to access your project in the browser by going to http://homestead.test

You can also:

  • run vagrant ssh to ssh into your virtual machine to run migrations etc. This will be useful as you get to know the system.

The Docs

Best places to start:

Hopefully I helped somebody get started with laravel using this post. I am new on steemit and will be posting more laravel content shortly. I found when learning laravel that setting up the envoronment was the main hurdle. Once this is set up learning the docs and code is a breeze!

If you have any laravel questions ask them below and I will try my best to answer them.

Thanks! Dont forget to vote up!

Sort:  

Either you run the day or the day runs you.

Very true

Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years.

good advice!

Coin Marketplace

STEEM 0.15
TRX 0.12
JST 0.025
BTC 56002.99
ETH 2458.17
USDT 1.00
SBD 2.28