本文共 2809 字,大约阅读时间需要 9 分钟。
Apache是一个基金会名字,httpd才是我们需要安装的软件包,httpd早期的名字叫做Apache;
Apache官网www.apache.org下载地址
2.2源码包: 2.4源码包: apr: apr-util:
apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以方便移植(Linux移植到Windows)
apache安装条件:必须先安装gcc包、pcre包、apr与apr-util;
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gzwget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gzwget https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gztar zxvf apr-util-1.6.1.tar.gztar zxvf apr-1.6.3.tar.gztar zxvf httpd-2.4.29.tar.gz
cd apr-1.6.3/./configure --prefix=/usr/local/apr//检查下命令是否正常运行echo $?make && make install
cd /usr/local/src/apr-util-1.6.1/./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install
告错:
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
那么就搜索提示的expat
yum list |grep -i expat[root@shu-test apr-util-1.6.1]# yum list |grep -i expatexpat.x86_64 2.1.0-10.el7_3 @anacondaexpat-devel.x86_64 2.1.0-10.el7_3 @base expat.i686 2.1.0-10.el7_3 base expat-devel.i686 2.1.0-10.el7_3 base expat-static.i686 2.1.0-10.el7_3 base expat-static.x86_64 2.1.0-10.el7_3 base [root@shu-test apr-util-1.6.1]#
安装expat-devel包
yum install -y expat-devel
cd /usr/local/src/httpd-2.4.29/./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=mostmake && make install
checking for pcre-config... falseconfigure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/提示:缺少PCRE;
解决:查询与安装pcre
yum list |grep -i pcreyum install -y pcre-devel
collect2: error: ld returned 1 exit statusmake[2]: *** [htpasswd] 错误 1make[2]: 离开目录“/usr/local/src/httpd-2.4.29/support”make[1]: *** [all-recursive] 错误 1make[1]: 离开目录“/usr/local/src/httpd-2.4.29/support”make: *** [all-recursive] 错误 1
解决方案:
删除文件,重新解压源码包安装,先复制文档,在configure后加上 “--with-included-apr”。再重新编译;cd /usr/local/src/cp -r apr-1.6.3 /usr/local/src/httpd-2.4.29/srclib/aprcp -r apr-util-1.6.1 /usr/local/src/httpd-2.4.29/srclib/apr-utilcd /usr/local/src/httpd-2.4.29/./configure --prefix=/usr/local/apache2.4 --with-included-apr --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=mostmake && make install
/usr/local/apache2.4/bin/apachectl start
查询httpd是否启动
ps aux |grep httpdnetstat -lntp
apache2.4文件夹下
conf文件夹:配置文件htdocs:主页文件logs文件夹:日志文件modules:模块存放
查看apache调用的模块
/usr/local/apache2.4/bin/httpd -M/usr/local/apache2.4/bin/apachectl -M
转载于:https://blog.51cto.com/shuzonglu/2073717