Installing Apache and PHP 7.2
Next step is to install PHP along with several extra packages that would prove useful if you are going to work with Laravel.
sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install apache2 libapache2-mod-php7.2 php7.2 php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
Even though Ubuntu's own repository has PHP, it's better to add a 3rd party repository here because it gets more frequently updated. You can skip that step and stick to Ubuntu's version if that's what you prefer.
Before we finally delve into it, we also need Git version control to be installed. If you have it installed, you can skip the following step. If you don't have, then you can follow our guide to set it up first.
To install Laravel, we need to install Composer first. It is a tool for dependency management in PHP that allows you to package all the required libraries associated with a package as one. To install Laravel and all its dependencies, Composer is required. It will download and install everything that is required to run Laravel framework. To install Composer, issue the following commands.
cd /tmp curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer