There seems to be a lot of confusion on the web when it comes to creating a local laravel development enviroment in Linux. I would like to show a really fast way to get up and running. The following method was tested in Linux MInt. I will add instructions for Windows too.
System Requirements
- VirtualBox
- Allows you to run virtual enviroments
- Vagrant
- Vagrant is a tool that will install a complete virtual development environment. (Aapache, PHP, Mysql
- Composer (Optional)
- PHP Package Manager)
- nodejs (Optional)
- Needed by Gulp which will be used to compile the frontend stuff css, js)
Composer & nodejs are optional since they are already installed in your vagrant enviroment, however I strongly recommend installing them directly in your system because they work faster than in the virtual machine.
Linux - Installing Tools.
Run the following commands
Install Virtual Box
sudo apt-get install virtualbox
Install Vagrant
sudo apt-get install vagrant
Install Composer
sudo apt-get install composer
Install Nodejs
sudo apt-get install nodejs-legacy
Creating a new virtual enviroment.
In this case we will use a vIrtual enviroment called Scotchbox. It comes with absolutely everything a Web Developer will ever need.
You can install it by running or downloading that repo from github here:
git clone https://github.com/scotch-io/scotch-box.git my-project
Note that Vagrantfile where you define the IP Address you would like to use for this vvirtual enviroment.
Start Virtual Environment/Vagrant
Open a new terminal and go to your project's folder. (Where your vagrant file is located) and run:
vagrant up
This will download a Linux box with all tools you will ever need preinstalled.
To access your Virtual Enviroment using ssh
vagrant ssh
Done! At this point you have a fully working Virtual Enviroment. Now open 192.168.33.10 in your browser and you will see the website from your virtual enviroment.
Happy coding!