1、下载apache的源码包,放到linux上(wget),解压到/usr/local/src目录下(放置源码的地方);
2、进入解压后的目录/usr/local/src/httpd2.4****,执行./configure --prefix=/usr/local/apache-2.4 (指定安装目录)生成makefile文件;
3、make 编译和make install 安装;
问题:
apr(apr-util,pcre) not found :
需要安装apr,apr-util,pcre,分别下载,然后编译安装。
最后执行./configure时选项加上 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
启动httpd:
/usr/local/apache-2.4/bin/httpd -k start(restart,stop)
若出现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,意思是设置severname,在配置文件中设置为localhost即可。
也可以加入系统服务。
总之,yum安装还是方便点对于初学者,但是版本就不会是新的,性能也可能不比编译安装的好。