Install LEMP (Linux, Nginx, MySQL And PHP) Stack On Fedora

Exported on 28-Aug-2021 13:39:38

Install LEMP (Linux, Nginx, MySQL and PHP) On Fedora Server With Attune Automation

This Blueprint Install LEMP Stack Components On A Fedora Server And Creates A PHP Info File To Verify The Installation
Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Linux node for the host you wish to install the stack on.
  2. On the Inputs tab, create Linux credentials to connect to the host you wish to install the stack on.

Parameters

Name Type Script Reference Default Value Comment
server_credential Linux OS Credential server_credential
server_host Linux / Unix Server server_host

1 - Install Nginx Web Server

Installs Nginx Web Server

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install Nginx web server
sudo dnf -y install nginx

2 - Install PHP and PHP-FPM

Installs php and its plugins: php-fpm & php-common

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Installs and configures PHP
sudo dnf install php php-fpm php-common -y

3 - Install MySQL Server

Install MySQL Database server

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Installs MySQL-Server
sudo dnf install -y mysql-server

4 - Start Nginx Web Server

Starts Nginx and configures it to launch on startup

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Launch Nginx server
sudo systemctl start nginx 

# Set Nginx to launch at reboot 
sudo systemctl enable nginx

5 - Start PHP FPM Server

Start the PHP-FPM server which acts as the backend for Nginx to handle .php files.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Starts php-fpm service
sudo systemctl start php-fpm 

# Configures php-fpm to launch at reboot
sudo systemctl enable php-fpm

6 - Verify LEMP Installation

Finally this step creates a info.php file to verify the LEMP installation.

Visit http://YOUR_IP/info.php to see see the output.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Creates info.php file 
echo "<?php phpinfo(); ?>" | sudo tee /usr/share/nginx/html/info.php