1.环境介绍
系统:2.6.32-279.el6.i686
2.准备编译环境
[[email protected] ~]# yum groupinstall "Server Platform Development" "Development tools" -y [[email protected] ~]# yum install pcre-devel -y
3.下载安装需要软件
[[email protected] ~]# cd /usr/src #切换到src目录 [[email protected] ~]# wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz #下载apr文件 [[email protected] src]# wget ftp://ftp.mirrorservice.org/sites/ftp.apache.org/apr/ apr-util-1.5.4.tar.gz #下载apr-util文件 [[email protected] src]# wget http://mirrors.cnnic.cn/apache//httpd/ httpd-2.4.25.tar.bz2 #下载httpd文件 [[email protected] src]# ls apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz debug httpd-2.4.25.tar.bz2 kernels
4.安装apr,apr-tuil
[[email protected] src]# tar xf apr-1.5.2.tar.gz #解压 [[email protected] src]# cd apr-1.5.2 [[email protected] apr-1.5.2]# ./configure --prefix=/usr/local/apr/ #编译 [[email protected] apr-1.5.2]# make && make install #安装
[[email protected] src]# tar xf apr-util-1.5.4.tar.gz [[email protected] src]# cd apr-util-1.5.4 [[email protected] apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr [[email protected] apr-1.5.2]# make && make install
5.编译httpd
[[email protected] src]# tar xf httpd-2.4.25.tar.bz2 [[email protected] src]# cd httpd-2.4.25 [[email protected] httpd-2.4.25]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event --with-include-apr [[email protected] httpd-2.4.25] make && make install
6.其他必要的配置
[[email protected] httpd-2.4.25]# ln -sv /etc/httpd24/ /etc/httpd #创建符号链接 `/etc/httpd‘ -> `/etc/httpd24/‘ [[email protected] httpd-2.4.25]# vim /etc/profile.d/httpd.sh #添加path变量 [[email protected] httpd-2.4.25]# cat /etc/profile.d/httpd.sh export PATH=/usr/local/apache/bin:$PATH [[email protected] httpd-2.4.25]# source /etc/profile.d/httpd.sh #生效httpd.sh文件 [[email protected] httpd-2.4.25]# httpd -v #查看版本 Server version: Apache/2.4.25 (Unix) Server built: Apr 3 2017 19:00:32 [[email protected] httpd-2.4.25]# vim /etc/man.config #配置man文档 #添加行 MANPATH /usr/local/apache/man
7启动httpd
[[email protected] httpd-2.4.25]# apachectl start #启动 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 httpd (pid 2863) already running [[email protected] httpd-2.4.25]# elinks -source 192.168.168.152 #测试网页 <html><body><h1>It works!</h1></body></html>
时间: 2024-10-15 11:23:42