点击(此处)折叠或打开
- [root@https ~]# ls apr* httpd-2.4.9.tar.gz
- apr-1.5.1.tar.gz #这两个是apache的依赖包
-
apr-util-1.4.1.tar.gz
-
httpd-2.4.9.tar.gz
- [root@https ~]# tar -xvf httpd-2.4.9.tar.gz -C /usr/src^C
- [root@https ~]# cd /usr/src/httpd-2.4.9/
- [root@https httpd-2.4.9]# vim INSTALL #看看INSTALL文件介绍的安装软件的环境要求
我们先试着在不看INSTALL文件的情况下直接configure会有什么报错
点击(此处)折叠或打开
- [root@https httpd-2.4.9]# ./configure --prefix=/usr/local
- checking for chosen layout... Apache
- checking for working mkdir -p... yes
- checking for grep that handles long lines and -e... /bin/grep
- checking for egrep... /bin/grep -E
- checking build system type... x86_64-unknown-linux-gnu
- checking host system type... x86_64-unknown-linux-gnu
- checking target system type... x86_64-unknown-linux-gnu
- configure:
- configure: Configuring Apache Portable Runtime library...
- configure:
- checking for APR... no
- configure: error: APR not found. Please read the documentation. #提示APR没有找到
解决办法:
点击(此处)折叠或打开
- [root@https ~]# tar -xvf apr-1.5.1.tar.gz -C /usr/src/httpd-2.4.9/srclib/
- [root@https ~]# tar -xvf apr-util-1.4.1.tar.gz -C /usr/src/httpd-2.4.9/srclib/ #必须解压到这个位置
- [root@https ~]# cd /usr/src/httpd-2.4.9/srclib/
- [root@https srclib]# ls
- apr-1.5.1 apr-util-1.4.1 Makefile
- [root@https srclib]# mv apr-1.5.1 apr #不能带版本号
- [root@https srclib]# mv apr-util-1.4.1 apr-util
- [root@https srclib]# ls
- apr apr-util Makefile.in
- [root@https srclib]# cd apr
- [root@https apr]# ./configure
- [root@https apr]# make && make install
- [root@https apr]# cd ..
- [root@https srclib]# cd apr-util/
- [root@https apr-util]# ./configure --with-apr=/usr/local/apr/ #必须指定刚才apr安装的目录,默认在/usr/local
- [root@https apr-util]# make && make install
-
点击(此处)折叠或打开
- [root@https httpd-2.4.9]# ./configure --prefix=/usr/local/apache2 --enable-modules=all --with-included-apr
- ..............................
- checking for suffix of object files... o
-
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from
点击(此处)折叠或打开
- [root@https httpd-2.4.9]# yum install pcre* -y #能够成功安装
- [root@https httpd-2.4.9]# ./configure --prefix=/usr/local/apache2 --enable-modules --with-included-apr
- ....................
-
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands #执行configure发现不再报任何错误 -
[root@https httpd-2.4.9]# make && make install #一鼓作气安装apache
cannot install `libaprutil-1.la' to a directory not ending in /usr/local/apache2/apr ,问过度娘,虽然有很多朋友都遇到这种报错,但每个人操作过程不同,解决办法也
不一二足,我没有太多时间去一个个试,考虑到我是新装的系统,索性放了个绝招——make clean 之后再次 make && make install (我一向认为重启服务器、重启服务或者同样的动作再做一次能够解决80%的问题),结果是大快人心的,莫名其妙的安装成功了。
点击(此处)折叠或打开
-
[root@https httpd-2.4.9]# ls /usr/local/apache2/ #成功安装后,该目录下会生成这些文件和目录
-
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
-
[root@https httpd-2.4.9]# cd /usr/local/apache2/
-
[root@https apache2]# cd bin
-
[root@https bin]# netstat -lanput|grep 80 #查看80端口是否开启,这里还没有开启
-
[root@https bin]# ./apachectl start #启动apache服务
-
AH00557: httpd: apr_sockaddr_info_get() failed for https.host.com
- AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName
- [root@https bin]# netstat -lanput|grep 80
-
tcp 0 0 :::80 :::* LISTEN 19267/httpd #此时80端口已打开