Apache 2.4.28的安装
1.安装Apache
1.1下载Apache
网址:http://httpd.apache.org/
[root@localhost ~]# mkdir -p /root/soft/Apache/ [root@localhost ~]# cd soft/Apache/ [root@localhost Apache]# wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.28.tar.gz
1.2下载apr and apr-util
网址:http://apr.apache.org/
[root@localhost Apache]# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.2.tar.gz [root@localhost Apache]# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
1.3下载openssl
网址:https://www.openssl.org/
[root@localhost Apache]# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
1.4安装openssl
[root@localhost Apache]# tar xf openssl-1.0.2l.tar.gz [root@localhost Apache]# cd openssl-1.0.2l [root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib [root@localhost openssl-1.0.2l]# make [root@localhost openssl-1.0.2l]# make install
1.5安装pcre
[root@localhost openssl-1.0.2l]# clear [root@localhost openssl-1.0.2l]# cd .. [root@localhost Apache]# .tar.gz [root@localhost Apache]# cd apr- [root@localhost apr-]# ./configure --prefix=/usr/local/apr [root@localhost apr-]# make [root@localhost apr-]# make install
1.6 安装apr-util
[root@localhost apr-]# clear [root@localhost apr-]# cd ../ [root@localhost Apache]# .tar.gz [root@localhost Apache]# cd apr-util- [root@localhost apr-util-]# [root@localhost apr-util-]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [root@localhost apr-util-]# make [root@localhost apr-util-]# make install
1.7 安装Apache
[root@localhost apr-util-]# clear [root@localhost apr-util-]# cd .. [root@localhost Apache]# .tar.gz [root@localhost httpd-]# useradd apache -s /sbin/nologin [root@localhost httpd-]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-suexec-uidmin=apache --with-suexec-gidmin=apache --enable-so --enable-ssl --with-ssl=/usr/local/openssl --enable-modules=most [root@localhost httpd-]# make [root@localhost httpd-]# make install
报错与解决:
问题:
[root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib Operating system: x86_64-whatever-linux2 You need Perl .
解决:
[root@localhost openssl-1.0.2l]# yum install perl perl-devel
问题:
[root@localhost openssl-1.0.2l]# make making all in crypto... ]: Entering directory `/root/soft/Apache/openssl-1.0.2l/crypto' /usr/bin/perl ../util/mkbuildinf.pl "gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fPIC -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM" "linux-x86_64" >buildinf.h gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fPIC -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -c -o cryptlib.o cryptlib.c ]: gcc: Command not found ]: *** [cryptlib.o] Error ]: Leaving directory `/root/soft/Apache/openssl-1.0.2l/crypto' [root@localhost openssl-1.0.2l]#
解决:
[root@localhost openssl-1.0.2l]# yum install gcc gcc-c++
问题:
config.status: executing libtool commands rm: cannot remove 'libtoolT': No such file or directory config.status: executing default commands
解决:
[root@localhost apr-]# yum install libtool libtool-ltdl-devel
问题:
xml/apr_xml.c::: fatal error: expat.h: No such file or directory #include <expat.h> ^ compilation terminated. ]: *** [xml/apr_xml.lo] Error ]: Leaving directory `/root/soft/Apache/apr-util-' [root@localhost apr-util-]#
解决:
[root@localhost apr-util-]# yum install expat-devel expat
问题:
checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决:
下载pcre
网址: http://pcre.org/
下载:
[root@localhost httpd-]# cd .. [root@localhost Apache]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
安装pcre
[root@localhost Apache]# tar xf pcre-8.38.tar.gz [root@localhost Apache]# cd pcre-8.38 [root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre [root@localhost pcre-8.38]# make [root@localhost pcre-8.38]# make install
再次安装apache
[root@localhost pcre- [root@localhost httpd-]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-suexec-uidmin=apache --with-suexec-gidmin=apache --enable-so --enable-ssl --with-ssl=/usr/local/openssl --enable-modules=most
问题;
/usr/local/apr/build-/libtool --silent --mode=link .la -lexpat /usr/local/apr/lib/libapr-.la -lrt -lcrypt -lpthread -ldl -lcrypt libtool: error: cannot find the library '/usr/local/pcre/lib/libapr-1.la' or unhandled argument '/usr/local/pcre/lib/libapr-1.la' ]: *** [htpasswd] Error
解决:
[root@localhost lib]# .la /root/soft/Apache/apr-/.libs/libapr-.la /root/soft/Apache/apr-/libapr-.la /usr/local/apr/lib/libapr-.la [root@localhost httpd-]# /.libs/libapr-.la /usr/local/pcre/lib/libapr-.la
再次编译后报错
r/local/apr/lib/libapr-.la -lrt -lcrypt -lpthread -ldl -lcrypt libtool: warning: library '/usr/local/apr/lib/libapr-1.la' was moved. libtool: warning: library '/usr/local/apr/lib/libapr-1.la' was moved. .so: No such file or directory ]: *** [htpasswd] Error
解决:
[root@localhost httpd-]# .so /root/soft/Apache/apr-/.libs/libapr-.so /usr/local/apr/lib/libapr-.so [root@localhost httpd-]# mkdir -p /usr/local/pcre/lib/.libs [root@localhost httpd-]# /.libs/libapr-.so /usr/local/pcre/lib/.libs/libapr-.so