Download Attune CE

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

Exported on 28-Sep-2021 13:20:36

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

This Blueprint Install LEMP Stack Components On A Fedora Server And Creates A PHP Info File To Verify The Installation

LEMP is a variation of the ubiquitous LAMP stack used for developing and deploying web applications. While LAMP uses Apache as WebServer, its alternative Nginx is used with LEMP stack. LEMP stack consists of the following technologies.

Linux The Linux® kernel is the main component of a Linux operating system (OS) and is the core interface between a computer's hardware and its processes. Linux provides the base for LEMP stack components, and makes installing the desired applications easy. Most common used Linux distributions are Ubuntu and Debian. Other available Linux distributions are CentOS, RedHat, OpenSuse, and Fedora etc.

Nginx Nginx is an open source reverse proxy server. It is used to enable HTTP, HTTPS, SMTP, POP3, and IMAP protocols over a network. Nginx can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. It is main alternative and competitor to Apache Web Server. NGINX Plus is an application delivery platform built on NGINX, an open-source web server and reverse proxy for high-traffic sites.

PHP PHP is a general-purpose and server-side scripting language that is especially suited for web development. PHP originally stood for Personal Home Page. It was later changed to Hypertext Preprocessor. PHP runs on all major operating systems including Windows, Linux and macOS. PHP supports a wide range of databases, like MySQL, PostgreSQL, MS SQL, db2, Oracle Database, and MongoDB. LEMP stack utilises MYSQL as the database with PHP.

MySQL MySQL is a Relational Database Management System, it is available as a open-source software under the terms of General Public License. MySQL is backed and maintained by Oracle. MySQL runs on all major operating systems and is easy to setup and uses Structured Query Language (SQL).

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
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

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