LNMP一键安装包带IMAP模块安装

LNMP一键安装包是什么?

LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RHEL/Fedora/Aliyun/Amazon、Debian/Ubuntu/Raspbian/Deepin/Mint Linux VPS或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的Shell程序。

想要了解LNMP请进入官网LNMP.org
由于官网默认安装没有编译IMAP模块,所以本教程将指导如何在安装开始前加入IMAP模块的编译命令。
本教程适用于Ubuntu18.04或者centos7


1.进入分屏窗口,这样即使终端断开连接也不会中断编译安装。

screen -S lnmp

2.下载lnmp1.7的shell命令安装包,然后解压缩进入到文件夹。

wget http://soft.vpser.net/lnmp/lnmp1.7beta.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7

3.进入php的shell安装文件夹编辑php自动安装文件,让php编译能增加IMAP的模块支持。

cd include
vim php.sh

4.找到到如下代码块,对应你需要安装的php版本。

Install_PHP_73()
{
    Echo_Blue "[+] Installing ${Php_Ver}"
    Tarj_Cd ${Php_Ver}.tar.bz2 ${Php_Ver}
    if [ "${Stack}" = "lnmp" ]; then
        ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization ${with_curl} --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --with-gd ${with_openssl} --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --without-libzip --enable-soap --with-gettext ${with_fileinfo} --enable-opcache --with-xsl --enable-imap --with-imap --with-imap-ssl --with-kerberos ${PHP_Modules_Options}
    else
        ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization ${with_curl} --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --with-gd ${with_openssl} --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --without-libzip --enable-soap --with-gettext ${with_fileinfo} --enable-opcache --with-xsl --enable-imap --with-imap --with-imap-ssl --with-kerberos ${PHP_Modules_Options}

5.这里我们是安装php7.3版本,所以找到Install_PHP_73(),在if和else中的两个编译参数的最后添加下面的参数,(这里注意要插入到最后的
${PHP_Modules_Options}的前面)

--enable-imap --with-imap --with-imap-ssl --with-kerberos

6.完成后的代码如下:

Install_PHP_73()
{
    Echo_Blue "[+] Installing ${Php_Ver}"
    Tarj_Cd ${Php_Ver}.tar.bz2 ${Php_Ver}
    if [ "${Stack}" = "lnmp" ]; then
        ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization ${with_curl} --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --with-gd ${with_openssl} --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --without-libzip --enable-soap --with-gettext ${with_fileinfo} --enable-opcache --with-xsl --enable-imap --with-imap --with-imap-ssl --with-kerberos --enable-imap --with-imap --with-imap-ssl --with-kerberos ${PHP_Modules_Options}
    else
        ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization ${with_curl} --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --with-gd ${with_openssl} --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --without-libzip --enable-soap --with-gettext ${with_fileinfo} --enable-opcache --with-xsl --enable-imap --with-imap --with-imap-ssl --with-kerberos --enable-imap --with-imap --with-imap-ssl --with-kerberos ${PHP_Modules_Options}

7.编辑完成后按:x存盘退出
然后可以退回到上一级文件夹,也就是lnmp1.7这个文件夹底下,执行命令安装:./install.sh

因为lnmp的默认安装是不带IMAP模块的,这里是加入IMAP模块的php安装,避免安装完成之后另外再编译安装IMAP模块的麻烦。如果需要增加安装其他的模块,也可以套用这个方法。
其他安装步骤命令细节,请参阅lnmp.org官网

评论

暂无评论