Install Nginx, MariaDB, PHP, Certbot on Amazon 2 (Ec2 instance)

Dimitris Moutsatsos
3 min readNov 18, 2020

This is a very simple installation with no custom setup.

Prerequisites

Before start this tutorial you should know how to create , use and connect to an amazon ec2 instance.

Step1 : Nginx

Install and run nginx

$ sudo amazon-linux-extras install nginx1 -y
$ sudo systemctl start nginx.service

Now navigate to a browser and open http://[YOUR_INSTANCE_IP] to check that everything works as expected and you will see the following:

Step2 : MariaDB

Install and run Mariadb

$ sudo yum install mariadb-server -y
$ sudo systemctl start mariadb.service

Now we have completed the installation of MariaDB , setup the root credentials.

$ sudo  mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):

Press enter for none

OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n]

Press Yes and enter a password that you want for Mysql root password.

New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for…
Dimitris Moutsatsos

developer and weirdo / current: Tychetech / MAD TV / WARR