Installation requirements:

  • CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin/Aliyun/Amazon/Mint Linux distribution
  • More than 5GB of free space is required. MySQL 5.7, MariaDB 10, at least 9GB of free space, and the latest version of MySQL 8.0, at least 25GB of free space. If the space is not enough and MySQL is x86 or x86_64 architecture, you can choose Generic Binaries to install MySQL.
  • More than 128MB of memory is required (128MB of small memory VPS, Xen needs SWAP, OpenVZ needs at least 128MB of vSWAP or burst memory). Please note that 64 bit systems are not allowed for small memory!
  • Installing MySQL 5.6 or 5.7 and MariaDB 10 must have more than 1GB of memory, and newer versions must have at least 2GB of memory!
  • Installing PHP 7 and above requires more than 1GB of memory!
  • VPS or server must set the available yum or apt get source and ensure that it can work normally, Offline installation CheckMirror=n parameter needs to be added!
  • Do not install the old PHP/MySQL version on the very new Linux distribution, and do not install the very new PHP/MySQL version on the old Linux distribution.
  • Linux is case sensitive. Please pay attention when entering commands!
  • If you have MySQL/MariaDB installed through yum or apt get, please back up data and other related files yourself!
  • CentOS 5, 6, 8, Debian 6, 7, 8 or earlier official websites have ended. Support cannot be used directly. You need to change the vault or archive source!
  • Please install CentOS 6 and 8 with lnmp 1.9+!
  • Ubuntu 18+, Debian 9+, Mint 19+, Deepin 15.7+and all new Linux distributions can only be installed with 1.7+!
  • PHP 7.1. * The following versions do not support Ubuntu 19+, Debian 10+and other very new Linux distributions!
  • Alibaba Cloud Do not use the Ubuntu 14.04 and 22.04 system templates if there is a problem!!! If necessary, the forum will find solutions
  • CentOS 7+, Debian 8+, Ubuntu 16.04+and 1.7+are required for PHP 7.4 upgrade or installation!!!
  • CentOS 8+, Debian 9+, Ubuntu 16.04+and 1.7+are required for upgrading or installing MySQL versions below 8.0.23!!!
  • MySQL version 8.0.24 or above must be upgraded or installed with Debian 11+, Ubuntu 20.04+, Fedora 33+, CentOS 9 and other gcc 10+versions, and 1.9+must be used. If it does not meet the requirements, please select the (Generic Binaries) binary mode!!!
  • The upgrade or installation of MariaDB 10. * or above version must be CentOS 8+, Debian 10+, Ubuntu 18.04+and other systems with cmake version higher than 3, or upgrade cmake yourself!!! If the requirements are not met, use lnmp 2.0 to select (Generic Binaries) binary mode.
