Virtual Box with Ubuntu 14.04 LTS
Step 1 : Watch Video at LaracastGet Off MAMP
1. Step 2 : Install Virtual box and Vagrant Virtual Box
2.Vagrant
Select a folder for your develpment code.
Add the below alias to your ```~/.bashrc``` file or ```~/.bash_profile``` Step 3: Add the Alias
``` 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
cd to your desired directory in the Terminal, and run lamp to install your LAMP stack. Step 4: Install
This will take a few minutes as your intenet connection.
RUN ```vagrant up``` to start your virtual dev machine. Step 5: Done. Go Poke Around.
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.
Edit your hosts file to set a simpler address, like Extra-1http://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.
By default, Apache will set your document root to ```/var/www/html```. If you don't want this... Extra-2
$ 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
.
Maybe you want to run all of your sites and demos within this VM. Here's how. Extra-4: Multiple Websites With the Same VM
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
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. Extra-4
sudo a2ensite larabook
sudo service apache2 reload
Refer : For More Extra credits Github Jeffrey Way
Enjoy development with PHP.
Make an alias that points this your folder. edit your : ```source ~/.bashrc``` Power Command
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