Nginx, MariaDB and PHP on Ubuntu is also known as the LEMP stack. LEMP is an alternative to LAMP. Both LEMP and LAMP are collection of opensource software packages that allow majority of the websites online today to function.
This brief tutorial is going to show students and new users how to install LEMP on Ubuntu 17.04 or 17.10. After installing and configuring LEMP, you may be able to run content management systems like WordPress, Drupal or Joomla.
When you’re ready to get LEMP installed on Ubuntu, follow the steps below
Step 1: Preparing Ubuntu
This tutorial assumes that your going to be using Ubuntu as the Linux machine. The reason we use Ubuntu is because it’s probably the best choice for new users and students. It’s easy to install and manage.
Before install software packages on Ubuntu, you should first update the machine. To do that, run the commands below
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
After running the above commands to update Ubuntu, please restart your machine.
Step 2: Install Nginx
Now that Ubuntu is updated, run the commands below to install Nginx. Nginx is also known as Engine-X and the E in LEMP represents it. To install Nginx, run the commands below
sudo apt-get install nginx
After installing Nginx, the commands below can be used to stop, start and enable Nginx service to always start up when the server boots.
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
Fore more on managing Nginx, please search this blog for other Nginx tutorials.
Step 3: Install MariaDB
MariaDB is a drop-in replacement for MySQL. It’s a fork of MySQL and works exactly like MySQL. M in LEMP represents MariaDB or MySQL. To install MariaDB on Ubuntu, run the commands below.
sudo apt-get install mariadb-server mariadb-client
After installing MariaDB, run the commands below to MariaDB root password and secure it.
You’ll be prompted to answer series of questions.. use the example below to guide you.
Enter current password for root (enter for none): PRESS ENTER
Set root password? [Y/n] Y
CREATE YOUR PASSWORD
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
After securing the database server, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
For more on managing MariaDB, search our blog for other tutorials.
Step 4: Install PHP
Now that Nginx and MariaDB are installed, the last piece of the LEMP stack is PHP. To install PHP and other related PHP modules, run the commands below.
sudo apt-get install php php-fpm php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc
Congratulations! You’ve just install LEMP.
This post shows students and new users how to install LEMP on Ubuntu 17.04 / 17.10. LEMP is a collection of opensource packages that enable dynamic and amazing websites and applications.
After getting LEMP installed, you should be able to run CMS like WordPress, Drupal and Joomla.
You may also like the post below:
How to Install Drupal CMS on Ubuntu 17.04 / 17.10