Quick guide on installation laravel homestead in OS X

A very quick guide on installation Laravel in your Vagrant within 5 minutes. I will be explained in very roughly, if your are looking for more details please checking laravel home page.

1. Installing VirtualBox & Vagrant

Download and install both VirtualBox and Vagrant if you are not installed yet.Both of it is required in running homestead.

2. Adding Homestead Vagrant box

Open terminal and execute following commands to adding Homestead Vagrant Box. It take quite a long time to download. For me, I take almost 20 minutes to download.

vagrant box add laravel/homestead

3. Clone The Homestead Repository

Clone the git repository by following commands.

git clone https://github.com/laravel/homestead.git Homestead

4. Set your SSH key

Generate the ssh key by following commands. Make sure remember where your save the key. In default, your key will be saved in /Users/{your_name}/.ssh/id_rsa

ssh-keygen -t rsa -C "your@email.com"

It will asked you to enter passphrase. You can leave it empty and keep pressing “enter” key.

5. Create your shared folder

Shared folder sharing item between local environment and homestead environment. So let create a folder and named it Code.

mkdir /Users/{your_name}/Code

Make sure replace {your_name} to your username.

6. Configure Homestead.yaml

The configuration file Homestead.yaml is located inside Homestead directory. Open the file and there are four lines you need to changed. There are authorize path, keys path, shared folders path and sites name.

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: /Users/me/.ssh/id_rsa.pub   # configure your ssh key path

keys:
    - /Users/me/.ssh/id_rsa # configure your ssh key path

folders:
    - map: /Users/me/Code # change to your shared folder path 
      to: /home/vagrant/Code

sites:
    - map: localhost  # change homestead.app to localhost
      to: /home/vagrant/Code/Laravel/public

variables:
    - key: APP_ENV
      value: local

7. Secure login to Homestead environment

Move to Homestead directory where you have cloned just now and startup vagrant and login to Homestead environemnt.

cd Homestead
vagrant up
vagrant ssh

If you are able to login to Homestead environment. You are almost there.

8. Installation Laravel

Almost the end of the guide. After you have login to Homestead environemnt. Move into Code directory and install laravel by Composer.

cd Code
composer create-project laravel/laravel --prefer-dist

Composer is pre-installed in Laravvel/Homestead, so you don’t needs to install composer again.

8. Run it

After laravel is installed, open up your browser and test it with url bottom.

http://localhost:8000/

If you are able to see “you are arrived” messages.

laravel-welcome

Congratulation, you have done with installation. Happy coding!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s