安装Apache
1.下载httpd-2.4.46.tar.gz、apr-1.6.5.tar和apr-util-1.6.1.tar
cd/usr/local/src 把下载好的安装包放入到里面 使用
wget https://mirrors.cnnic.cn/apache/httpd/httpd-2.4.46.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz 进行下载

2. 分别解压 使用tar.zxvf 安装包名称
tar -zxvf httpd-2.4.46.tar.gz
tar -zxvf apr-1.6.5.tar.gz
#ar -zxvf apr-util-1.6.1.tar.gz
3.安装和配置
cd /usr/local/srcapr-1.6.5
执行./configure --prefix=/usr/local/apr
如果报错“configure: error: no acceptable C compiler found in $PATH”,则安装软件包
# yum install -y gcc
再次执行./configure --prefix=/usr/local/apr
如果报错“rm: cannot remove 'libtoolT': No such file or directory”
# vi configure
将RM='$RM'改为RM='$RM -f'
4. 进行编译 make &&make install
5.按照上步继续安装第二个安装包
# cd /usr/local/src/httpd-2.4.46
#yum install -y pcre pcre-devel
//为避免配置时出错提前安装库文件
# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
//--perefix指定安装目录
//--enable-so表示启用DSO
//--enable -mods- shared表示以共享形式安装模块
进行编译 make &&make install
如果报错“collect2: error: ld returned 1 exit status make[2]: *** [htpasswd] Error 1”
解决方案:
# cd /usr/local/src/
# cp -r apr-1.6.5 /usr/local/src/httpd-2.4.46/srclib/apr
# cp -r apr-util-1.6.1 /usr/local/src/httpd-2.4.46/srclib/apr-util
如果还是不行,重新执行configure命令,添加一个编译参数:--with-included-apr
再执行make clean all
#make && make install
/usr/local/apache2.4/bin/apachectl -M
//查看配置文件有哪些文件
//share字样的动态共享模块,static以静态形式存在

显示安装成功

浙公网安备 33010602011771号