Saturday, March 23, 2019

CREATE A LEMP STACK IN AWS EC2 by Amazon Linux 2 (LINUX, NGINX, MARIADB AND PHP 7.2)

Launch Instance: latest Amazon Linux 2 AMI



# Update Linux and install essential packages
sudo yum -y update

# Install php72 using amazon-linux-extras
sudo amazon-linux-extras install php7.2

# Install Nginx 1.12 using amazon-linux-extras
sudo amazon-linux-extras install nginx1.12

# Install mariadb using amazon-linux-extras
sudo amazon-linux-extras install lamp-mariadb10.2-php7.2
## this will install apache/httpd as well, which we don't need.
### uninstall httpd
sudo yum earse httpd httpd-tools
# install mariadb-server should be version 10.2 or higher
sudo yum install mariadb-server
To enable nginx, php-fpm and mardb services on boot:
sudo systemctl enable nginx
sudo systemctl enable php-fpm
sudo systemctl enable mariadb
To start all 3 service:
sudo systemctl start php-fpm
sudo systemctl start nginx
sudo systemctl start mariadb
sudo mysql_secure_installation

No comments:

Post a Comment