标签:index exp local 支持 pes 分享图片 .exe 编译报错 inux
cd /usr/local/src/
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.34.tar.gz
wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
说明:
apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便的从linux移植到windos
2.解压安装包
tar zxvf httpd-2.4.34.tar.gz
tar zxvf apr-1.6.3.tar.gz
tar zxvf apr-util-1.6.1.tar.gz
3.编译安装 apr-1.6.3
cd apr-1.6.3
./configure --prefix=/usr/local/apr
报错01:
[root@server-1 apr-1.6.3]# ./configure --prefix=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.6.3
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/apr-1.6.3‘:
configure: error: no acceptable C compiler found in $PATH
See `config.log‘ for more details
[root@server-1 apr-1.6.3]# echo $?
1
解决办法:安装gcc
yum install gcc -y
再次config编译成功
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@server-1 apr-1.6.3]#make && make install
[root@server-1 apr-1.6.3]# echo $?
0
4.编译安装apr-util-1.6.1
cd /usr/local/src/apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
编译安装报错
解决报错:安装expat库
yum install expat-devel -y
再次执行make && make install,报错解决
5.编译安装httpd-2.4.29
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 \ ##支持动态扩展模块,apache支持以一个动态模块存在,Apache本身就是一个进程服务
--enable-mods-shared=most
编译报错01:configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决办法:
yum install pcre-devel -y
再次执行./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most返回如下界面,表示configure编译成功
注:如果在编译过程中出现,缺少某个依赖包,解决思路
yum list |grep 包
然后安装devel关键字的软件包
yum install -y 软件包
make && make install 编译安装报错
说明:缺少了xml相关的库,需要安装libxml2-devel包。直接安装并不能解决问题,因为httpd调用的apr-util已经安装好了,但是apr-util并没有libxml2-devel包支持
解决办法:
参考https://blog.csdn.net/MrDing991124/article/details/78829184
重新安装libxml2-devel
yum install -y libxml2-devel
删除apr-util软件包
rm -rf /usr/local/src/apr-util-1.6.1
cd /usr/local/src/
重新编译安装apr-util
tar zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
[root@localhost apr-util-1.6.1]# pwd
/usr/local/src/apr-util-1.6.1
[root@localhost apr-util-1.6.1]# cd ..
[root@localhost src]#
[root@localhost src]# cd httpd-2.4.34
[root@localhost httpd-2.4.34]#
[root@localhost httpd-2.4.34]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
返回下面界面说明configure这步编译成功
make && make install
返回下面界面说明make && make install 执行成功
root@server-1 httpd-2.4.29]# cd /usr/local/apache2.4/
[root@server-1 apache2.4]# ls
bin build cgi-bin conf error htdocs icons include logs man manual modules
说明:
bin目录:命令执行
conf目录:配置文件所在目录
htdocs目录:默认网站访问的内容就存在这个目录下
logs日志目录:访问日志,服务报错日志
modules目录:存放apache需要的模块
[root@server-1 apache2.4]# ls ./modules/
[root@server-1 apache2.4]# ls ./htdocs/
index.html
[root@server-1 apache2.4]# ls ./bin/
[root@server-1 apache2.4]# ls ./logs/
[root@server-1 apache2.4]# ls ./conf/
extra httpd.conf magic mime.types original
查看apache服务状态,执行/usr/local/apache2.4/bin/apachectl命令后返回如下提示
[root@localhost apache2.4]# /usr/local/apache2.4/bin/apachectl
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName‘ directive globally to suppress this message
解决办法:
编译/usr/local/apache2.4/conf/httpd.conf文件,把参数 ServerName改为
ServerName localhost
注意:这里的localhost表示本机主机名,主机名可以自定义为其他
然后重启apache服务
[root@localhost src]# /usr/local/apache2.4/bin/apachectl restart
[root@localhost src]# /usr/local/apache2.4/bin/apachectl
httpd (pid 71429) already running
查看apache加载的模块
/usr/local/apache2.4/bin/httpd -M
说明: apache会加载两种类型的模块
static:静态模块
shared:动态模块
两者的区别在于,static模块是已经编译安装到/usr/local/apache2.4/bin/httpd配置文件中,而shared表示apache动态加载的模块
启动apache服务
/usr/local/apache2.4/bin/apachectl start
查看apache服务进程
[root@localhost ~]# ps aux |grep httpd
root 1463 3.0 0.2 253600 8828 ? Ss 04:19 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 1464 2.0 0.2 540428 8916 ? Sl 04:19 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 1465 2.0 0.2 540428 8916 ? Sl 04:19 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 1470 1.0 0.2 540428 8912 ? Sl 04:19 0:00 /usr/local/apache2.4/bin/httpd -k start
root 1549 0.0 0.0 112704 972 pts/1 R+ 04:19 0:00 grep --color=auto httpd
标签:index exp local 支持 pes 分享图片 .exe 编译报错 inux
原文地址:http://blog.51cto.com/liuleis/2170204