Students lesson 36 assignment: How do you install the LEMP stack on Ubuntu?
Few weeks ago we showed you how to install the LAMP stack on Ubuntu. Pay attention to the letters. One is LAMP and the other is LEMP.
They both are group of open source software packages that power many of the websites running online today. We said LAMP is an acronym for Linux, Apache2, MySQL and PHP.
LEMP stack on the other hand represents Linux Nginx (pronounced Engine-x), MySQL and PHP. So you can replace Apache2 webserver with Nginx and run a powerful website as well.
This brief tutorial shows you how to install LEMP on Ubuntu systems.
Step 1: Prepare your Ubuntu server
The first task to get LEMP install on Ubuntu is to get your Ubuntu server prepared. This assumes that you have administrative (root) rights to the systems and can install packages from the command line.
Update Ubuntu server by running the commands below:
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
Step 2: Install Nginx web server
Your next step is to install Nginx web server package. Run the command below to get Nginx packages installed
sudo apt-get install nginx
To manage Nginx, read the post below. It has everything you need to start, stop and enable Nginx web server.
Step 3: Install MySQL Database Server
You next step is to install MySQL database server. MySQL is a powerful database management system used my most of the websites running online.
To install MySQL on Ubuntu, run the commands below.
sudo apt-get install mysql-server mysql-client
During MySQL installing you’ll be asked to create a root password for the database server. Please create it.
After installing MySQL, run the commands below to secure the database
When prompted with questions, follow the guide below:
Securing the MySQL server deployment. Enter password for user root: VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 Using existing password for root. Estimated strength of the password: 50 Change the password for root ? ((Press y|Y for Yes, any other key for No) : n ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
More about MySQL server can in the post below:
Step 4: Installing PHP-FPM on Ubuntu
The last step is to install PHP and other PHP modules on Ubuntu to get the LEMP stack complete.
To install PHP run the commands below:
sudo apt-get install php-fpm
For most PHP applications to function properly, you must also install related PHP modules. Run the commands below to get as much installed.
sudo apt-get -y install php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc
For more on PHP, please read the post below:
This is how one install the LEMP stack on Ubuntu.
Enjoy! and thanks for reading. Please come back soon.
- Students Tutorial – Install Ubuntu Linux, Nginx, MariaDB and PHP (LEMP)
- Install Nginx, MariaDB and PHP on Ubuntu 17.04 / 17.10
- Install Nginx, MariaDB and PHP-FPM (LEMP) on Ubuntu 17.10
- Install Ubuntu 17.04 / 17.10, Nginx, MariaDB, PHP with Let’s Encrypt (LEMP + Let’s Encrypt)
- Install Nginx, MariaDB and PHP 7.1 (LEMP) with Ubuntu 16.04 LTS Server
- Setup Ubuntu 16.04 LTS with Nginx 1.13.8, MariaDB 10.2, PHP-FPM 7.2 (LEMP)
- Installing Nginx, MariaDB on Ubuntu 16.04 / 17.10 / 18.04 with PHP 7.2 Support (LEMP)
- How to Install LEMP on Ubuntu 16.04 / 18.04 / 18.10