在linux系統中安裝LANMP


1.安裝LANMP步驟

root@kali:~# wget http://dl.wdlinux.cn/files/lanmp_v3.tar.gz #下載

root@kali:~# tar xzvf lanmp_v3.tar.gz  #解壓

root@kali:~# sh lanmp.sh  #運行報錯,原因:系統的dash兼容性不好,而編譯常用的就是dash
lanmp.sh: 49: lib/common.conf: function: not found
lanmp.sh: 76: lib/common.conf: Syntax error: "}" unexpected

root@kali:~# sudo dpkg-reconfigure dash  #解決方法:運行此命令,選擇NO

root@kali:~# 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:未找到命令

問題:
root@kali:~# sh lanmp.sh 
...
lib/mysql.sh:行13: cmake:未找到命令

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

解決方法:
root@kali:~# wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2.tar.gz #下載
root@kali:~# tar xzvf cmake-3.13.2.tar.gz -C software/cmake/  #解壓到指定目錄
root@kali:~/software/cmake/cmake-3.13.2# ./bootstrap && make && make install #安裝
root@kali:~# 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’?

root@kali:~# 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 -----------


解決方法:
root@kali:~# 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)

root@kali:~# cd src/
root@kali:~/src# rm -rf libiconv-1.14.tar.gz  #刪除原來的壓縮包
root@kali:~/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.

root@kali:~# 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 -----------

解決方法:
root@kali:~# apt install libxml2 
root@kali:~# apt install libxml2-dev 

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

root@kali:~# 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 -----------

解決方法:
root@kali:~# apt-get install curl
root@kali:~# apt-get install libcurl4-gnutls-dev
root@kali:~# apt-get install php-curl
注意:我裝了這3個都沒用。。。。。。

沒成功。。。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM