![]() |
VOOZH | about |
The LEMP software stack serves dynamic web pages and web applications written in PHP. This is an acronym that describes a Linux operating system, with an Nginx (pronounced like “Engine-X”) web server. The backend data is stored in the MySQL database and the dynamic processing is handled by PHP.
This guide demonstrates how to install a LEMP stack on an Ubuntu server. The Ubuntu operating system takes care of the Linux portion of the stack. We will describe how to get the rest of the components up and running.
Note: This tutorial primarily targets Ubuntu 22.04 LTS with PHP 8.1. For Ubuntu 24.04 LTS users, adjust PHP version references from
php8.1-fpmtophp8.3-fpmthroughout the commands. Also, be sure to update any PHP-FPM socket paths in your Nginx configuration (e.g., use/run/php/php8.3-fpm.sockfor Ubuntu 24.04).
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
Unsure if something changed in mysql_secure_installation, but I ran into a strange error:
MySQL Failed! Error: SET PASSWORD has no significance for user ‘root’@‘localhost’ as the authentication method doesn’t store authentication data in the MySQL server …
To work around this, login to another session:
sudo killall -9 mysql_secure_installation
start mysql manually, then execute (substituting your own password):
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘WhateverYouWant’;
After that, you can run mysql_secure_installation (but will have to specify the pw) to completion.
Unfortunately, this breaks the subsequent steps of passwordless login as root. I’m not sure what the remedy is, though.
after sudo mysql_secure_installation command, while setting root mysql password i get this error. anyone have idea?
… Failed! Error: SET PASSWORD has no significance for user ‘root’@‘localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.
I lose my internet after install nginx
was unable to complete the mysql installation after multiple attempts. Turns out, 1GB of RAM is required for a droplet, and after adjusting from 512MB, it worked, please update and mention in this guide. Thanks and more power to you.
When I try to start mysql-server, I get an error and am unable to do so after installation. See the below error…
Process: 3897 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
I think this tutorial needs to be amended since mysql_secure_installation throws an error. More info here under Step 2.
Apr 10 07:04:18 ocean1 systemd[1]: mysql.service: A process of this unit has been killed by the OOM killer.
Apr 10 07:04:18 ocean1 systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
Apr 10 07:04:18 ocean1 systemd[1]: mysql.service: Failed with result ‘oom-kill’.
Apr 10 07:04:18 ocean1 systemd[1]: Failed to start MySQL Community Server.
Apr 10 07:04:18 ocean1 systemd[1]: mysql.service: Consumed 1.227s CPU time.
dpkg: error processing package mysql-server-8.0 (–configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libcgi-pm-perl (4.54-1) …
Setting up libhtml-template-perl (2.97-1.1) …
Setting up libcgi-fast-perl (1:2.15-1) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
Errors were encountered while processing:
mysql-server-8.0
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Super clear and easy to use. Thank you so much for your excellent work.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.