How to Install Laravel 8 on Ubuntu 20.04

How to Install Laravel 8 on Ubuntu 20.04

Laravel 8 released on September 8, 2020. Starting with this release, major releases will be released every 6 months in February and August, while minor releases and patches will be released every week. Laravel 8 is not a Long Term Support (LTS) version, bug fixes are supported until March 8, 2021 and security fixes are supported until September 8, 2021. Laravel 8 release information can be read in full at Release Notes.

Support policy
Support policy

Server Requirements

Server requirements that must be met to run Laravel 8:

  • PHP >= 7.3
  • BCMath PHP Extension
  • Ctype PHP Extension
  • Fileinfo PHP extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Install Composer

Laravel uses Composer to manage its dependencies. So, before installing Laravel, install Composer first.

Install Composer:

Install PHP

Install PHP and the required extensions:

Install Laravel

Install Laravel 8.0 using Composer and save it in the /home/user/public_html/blog folder:

If you don’t specify a version number, the latest version of Laravel is installed:

Running Laravel with a Development Server

Running Laravel using a development server:

The results of the above command run the development server with IP address (localhost IP) and port 8000:

Browse atau http://localhost:8000.


Running Laravel with Apache

Install Apache web server:

Restart apache2 service:

URL address can be changed to a hostname or local domain using Apache virtual host and the file /etc/hosts.

Create a virtual host with the name laravel.web:

Enter the virtual host configuration:

Enable virtual host and Apache rewrite module:

Restart apache2 service:

Change ownership and permissions for the DocumentRoot folder:

Open the file /etc/hosts:

Enter local domain laravel.web:

Browse http://laravel.web.

Laravel local domain
Laravel local domain

Install SSL

Install the SSL certificate for the local server using mkcert to run the HTTPS protocol.

Install the dependency package for Homebrew:

Download and run the Homebrew installer:

Make homebrew available in the system environment:

Install the dependency package for mkcert:

Install mkcert via brew:

Install Certificate Authority (CA):

Create an SSL certificate for laravel.web:

Create an ssl directory and move the created SSL into it:

Open the laravel.web virtual host configuration file:

Change the configuration to:

Activate Apache SSL module and restart the apache2 service:

Browse https://laravel.web.

Laravel https
Laravel https

MariaDB database

Install MariaDB database:

Run mysql_secure_installation:

Login to MariaDB:

Create a database and user for Laravel:

Open the .env file:

Database connection configuration:

Create Register and Login Functions

Run migrate to create a user table:

Install laravel/jetstream:

Install livewire:

The register and login functions are active.

Login & Register link
Login & Register link
Register form
Register form
Laravel dashboard
Laravel dashboard

Leave a Reply

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