Installation Requirements#
- Supported Linux distributions: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian/Deepin/Aliyun/Amazon/Mint Linux
- Requires at least 5GB of available space
- MySQL 5.7, MariaDB 10 requires at least 9GB of free space
- MySQL 8.0 latest version requires at least 25GB of space
- If there is not enough space and it is x86 or x86_64 architecture, you can choose Generic Binaries installation
- Requires at least 128MB of memory (128MB small memory VPS, Xen requires SWAP, OpenVZ requires at least 128MB of vSWAP or burst memory)
- Do not use 64-bit systems on small memory
- Installing MySQL 5.6 or 5.7 and MariaDB 10 requires at least 1GB of memory, higher versions require at least 2GB of memory
- Installing PHP 7 and above requires at least 1GB of memory
- VPS or server must have a usable yum or apt-get source and ensure that it works properly. Offline installation requires adding the CheckMirror=n parameter
- Do not install old PHP/MySQL versions on very new Linux distributions, and vice versa
- Linux is case-sensitive, please pay attention when entering commands
- If MySQL/MariaDB is installed via yum or apt-get, please backup the data and other related files yourself
- CentOS 5, 6, 8, Debian 6, 7, 8, or lower versions are no longer supported on the official website and cannot be used directly. You need to replace the vault or archive source by yourself
- CentOS 6, 8 should use lnmp 1.9+ version for installation
- Ubuntu 18+, Debian 9+, Mint 19+, Deepin 15.7+, and all new Linux distributions can only be installed using 1.7+
- PHP versions below 7.1.* do not support very new Linux distributions such as Ubuntu 19+, Debian 10+
- There are problems with the Alibaba Cloud Ubuntu 14.04 and 22.04 system templates, do not use them. If you need to use them, you can find solutions on the forum
- PHP 7.4 upgrade or installation must be on CentOS 7+, Debian 8+, Ubuntu 16.04+, and must use 1.7+
- MySQL 8.0.23 and below versions upgrade or installation must be on CentOS 8+, Debian 9+, Ubuntu 16.04+, and must use 1.7+
- MySQL 8.0.24 and above versions upgrade or installation must be on Debian 11+, Ubuntu 20.04+, Fedora 33+, CentOS 9, and other versions with gcc 10+, and must use 1.9+
- MariaDB 10.* and above versions upgrade or installation must be on CentOS 8+, Debian 10+, Ubuntu 18.04+, and other systems with cmake version higher than 3, or upgrade cmake by yourself
- LNMP one-click installation package V2.0 has been tested on many VPS such as Vultr, Aoyou Host, Bandwagon Host, LocVPS, Linode, DigitalOcean, KVMLA, Jingwen Internet, BuyVM, Dog Cloud, 80VPS, Tencent Cloud (CentOS 5, 6, Debian 6, 7, and earlier versions are no longer supported on their official website, Debian 9 requires Apache version 2.4.26 or above)
Installation Steps#
- Use putty or similar SSH tool to log in to VPS or server
- After logging in, run:
screen -S lnmp
- If prompted with
screen: command not found
command does not exist, you can run:yum install screen
orapt-get install screen
to install, refer to the screen tutorial for more details
- If prompted with
- Download and install LNMP one-click installation package
- Use the download version (recommended for users with VPS in the United States or overseas or limited space) or the complete version (recommended for users with VPS in China, Chinese users can find domestic download addresses in the download), there is no difference between the two, only the complete version preloads some required source code files into the installation package
- Install LNMP stable version:
wget https://soft.lnmp.com/lnmp/lnmp2.0.tar.gz -O lnmp2.0.tar.gz && tar zxf lnmp2.0.tar.gz && cd lnmp2.0 && ./install.sh lnmp
- If you need to install LNMPA or LAMP, replace
lnmp
after./install.sh
withlnmpa
orlamp
. It also supports installing Nginx or database separately, the command is./install.sh nginx
or./install.sh db
. - If you need to change the website and database directory, customize Nginx parameters, install PHP parameter modules, enable lua, etc., modify the
lnmp.conf
file under the installation package directory before running the./install.sh
command. For details, please refer to the lnmp.conf file parameter description. - Note: If installing offline, due to the huge size of the MySQL/MariaDB binary package, offline installation should use the compilation installation method or download the corresponding version of the binary package to the
src
directory of the installation package. - If prompted with
wget: command not found
, useyum install wget
orapt-get install wget
command to install - If the download speed is slow or unable to download, please change to another download node. Please refer to the specific replacement method for LNMP download nodes
- After running the above LNMP installation command, the following prompt will appear:
- Currently, there are many MySQL and MariaDB versions available, and the option to not install the database. It should be noted that if MySQL 5.6, 5.7, and MariaDB 10 are compiled and installed, a higher configuration with at least 1G of memory is required to select! If you only need to install the database, execute: ./install.sh db in the lnmp installation package directory
- Enter the number in front of the corresponding MySQL or MariaDB version and press Enter to proceed to the next step.
- If you choose MySQL/MariaDB and there is a corresponding architecture binary package, it will prompt: "Using Generic Binaries [y/n]:". This step is to prompt whether to use binary installation. Enter
y
to use binary installation, and entern
to use source code compilation installation. If there is no prompt, it means that there is no corresponding binary installation package for the current architecture. - Due to the huge size of the MySQL 5.7/8.0 binary package, offline installation should use the compilation installation method or download the corresponding version of the binary package to the
src
directory of the installation package.
- Set the root password for MySQL (for security, if you do not enter and press Enter, it will be set to
lnmp.org#random number
). If there is an input error and you need to delete it, you can hold downCtrl
and press theBackspace
key to delete (in some cases, you only need to press theBackspace
key). After entering, press Enter to proceed to the next step
- Ask whether to enable MySQL InnoDB. InnoDB engine is enabled by default and it is generally recommended to enable it. Press Enter or enter
y
. If you are sure that you do not need this engine, you can entern
(InnoDB cannot be disabled in MySQL 5.7+). After entering, press Enter to proceed to the next step
- Note: When selecting PHP 7+ version, you need to confirm whether the PHP version is compatible with your program
- Enter the number corresponding to the PHP version you want to select, and press Enter to proceed to the next step. Choose whether to install memory optimization
- You can choose not to install, Jemalloc or TCmalloc. Enter the corresponding number and press Enter. Press Enter directly for the default not to install
- If it is LNMPA or LAMP, it will also prompt to set the email and select Apache
- "Please enter Administrator Email Address:", you need to set the administrator's email address, this email address will be displayed on the error page when an error occurs
- Then select the Apache version
- Enter the number in front of the corresponding version as prompted, and press Enter
- After the prompt "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 depending on the configuration, network speed, and other factors
Installation Completed#
- If it displays
Nginx: OK
,MySQL: OK
,PHP: OK
, and Nginx, MySQL, PHP are all running, ports 80 and 3306 exist, and it prompts the installation time andInstall lnmp V1.9 completed! enjoy it.
, it means that the installation is successful
- Some systems may stay at
Install lnmp V2.0 completed! enjoy it.
and not exit automatically, you can pressCtrl+c
to exit
Installation Failed#
- If you encounter a prompt similar to the above image, it means that one or more components failed to install! You need to use winscp or similar tools to download the
lnmp-install.log
file under the/root
directory, and post it on the LNMP support forum with the name and version number of your system distribution, 32-bit or 64-bit, etc., and compress thelnmp-install.log
file as an attachment. We will find the error through the log and provide corresponding solutions
By default, LNMP does not install FTP server. If you need an FTP server: https://lnmp.org/faq/ftpserver.html
Adding and Deleting Virtual Hosts and Managing Rewrite Rules#
https://lnmp.org/faq/lnmp-vhost-add-howto.html
Installation of eAccelerator, xcache, memcached, imageMagick, ionCube, redis, opcache#
https://lnmp.org/faq/addons.html
LNMP Related Software Directory and File Locations#
https://lnmp.org/faq/lnmp-software-list.html
LNMP Status Management Commands#
https://lnmp.org/faq/lnmp-status-manager.html
Installing Only the Database or Nginx#
- LNMP 1.5 and later versions support installing only MySQL/MariaDB database or Nginx
- Add separate nginx installation, in the installation package directory, run:
./install.sh nginx
to install - Add separate database installation, in the installation package directory, run:
./install.sh db
to install
LNMP One-Click Installation Package Supports Full Offline Mode Installation#
- Note: Offline installation does not mean that no source is needed, but you need to set up a source for installation locally.
CentOS system offline installation tutorial: https://www.vpser.net/manage/centos-iso-local-yum-repository.html - There is no iso available for Debian/Ubuntu distributions, you need to use the
apt-get install -d
command to download all the necessary packages in the same temporary environment, and then use the
dpkg-scanpackages` command to package the required packages into a source directory. Pack this directory and put it on the target server as a source. - Note: If MySQL/MariaDB chooses "Generic Binaries" installation, you must download the specified binary package by yourself and upload it to the
src
directory of the lnmp installation package.
Uninstalling LNMP One-Click Installation Package#
Execute ./uninstall.sh
in the lnmp installation package directory, select the current environment type as prompted, and press Enter to confirm. It will delete lnmp-related program components, keep the website files, and back up the database directory to the /root directory separately. If there are other files that need to be saved, please back them up before uninstalling.