===================================
Open your terminal using Ctrl+Alt+T
and type the following commands
##Step 1: Update & Upgrade
sudo apt-get update
sudo apt-get upgrade
##Step 2: Install PHP
sudo apt-get install php7.0-cli php7.0-zip php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0 php7.0-mysql
##Step 3: Install Composer
sudo apt-get install composer
##Step 4: Install Laravel
composer global require "laravel/installer=~1.1"
##Step 5: Add composer to path to access laravel globally
export PATH="~/.config/composer/vendor/bin:$PATH"
##Step 6: Create a new Laravel application
laravel new testapp
##Step 7: Install missing packages and their dependencies
cd testapp
composer install
##Step 8: Generate APP_KEY for testapp
php artisan key:generate
##Step 9: Test the application
php -S localhost:8888 -t public
Open a web browser and visit localhost:8888
to see the laravel welcome page
##Step 10: Configuring Database
Terminate php server in terminal by pressing Ctrl+C
Download mysql-server by typing the following command in the terminal
sudo apt-get install mysql-server
Once done, login to mysql shell
mysql -u root -p
Enter your root password
Create a new user
CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'laravel';
GRANT ALL PRIVILEGES ON * . * TO 'laravel'@'localhost';
Thus you have successfully create a new user 'laravel' with the password 'laravel' and full privileges.
Now, logout from mysql shell by typing \q
and login again from laravel user
mysql -u laravel -p
Enter password as laravel
Create a new database 'testapp'
create database testapp;
Logout from mysql shell by typing \q
##Step 11: Connect 'testapp' to 'mysql' database Open your .env file in 'testapp' directory
nano .env
Inside .env file, set
DB_DATABASE=testapp
DB_USERNAME=laravel
DB_PASSWORD=laravel
Save the file by pressing Ctrl+O
followed by Enter
. Exit nano editor by pressing `Ctrl+X'
Run migrations to create tables in mysql database
php artisan migrate
Thus you have successfully installed laravel and configured it to use mysql.
Nice tutorial, thank you!
An easy way to try out Laravel in action is to use Laravel 5 Boilerplate / Starter Kit - https://github.com/Labs64/laravel-boilerplate
This is also offering Docker container, with this you don’t need a local PHP (composer, node.js, etc.) environment and can start to evaluate Laravel right away.