Tested on Windows 10. Probably works in 7 and 8. I wrote this after I went through all of it, so let me know if I forgot a step.
In this guide:
- VirtualBox (allows you to run a Linux operating system such as Ubuntu while you are running Windows)
- Ubuntu 16.04 64 (a user friendly Linux installation that will be supported for many years)
- LAMP stack (Linux, Apache, MySQL, PHP - all of the things that you will run your web application on)
- Composer (this just manages your PHP dependencies, such as Laravel)
- Laravel (provides you with a lot of pre-written PHP code to get your web app up and running)
Anywhere you need to run a command inside Ubuntu, I've written it like this:
this is a command you would have to run
Download these files:
http://download.virtualbox.org/virtualbox/5.1.14/VirtualBox-5.1.14-112924-Win.exe
http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-desktop-amd64.iso
Install both of those... Create a new Ubuntu 64 virtual machine inside VirtualBox. Allocate more than the recommended 8gb as it will run out very fast. I went with 3gb2. I also gave it 4096mb of RAM, but you can use whatever you have available.
When you open the Ubuntu VM for the first time, it will prompt you asking for a file... provide it with the Ubuntu .iso
that you just downloaded and you will be guided through the Ubuntu installation process. It's pretty straightforward.
It had been a while for me. Press ctrl
+alt
+t
to open the terminal. That's the only part you really need. You can configure the rest however you want by googling your questions.
Set these to Bidirectional
:
VirtualBox>Settings>General>Advanced>Shared Clipboard + Drag'n'Drop
sudo apt-get install virtualbox-guest-dkms
Restart Ubuntu.
service apache2 stop
sudo apt-get install php7.1 php7.1-common
sudo apt-get install php7.1-cli
sudo apt-get install php7.1-mbstring
sudo apt-get install php7.1-xml
sudo apt-get install php-zip
sudo apt-get update
php -v
(just to make sure it's at 7.1)
sudo apt-get purge php7.0 php7.0-common
service apache2 start
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo apt install composer
sudo composer global require "laravel/installer"
sudo nano /etc/profile
Add this to the top of the file:
# For gaining access to dependencies installed by Composer:
PATH="$PATH:$HOME/.composer/vendor/bin"
Restart Ubuntu.
Check these docs for configuration:
https://laravel.com/docs/5.4#installation
cd
to the directory you want the project to be in.
laravel new project-name-goes-right-here
Start developing. Refer to the Laravel docs from here out:
**Note that this solution isn't the best and is user specific.
sudo visudo
Modify the line that looks like:
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
To have the composer path on the end of it: (edit YOUR_USERNAME
)
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/YOUR_USERNAME/.composer/vendor/bin"
https://gist.github.com/Lemmings19/26bc8675c84d86576a92f7366d733f4c