Problem Description
When executing the LNMP one-click installation script on a Linux system (such as CentOS, Debian, Ubuntu, etc.), the terminal displays the error: bash: lnmp: command not found. This typically occurs because the LNMP script's executable file is not correctly installed in a directory included in the system's PATH environment variable.
Solution
Follow these steps:
- First, ensure you have successfully downloaded and extracted the LNMP installation package. You should have a directory named something like
lnmp1.7. - Open a terminal and use the
cdcommand to navigate into the LNMP installation directory. For example:cd /path/to/lnmp1.7 - Copy the main LNMP script file to a system-wide executable directory, such as
/bin/, to make it a global command. Run:sudo cp ./conf/lnmp /bin/(Note: This operation usually requires administrator privileges, hence
sudo. If you are already the root user, you can omitsudo.) - After copying, you can use the
lnmpcommand directly from any location in the system. For example, runlnmp --helpto verify the installation.
Additional Notes & Precautions
- Permissions: If you encounter a permission denied error during copying, ensure you use
sudoor execute the command as the root user. - Script Location: The main script's path may vary slightly between different LNMP package versions. If
./conf/lnmpdoes not exist, check the actual location of files likelnmporinstall.shwithin the package. - Standard Alternative: Instead of copying to
/bin/, you can copy to/usr/local/bin/, which is a more common location for user-installed software commands. Use:sudo cp ./conf/lnmp /usr/local/bin/ - Environment Variables: If the command is still not found after copying,
/usr/local/bin/might not be in your PATH. Check withecho $PATHor refresh your shell's configuration withsource ~/.bashrc.
Tip: This article is based on the general structure of the LNMP one-click installation package. If your version or environment has specific configurations, please refer to its official documentation.