How to Install Laravel Local Dev Environment On Ubuntu

This article assumes some familiarity with the Linux terminal.

Install PHP

Add and install the PHP 7.3 PPA

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3

Verify the PHP version installed

php -v


PHP (cli) (built: Aug  7 2019 09:52:53) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache, Copyright (c) 1999-2018, by Zend Technologies

Install MySQL database

sudo apt-get install php7.3-mysql
sudo apt-get install mysql-server
sudo mysql_secure_installation

Now you’ll be presented with some prompts.

For a local dev environment I skip the ‘Validate Password Plugin’.

You will be asked to enter a password for the root user.

From there remove the anonymous users, disallow the root user from remote access, and remove the test database.

When asked to reload privilege tables select yes.

Create a non-root user with root privilages

We will use this user when configuring our Laravel application later on.

Log into MySQL as root.

sudo mysql -u root -p

Run the following SQL to create a new user admin.

CREATE USER 'admin'@'localhost' IDENTIFIED BY '';

Enter exit to leave the MySQL CLI.

mysql> exit

Test out the new user by logging in as admin without using sudo.

mysql -u admin

You should see something like:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.27-0ubuntu0.19.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> _

Exit MySql and we’ll move on to installing Composer.

mysql> exit

Install Composer

First, we need to update our package manager.

sudo apt update

Now we are going to install some dependencies needed for the Composer installation.

  • curl for downloading Composer
  • php-cli is needed to run the install
  • php-mbstring provides functions for a library used
  • git will allow Composer to download project dependencies
  • unzip for unzipping packages
sudo apt install curl php-cli php-mbstring git unzip

With that out of the way we can download the Composer installer.

Begin by moving into your home directory

cd ~

and starting the Composer installer download.

curl -sS -o composer-setup.php

Before we can run the installer it needs to be verified for corruption.

Visit and find the ‘Installer Signature (SHA-384)

Use the signature and run the following commands to verify your installer.

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

You should see the output of

Installer verified

otherwise you will need to re-download the installer and go through the verification steps again.

Run the installer

Now we are free to install Composer globally on the system.

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer


All settings correct for using Composer

Composer (version 1.9.0) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Verify Composer is installed

⚠️ Do not run composer as root using sudo ⚠️

Simply run


and you should see:

  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version 1.9.0 2019-08-02 20:55:32

Time for Laravel!

But first, some dependencies.

sudo apt-get install php7.3-zip
sudo apt-get install php7.3-xml

Download the Laravel installer using Composer.

composer global require laravel/installer

Now we need to update the Linux $PATH

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

After updating the $PATH close your terminal window and open a fresh one.

Hello, World

Let’s get a boilerplate Laravel app running on our localhost.

First we will need to create the database that we will be connecting to.

Log into MySql via the terminal using the admin user that was created earlier.

mysql -u admin

Now run the following SQL to create a database named laravel.


With our database created we can move to the Laravel side of things.

cd via the terminal into the folder you want to create your Laravel application in.

For me that’s ~/dev/laravel/

Run the following command to scaffold the app:

laravel new hello-world

hello-world is just the name of the app so name it whatever you like.

Once this finishes cd into the new directory for your app.

cd hello-world

At this point we need to tell the Laravel app how to connect to our database.

For this we will edit the .env file in the root of the application.

sudo nano .env

The connection settings should look like this


You can save the changes from nano with ctrl+x-> 'y' -> [ENTER]

Now we need to test this connection.

For this we will edit /routes/web.php

It should end up looking like

Route::get('/', function () {
    // return view('welcome');
    try {
        $caught = false;
    } catch (Exception $e) {
        $caught = true;
        die("Could not connect to the database.  Please check your configuration. error:" . $e );

        echo 'Hello, world.';

Now start the server by running

php artisan serve


Laravel development server started: <>

Now you can check it out in your browser at

You should see ‘Hello, world.’ printed to the screen signalling a successful connection to the database.

That’s it!

You now have PHP 7.3, MySql, Composer, and the Laravel installer configured for your local Ubuntu development environment with a running starter Laravel app.

Originally published on

#laravel #php #mysql #ubuntu #web-development

What is GEEK

Buddha Community

How to Install Laravel Local Dev Environment On Ubuntu
Chet  Lubowitz

Chet Lubowitz


How to Install Microsoft Teams on Ubuntu 20.04

Microsoft Teams is a communication platform used for Chat, Calling, Meetings, and Collaboration. Generally, it is used by companies and individuals working on projects. However, Microsoft Teams is available for macOS, Windows, and Linux operating systems available now.

In this tutorial, we will show you how to install Microsoft Teams on Ubuntu 20.04 machine. By default, Microsoft Teams package is not available in the Ubuntu default repository. However we will show you 2 methods to install Teams by downloading the Debian package from their official website, or by adding the Microsoft repository.

Install Microsoft Teams on Ubuntu 20.04

1./ Install Microsoft Teams using Debian installer file

01- First, navigate to teams app downloads page and grab the Debian binary installer. You can simply obtain the URL and pull the binary using wget;

$ wget${VERSION}_amd64.deb

#linux #ubuntu #install microsoft teams on ubuntu #install teams ubuntu #microsoft teams #teams #teams download ubuntu #teams install ubuntu #ubuntu install microsoft teams #uninstall teams ubuntu

Localization - Laravel Localization Example

In this example i will show you localization - laravel localization example.

Laravel’s localization features provide a convenient way to retrieve text in different languages, allowing you to easily support multiple languages within your application. So here i will show you how to create localization or laravel dynamic language.

Read More : Localization - Laravel Localization Example

Read Also : How To Integrate Paypal Payment Gateway In Laravel

#localization - laravel localization example #localization tutorial #localization #laravel multi languag #laravel documentation #laravel localization

Chet  Lubowitz

Chet Lubowitz


How to Install TeamViewer on Ubuntu 20.04

TeamViewer is a cross-platform, proprietary application that allows a user to remotely connect to a workstation, transfer files, and have online meetings. In this tutorial, we will walk you through how to install TeamViewer on Ubuntu 20.04 Desktop through the command line.


Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.

Installing TeamViewer on Ubuntu

01- To install TeamViewer, first, download the TeamViewer .deb package. So, open the Terminal and run the following wget command.

$ wget

02- Once you have downloaded the TeamViewer‘s Debian package, execute the following command to install Teamviewer:

$ sudo apt install ./teamviewer_amd64.deb

The system will prompt you with a [Y/n] option. Type ‘Y‘ and hit the enter key in order for to continue the installation.

03- Once the installation is done, you can launch TeamViewer either by typing the command teamviewer in your terminal or by clicking on the TeamViewer icon (Activities -> TeamViewer).

04- A pop-up License Agreement will be displayed. To proceed, click on the Accept License Agreement button.

#linux #ubuntu #install teamviewer #install teamviewer ubuntu #teamviewer #teamviewer ubuntu #teamviewer ubuntu install #ubuntu install teamviewer

Arvel  Parker

Arvel Parker


How to Install PgAdmin 4 on Ubuntu 20.04

pgAdmin is the leading graphical Open Source management, development and administration tool for PostgreSQL. pgAdmin4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL database.

In this tutorial, we are going to show you how to install pgAdmin4 in Server Mode as a web application using apache2 and Wsgi module on Ubuntu 20.04 LTS.

#databases #linux #ubuntu #install pgadmin4 #install pgadmin4 ubuntu #install pgadmin4 ubuntu 20 #pgadmin4 #ubuntu pgadmin4 #ubuntu pgadmin4 install

Brain  Crist

Brain Crist


How to Install Android Studio on Ubuntu 20.04

1./ Install Android Studio Using APT

Method 1./ Install Android Studio Using APT

1- We need to add official repository to the sources list. Therefore, type the below command to add the Android Studio repository:

$ sudo add-apt-repository ppa:maarten-fonville/android-studio

02- Now let’s install Android studio and all the software dependencies as below.

$ sudo apt update
$ sudo apt install android-studio

Method 2./ Install Android Studio Using snap

We can install using the snap tool. So, use the below command to install Android Studio:

$ sudo snap install android-studio --classic

2./ Starting Android Studio

01- You can start Android Studio either by typing the command android-studio in your terminal or by clicking on the Android Studio icon (Activities -> Android Studio).

How to Install Android Studio on Ubuntu 20.04

02- When you start Android Studio for the first time, a window like the following will appear asking you to import Android Studio settings from a previous installation. However, if you have a previous installation of Android Studio, simply browse to the configuration folder. If not, go with the default option which is Do not import settings.

How to Install Android Studio on Ubuntu 20.04

03- Click on the Next button, and you will be presented with a window to choose your type of setup you want for Android Studio. So, let’s choose Standard which will install the most common settings and options as below.

How to Install Android Studio on Ubuntu 20.04

04- Click Next and you’ll be taken to the following window to choose your UI theme:

How to Install Android Studio on Ubuntu 20.04

05- You’ll be taken to a window to verify your chosen settings. Simply click on Next. Finally, wait for the Wizard to download and install the required dependencies before you can start your first Android project

How to Install Android Studio on Ubuntu 20.04

#linux #ubuntu #install android studio #install android studio ubuntu #install sdk ubuntu #sdk #sdk install android studio #ubuntu install android studio