Step 1: Update Software Packages
Before we install the LEMP stack, it’s a good practice to update repository and software packages by running the following commands on your Ubuntu 18.04 OS.
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update sudo apt upgrade
Step 2: Install Nginx Web Server
Nginx is a high performance web server and very popular these days. It also can be used as a reverse proxy and caching server. Enter this command to install Nginx Web server.
sudo apt install nginx
After it’s installed, we can enable Nginx to auto start when Ubuntu is booted by running the following command.
sudo systemctl enable nginx
Then start Nginx with this command:
sudo systemctl start nginx
Now check out its status.
systemctl status nginx nginx -v
Step 3: Install MariaDB Database Server
sudo apt install mariadb-server mariadb-client
After it’s installed, MariaDB server should be automatically stared. Use systemctl to check its status.
sudo systemctl status mariadb sudo systemctl start mariadb sudo systemctl enable mariadb
Now run the post installation security script.
To check Mariadb Version to make sure you are on latest.
As you can see, we have installed MariaDB
Step 4: Install PHP7.4
Install the php 7.4 and Extension everything need for WordPress or Nextcloud or forum.
sudo apt install php7.4 php7.4-fpm php7.4-mysql php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-mbstring php7.4-xml php7.4-gd php7.4-curl php7.4-redis php7.4-apcu -yy
sudo systemctl start php7.4-fpm
Enable Php7.4-fpm to will start after you reboot.
sudo systemctl enable php7.4-fpm
Check Status Php7.4 to make sure it was Active.
systemctl status php7.4-fpm
You had Success set up Lemp Stack
go ahead test out http://YOUR-IP.