Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Install Laravel 5 Framework on Ubuntu 18.04 & 16.04

Rumi, October 9, 2019October 9, 2019

Below is the system requirements for the installation of latest Laravel application on your system.

PHP >= 7.2
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
BCMath PHP Extension

Step 1 – Install LAMP

To start with Laravel, we first need to set up a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to set up the lamp on Ubuntu system.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2 php7.2-mcrypt php7.2-gd php7.2-mbstring php7.2-xml

Install PHP Mcrypt Extension & Install Apache2

sudo apt-get install apache2 libapache2-mod-php7.2

Install MySQL

sudo apt-get install mysql-server php7.2-mysql

Step 2 – Install Composer

The composer is required for installing Laravel dependencies. So use below commands to download and use as a command in our system.

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

Step 3 – Install Laravel

Download the latest version of Laravel from the official git repository. Use the below command to clone the master branch of the Laravel from GitHub.

cd /var/www
git clone https://github.com/laravel/laravel.git

Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.

cd /var/www/laravel
sudo composer install

The dependencies installation may take some time as per your network speed. After successfully installing all dependencies, set the proper permissions on all files.

chown -R www-data.www-data /var/www/laravel
chmod -R 755 /var/www/laravel
chmod -R 777 /var/www/laravel/storage

Step 4 – Setup Encryption Key

Now, rename the .evn.example file to .env in projects main directory. This will use to setup application environment for the project.

mv .env.example .env

Now generate base64 random number encryption key, which used by the Illuminate encrypter service.

php artisan key:generate
Application key set successfully.

Edit the .env configuration file and update the required settings. Also, make sure APP_KEY is properly set as generated in above command.

vi .env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:HFdS7c9rhDp+AeHu7kc2OLBPuxHqq2BQ/1gfFWEpoAk=
APP_DEBUG=true
APP_URL=http://localhost
...

Step 5 – Create Database for Laravel (Optional)

You may also require creating a database for your Laravel application. Login to your MySQL server and create MySQL database and user.

mysql> CREATE DATABASE laravel;
mysql> GRANT ALL ON laravel.* to 'laravel'@'localhost' IDENTIFIED BY 'secret';
mysql> FLUSH PRIVILEGES;
mysql> quit

Now edit the .env file and update database settings.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret

Step 6 – Apache Configuration

Edit Apache default virtual host configuration file 000-default.conf and update DocumentRoot to Laravel public directory as below:

vim /etc/apache2/sites-enabled/000-default.conf

also add some more configuration.

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/laravel/public

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/laravel>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Reload Apache configuration changes by restarting service using below command

sudo service apache2 restart

Step 7 – Access Laravel Application

You have successfully configured the Laravel 5 PHP framework on your system. Access Laravel application in your favorite web browser. Let’s start building an awesome application using Laravel 5 PHP Framework. Thanks.

Administrations Configurations (Linux) LaravelUbuntu 16

Post navigation

Previous post
Next post

Comment

  1. Pingback: Deploy a Laravel app on Oracle Cloud with database | Bots!

Leave a Reply Cancel reply

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

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes