In the previous lesson we've created Droplet which contains Linux virtual machine. So we've done with L from the LEMP stack. Now we're going to install the rest components which are EMP (Nginx, MySQL and PHP).

Let's go ahead and open up our terminal. And before we take any further steps let's enter this command:

apt-get update

This command essentially used to downloads the package lists from the repositories and updates them to get information on the newest versions of packages and their dependencies.

Once that done, we can firstly install the nginx and mysql server by saying:

apt-get install nginx mysql-server

You'll find a confirmation message saying that installing the packages will take some Mega bytes on your disk. Hit Y then hit return to continue installing.

Once that installed, we can continue by installing the PHP package. But, in order to do that we need to add something called Ubuntu Universe Repository which contains open source software maintained by Ubuntu Community.

We can do that by typing add-apt-repository universe then hit return.

Because we'll be using nginx and mysql we'll need to install package php-fpm which is an alternative package for FastCGI but with better performance and more efficient. We'll also need to install php-mysql package which allow PHP to communicate with mysql database.

In terminal we can install those packages by saying:

apt install php-fpm php-mysql

Again you'll get confirmation message. Just answer Y and hit return to continue. It will take some times to download and install in our server.

Now that we have complete LEMP stack in our server. But in order to make our Laravel app really working in our server, we still have to install these packages.

apt install php7.2-mbstring php7.2-xml zip unzip composer

You'll get a message confirming those package to install in your system. Hit Y and hit return to continue.