If you instead want to install Laravel on an online server, here my new article on how to install on a Digital Ocean:
worldorder.wiki/2018/03/15/how-to-install-the-laravel-php-framework-on-digital-ocean/
I have only been learning Laravel for a year, but below is the Homestead install process which has worked best for me. Homestead is Laravel’s own development environment, powered by Vagrant. (Replace all references to “ProjectName” with a short name for your own project.)
- Install XCode from the App Store. Open it, and accept the user agreement.
- Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Install Vagrant: https://www.vagrantup.com/downloads.html
- To the command line (Mac OS Terminal, or iTerm)! Create local ssh key, if you haven’t on this computer before:
$ ssh-keygen -t rsa -C "your@emailaddress.com"
- Install Composer, Homestead, and initialize:
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer $ mkdir ~/web $ mkdir ~/web/sites $ mkdir ~/web/sites/ProjectName $ cd ~/web $ git clone https://github.com/laravel/homestead.git Homestead $ cd Homestead $ bash init.sh
- Edit paths in Homestead.yaml:
$ nano ~/.homestead/Homestead.yaml
Change this chunk of code:
folders: - map: ~/Code to: /home/vagrant/Code sites: - map: homestead.app to: /home/vagrant/Code/Laravel/public
To this chunk of code:
folders: - map: ~/web/sites/ProjectName to: /home/vagrant/Code sites: - map: homestead.app to: /home/vagrant/Code/ProjectName/public
- Edit the hosts file:
$ sudo nano /etc/hosts
Add one line to the bottom:
192.168.10.10 homestead.app
- Launch your local server (“vagrant up”), log into it, and install Laravel!…
$ cd ~/web/Homestead $ vagrant up $ vagrant ssh $ cd /home/vagrant/Code $ composer global require "laravel/installer" $ composer create-project laravel/laravel ProjectName "5.3.*"
Now you should be able to confirm your successful installation by pulling up http://homestead.app/ in your browser!
- If you like, you can now connect to your server’s database with something like Sequel Pro, and the following default login info…. Host: 127.0.0.1 , Username: homestead , Password: secret , Port: 33060 , Database: homestead .
And you’re ready to start installing more Laravel packages and building your own world. Here, inside your virtual vagrant server via SSH, you can enter your new project’s main composer directory (/home/vagrant/Code/ProjectName), which displays in your actual machine’s file system in ~/web/sites/ProjectName/ProjectName (that’s within your main user account folder alongside Documents, Pictures, etc).
$ cd ProjectName
You could do things like install Laravel’s out-of-the-box user authentication tools:
$ php artisan make:auth
Or install the SurvLoop software I’ve started: https://packagist.org/packages/wikiworldorder/survloop
Or anything else you can imagine: https://laravel.com/docs/5.3