Install Laravel 5 On Ubuntu 14.04

References:

1. https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/

2. https://laravel.com/docs/5.2

How to install:

  1. Laravel uses composer much for installation. So first check the composer version (I already installed the composer) through the terminal.

    Here is the result for my system.

    check_composerMy composer version is 1.0-dev. It says my composer version is over 60 days old. Let update it.

    But the result shows complain about permission.

    composer_update_errorHere we need ‘sudo’ to update it.

    Here is the success result. composer_update_sudoOkay. Lets check it again. check_composer2My latest composer version is  1.2-dev.
  2. Ready to install Laravel. First I need to go in laravel directory in Documents/works/. Then there are two ways how to install it. They are ‘Laravel Installer’ and ‘composer create-project’. Somehow Laravel Doc mention the installer first. I dont know which one is the best but this QA from stackoverflow can give a perspective. First I used ‘composer create-project’ way to create a new project ‘mylaravelproject’. Here is the installation:

    Here is the files and directories are created. laravel_files_createdIt seems ‘composer create-project’ installation download all the component required to start developing laravel project at one shot! Please see all component in ‘vendor’ directory. Before I try to give a shot on this new installation, I need to set some permission on a few directories suggested on the laravel doc like ‘storage’ and ‘bootstrap/cache’.

    set_permissionNow, I am ready to try it on my web browser. Many article suggest to setup a virtual host but I want to test it right away without it. I can use PHP CLI to do that. Here is the command on my linux terminal.

    PHP CLI is running.

    php_cli_runningOpen it on the web browser with url:

    Here is the welcome screen.

    laravel welcome screen
    laravel welcome screen

    The another way is to use ‘Laravel Installer’. From this stackoverflow QA, this way seems to download just required ‘vendor’ component/bundle. It may be for the expert level that needed more thought about laravel (CMIIW). I hope I can learn it later.

  3. Setup the virtualhost. after the successful first try, I think it need to setup a virtualhost config so I dont need to run/stop the PHP CLI on my linux terminal everytime when I want to give it a try. First, I need to create a new apache configuration file. I name it ‘mylaravel.conf’.

    apache_conf_fileHere is the file content.

    Make sure the ‘Document root’ path is written correctly. the entry ‘Require all granted’ is required here or I would get an error like this: ‘Forbidden You don’t have permission to access / on this server’. Then I need apache to enable the site and reload it.

    Here is the process.

    ‘mylaravel’ on ‘sudo a2ensite mylaravel’ is the config file name without .conf extension. then I need to register the site so I can open it through localhost with this command ‘sudo gedit /etc/hosts’.

    then add this entry in the ‘hosts’ file.

    then restart the apache server ‘sudo service apache2 restart’. Now I can open it through my web browser with this url: http://mylaravelproject.dev/
  4. The next step is to learn more about laravel like Application Structure, Configuration, Router, etc. This tutorial Laravel Tutorial and Belajar Laravel Ala Indonesia are worth to be read. I hope I can write my experience on this blog someday.

Leave a Reply

Your email address will not be published. Required fields are marked *