The LNMP one click installation package V2.1 is already in the Vultr Traveling host Tile mover LocVPS Linode DigitalOcean KVMLA Jingwen Internet BuyVM Gouyun 80VPS Tencent Cloud Many VPS such as CentOS 6-9, RHEL 6-9, Fedora 21-38, Debian 7-12, Ubuntu 10.04-24.04 and many other Linux distributions have passed the test on 32-bit and 64 bit systems (CentOS 5, 6, Debian 6, 7 and earlier versions of their official websites have ended support and cannot be used, and Apache on Debian9 needs to select version 2.4.26 or above.

Installation steps:
1. Using putty Or similar SSH tools to log into VPS or server;

Run after login: screen -S lnmp
If you are prompted that the screen: command not found command does not exist, you can execute: yum install screen or apt get install screen. For details, refer to Screen tutorial

2. Download and install the LNMP one click installation package:

You can choose to use the downloaded version (recommended for VPS in the United States and overseas or for users with small space) or the full version (recommended for domestic VPS, which can be used by domestic users download There is no difference between the two, but the full version puts some required source files into the installation package in advance.

Install LNMP stable version
For unattended installation, use Unattended command generation tool , or View Unattended Instruction Tutorial

wget https://soft.lnmp.com/lnmp/lnmp2.1.tar.gz -O lnmp2.1.tar.gz && tar zxf lnmp2.1.tar.gz && cd lnmp2.1 && ./ install.sh lnmp

If you need to install LNMPA or LAMP, set the/ The parameter lnmp after install.sh is replaced with lnmpa or lamp OK. It also supports separate installation of Nginx or database. The command is/ Install.sh nginx or/ install.sh db。
If you need to change the website and database directory, customize Nginx parameters, whether the PHP parameter module is installed, and enable lua, you need to be running/ Before the install.sh command, modify the lnmp.conf file in the installation package directory. For details, see Parameter description of lnmp.conf file
be careful!!! If you are installing offline, because MySQL/MariaDB binary package is huge, you should use the compile installation method or download the binary package of the corresponding version to the installation package src directory

If prompted wget: command not found, use the yum install wget or apt get install wget command to install.

If the download speed is slow or cannot be downloaded, please replace the other download node. Please check Specific replacement method of LNMP download node

After running the above LNMP installation command, the following prompt will appear:

Currently, there are more MySQL, MariaDB versions and no database installation options Note that MySQL 5.6, 5.7 and MariaDB 10 can only be selected on higher configurations with more than 1GB of memory if they are compiled and installed To install the database only, run it in the lnmp installation package directory:/ install.sh db

Enter the serial number in front of the corresponding MySQL or MariaDB version and press Enter to proceed to the next step

If you select MySQL/MariaDB, if there is a binary package of the corresponding architecture, you will be prompted: "Using Generic Binaries [y/n]:" This step is to prompt whether to use binary installation, enter y to use binary installation, and enter n to use source code compilation and installation. If there is no prompt, it indicates that there is no corresponding binary installation package for the current architecture.
Because MySQL 5.7/8.0 binary package is huge, please use the compile installation method or download the binary package of the corresponding version to the installation package src directory for offline installation


Set the root password of MySQL (for security reasons, entering directly will be set to lnmp. org # random number). If you make an error and need to delete, you can press Ctrl and then the Backspace key to delete it (in some cases, just press the Backspace key). Enter to enter the next step, as shown in the following figure:

Ask whether you need to enable MySQL InnoDB. The InnoDB engine is enabled by default. Generally, it is recommended to enable it. Enter or enter y directly. If you are sure that you do not need the engine, you can enter n (InnoDB cannot be disabled for MySQL 5.7+). After the input is completed, enter the next step.


Note: When selecting the PHP 7+version, you need to confirm whether the PHP version is compatible with your own program.

Enter the serial number of the PHP version you want to select, press Enter to enter the next step, and select whether to install memory optimization:

You can choose not to install, Jemalloc or TCmalloc, enter the corresponding serial number and press Enter. If you press Enter directly, the default is not to install.

If it is LNMPA or LAMP, you will also be prompted to set the mailbox and select Apache "Please enter Administrator Email Address:", you need to set the administrator mailbox, which will be displayed on the error page when an error is reported.

Then select the Apache version

Enter the number in front of the corresponding version and press Enter.

When prompted "Press any key to install... or Press Ctrl+c to cancel", press Enter to confirm the installation.
The LNMP script will automatically install and compile Nginx, MySQL, PHP, phpMyAdmin and other software and related components.

The installation time may vary from tens of minutes to several hours, mainly due to the network speed configured on the machine.

3. Installation complete
If Nginx: OK, MySQL: OK, PHP: OK is displayed

In addition, Nginx, MySQL, and PHP are all running, and ports 80 and 3306 exist. You will be prompted about the installation time and Install lnmp V1.9 completed! Enjoy it. indicates that the installation is successful.
Some systems may be stuck in Install lnmp V2.0 completed! Enjoy it. does not automatically exit. You can press Ctrl+c to exit.

After the installation is completed, you can start using. Press Add Virtual Host Tutorial , can be used after adding virtual host sftp or Ftp server Upload the website code, resolve the domain name to the VPS or server IP, and use it after the resolution takes effect.

4. Installation failed

If a prompt similar to the above figure appears, one or more failed installation indicates that the installation failed!! Need to use winscp Or other similar tools, download the lnmp-install.log under the/root directory to LNMP Support Forum Post a post indicating your system release name and version number, 32-bit or 64 bit information, and upload the lnmp-install.log compression to the forum in the form of an attachment. We will find errors through the log and give corresponding solutions.



The default LNMP does not install an FTP server. If you need an FTP server: https://lnmp.org/faq/ftpserver.html

5. Adding and deleting virtual hosts and pseudo static management
https://lnmp.org/faq/lnmp-vhost-add-howto.html

6. Installation of eAccelerator, xcache, memcached, imageMagick, ionCube, Redis, and opcache
https://lnmp.org/faq/addons.html

7. LNMP related software directory and file location
https://lnmp.org/faq/lnmp-software-list.html

8. LNMP state management command
https://lnmp.org/faq/lnmp-status-manager.html

9. Only install database, Nginx
From the beginning of lnmp 1.5, only MySQL/MariaDB database or Nginx can be installed
Add a separate nginx installation, run under the installation package directory:/ Install.sh nginx;
Add a separate database installation. Run under the installation package directory:/ Install.sh db;

10. The lnmp one click installation package supports full offline installation
Note: Offline installation does not require a source, but requires you to build a source for installation locally.
Offline installation tutorial under CentOS system: https://www.vpser.net/manage/centos-iso-local-yum-repository.html
There is no iso available under the Debian/Ubuntu distribution. You need to use the apt get install - d<software packages>command to download all the necessary software packages in the same temporary environment, and then use the dpkg scanpackages command to package the required software packages as the source directory. After packaging this directory, place it on the target server and set it as the source directory.
Note: If you select "Generic Binaries" for MySQL/MariaDB installation, you must download the specified binary package and upload it to the lnmp installation package src directory.

11. Uninstall the lnmp one click installation package
Execute in the lnmp installation package directory:/ Uninstall.sh Select the current environment type as prompted, press Enter to confirm, the relevant program components of lnmp will be deleted, the website files will be retained, and the database directory will be backed up to the/root directory. If there are other files that need to be saved, please backup them before uninstalling.