Blog / Linux/ Fixing "bash: lnmp: command not found" Error During LNMP One-Click Installation

Fixing "bash: lnmp: command not found" Error During LNMP One-Click Installation

解决 LNMP 一键安装时 "bash: lnmp: command not found" 错误

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:

  1. First, ensure you have successfully downloaded and extracted the LNMP installation package. You should have a directory named something like lnmp1.7.
  2. Open a terminal and use the cd command to navigate into the LNMP installation directory. For example:
    cd /path/to/lnmp1.7
  3. 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 omit sudo.)

  4. After copying, you can use the lnmp command directly from any location in the system. For example, run lnmp --help to verify the installation.

Additional Notes & Precautions

  • Permissions: If you encounter a permission denied error during copying, ensure you use sudo or execute the command as the root user.
  • Script Location: The main script's path may vary slightly between different LNMP package versions. If ./conf/lnmp does not exist, check the actual location of files like lnmp or install.sh within 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 with echo $PATH or refresh your shell's configuration with source ~/.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.

Post a Comment

Your email will not be published. Required fields are marked with *.