jrvaja / vagrant14.04

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Virtual Box with Ubuntu 14.04 LTS

Step 1 : Watch Video at Laracast

Get Off MAMP

Step 2 : Install Virtual box and Vagrant

1.Virtual Box
2.Vagrant

Select a folder for your develpment code.

Step 3: Add the Alias

Add the below alias to your ```~/.bashrc``` file or ```~/.bash_profile```
``` alias lamp="curl -L -o 'install.sh' https://goo.gl/xQR4ud && curl -L -o 'Vagrantfile' https://goo.gl/TMPyh2 && vagrant up" ```

Provide source to your ~/.bashrc file or ~/.bash_profile Ex : source ~/.bashrc

Step 4: Install

cd to your desired directory in the Terminal, and run lamp to install your LAMP stack.

This will take a few minutes as your intenet connection.

Step 5: Done. Go Poke Around.

RUN ```vagrant up``` to start your virtual dev machine.

You can connet to ssh by the below command vagrant ssh

Now, All is set.

If you cd to /vagrant, this folder will be shared with your project root on your local/host machine. That means, when you create a file on your Mac, it will instantly be shared (both ways) with the /vagrant directory on your VM. However, we're also syncing with the /var/wwwdirectory on your VM, which is the Apache root. That means, if you visit http://192.168.33.21, you should see "It Worked!" You can change the IP address in your Vagrantfile, if you need to.

Have fun! This also installs and enables X-Debug for you. You can stop using MAMP now.

Extra-1

Edit your hosts file to set a simpler address, like http://app.dev/. ``` sudo vi /etc/hosts ``` At the bottom of this file, add:
192.168.33.21 app.dev

Now, browse to http://app.dev.

Extra-2

By default, Apache will set your document root to ```/var/www/html```. If you don't want this...
$ vagrant ssh
$ sudo vim /etc/apache2/sites-available/000-default.conf
(Change `DocumentRoot /var/www/html` to `DocumentRoot /var/www`)
$ sudo service apache2 reload

Reload the browser. Now, your local project root will be treated as Apache's document root. Typically, though, you'll want to set Apache's document root to something like the public directory - so DocumentRoot /var/www/public .

Extra-4: Multiple Websites With the Same VM

Maybe you want to run all of your sites and demos within this VM. Here's how.

For this example, maybe we're building a new app, called "Larabook." Begin by creating a new directory, "larabook" within the same directory that has the Vagrantfile that you pulled in during Step 3. Add a dummy index.php file here, just to prove that it's working.

$ vagrant ssh
$ cd /etc/apache2/sites-available/
$ sudo cp 000-default.conf larabook.conf

Open `larabook.conf, and set:

ServerName larabook.local
DocumentRoot /var/www/larabook

Extra-4

You don't have to for this example, but you'd probably want to add some additional config to this file - like: ``` Options -Indexes +FollowSymLinks AllowOverride All Require all granted ``` Next, enable the new vhost, and reload Apache.
sudo a2ensite larabook
sudo service apache2 reload

For More Extra credits

Refer : Github Jeffrey Way

Enjoy development with PHP.

Power Command

Make an alias that points this your folder. edit your : ```source ~/.bashrc```
alias dev-up="cd ~/Code; vagrant up"

Get ssh rights to machine

alias dev-ssh="cd ~/Code; vagrant ssh"

you can add your custom aliases to make your work much easy.

Thanks to Jeffrey Way

About


Languages

Language:Shell 100.0%