在linux系统中安装LANMP

1.安装LANMP步骤

:~# wget http://dl.wdlinux.cn/files/lanmp_v3.tar.gz #下载

:~# tar xzvf lanmp_v3.tar.gz  #解压

:~# sh lanmp.sh  #运行报错,原因:系统的dash兼容性不好,而编译常用的就是dash
lanmp.sh: 49: lib/common.conf: function: not found
lanmp.sh: 76: lib/common.conf: Syntax error: "}" unexpected

:~# sudo dpkg-reconfigure dash  #解决方法:运行此命令,选择NO

:~# sh lanmp.sh  #重新运行LANMP,成功
  grep: /etc/redhat-release: 没有那个文件或目录
  grep: /etc/redhat-release: 没有那个文件或目录
  Select Install
        1 LAMP (apache + php + mysql + zend + pureftpd + phpmyadmin)
        2 LNMP (nginx + php + mysql + zend + pureftpd + phpmyadmin)
        3 LNAMP (nginx + apache + php + mysql + zend + pureftpd + phpmyadmin)
        4 install all service
        5 don‘t install is now

  Please Input 1,2,3,4,5: #此时选择要安装的环境即可,这里我选择1

2.sh lanmp.sh安装服务时遇到的各种报错

<1>报错:cmake:未找到命令

问题:
:~# sh lanmp.sh 
...
lib/mysql.sh:行13: cmake:未找到命令

x86_64
----Install Error: mysql configure err -----------

解决方法:
:~# wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz #下载
:~# tar xzvf cmake-3.13.2.tar.gz -C software/cmake/  #解压到指定目录
:~/software/cmake/cmake-3.13.2# ./bootstrap && make && make install #安装
:~# cmake -version  #查看版本信息
cmake version 3.13.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).

<2>报错:./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function); did you mean ‘fgets’?

:~# sh lanmp.sh 
...
make[3]: 对“am--refresh”无需做任何事。
make[3]: 离开目录“/root/src/libiconv-1.14”
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib  -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1   -g -O2 -c progname.c
In file included from progname.c:26:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function); did you mean ‘fgets’?
 1010 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
      | ^~~~~~~~~~~~~~~
make[2]: *** [Makefile:914:progname.o] 错误 1
make[2]: 离开目录“/root/src/libiconv-1.14/srclib”
make[1]: *** [Makefile:865:all] 错误 2
make[1]: 离开目录“/root/src/libiconv-1.14/srclib”
make: *** [Makefile:35:all] 错误 2

x86_64
----Install Error: libiconv make err -----------


解决方法:
:~# vi /root/src/libiconv-1.14/srclib/stdio.in.h
找到以下这一行
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
使用/* */注释掉

然后再注释的行下面添加以下三行:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
保存退出!(注意#endif 下面还有一个 #endif)

:~# cd src/
:~/src# rm -rf libiconv-1.14.tar.gz  #删除原来的压缩包
:~/src# tar czvf  libiconv-1.14.tar.gz libiconv-1.14/ #重新打包
注意:删除原来的压缩包并重新打包是关键,因为sh lanmp.sh 会自动解压缩并编译libiconv-1.14.tar.gz文件,
如果你仅仅修改了libiconv-1.14/srclib/目录中的stdio.in.h文件,
在sh lanmp.sh运行时它会自动解压缩原来的压缩包并覆盖你刚才修改了文件的目录,此时你的修改就完全没有意义了

参考:https://blog.csdn.net/hanghang121/article/details/79481771

<3>报错:configure: error: xml2-config not found. Please check your libxml2 installation.

:~# sh lanmp.sh 
...
checking libxml2 install dir... /usr
checking for xml2-config path... 
configure: error: xml2-config not found. Please check your libxml2 installation.

x86_64
----Install Error: php configure err -----------

解决方法:
:~# apt install libxml2 
:~# apt install libxml2-dev

<4>报错:configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/

:~# sh lanmp.sh 
...
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/

x86_64
----Install Error: php configure err -----------

解决方法:
:~# apt-get install curl
:~# apt-get install libcurl4-gnutls-dev
:~# apt-get install php-curl
注意:我装了这3个都没用。。。。。。

没成功。。。

相关推荐