[root@justin ~]# chkconfig --level 35 httpd on
[root@justin ~]# /etc/init.d/httpd start
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for justin
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[确定]
[root@justin ~]# 备注:Apache启动之后会提示错误:
正在启动 httpd:httpd: Could not reliably determine the
server's fully qualif domain name, using ::1 for ServerName
解决办法:
[root@localhost libexec]# vi /etc/httpd/conf/httpd.conf
276 #ServerName 4、查看Apache占用的端口:
[root@justin src]# cd /usr/local/src/ && wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.7.tar.gz
[root@justin httpd-2.4.7]# tar zxvf httpd-2.4.7.tar.gz
[root@justin httpd-2.4.7]# cd httpd-2.4.7
[root@justin httpd-2.4.7]# mkdir -p /usr/local/apache
[root@justin httpd-2.4.7]# ./configure --prefix=/usr/local/apache/
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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
[root@justin httpd-2.4.7]#
配置报错configure: error: APR not found. Please readthe documentation.未发现APR,这个是Apache关联软件,安装和apache版本相符版本,版本过早后面也会提示类似:configure: error: APR version x.x.x or later is required的错误
[root@justin httpd-2.4.7]# wget http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz -P /usr/local/src/
[root@justin httpd-2.4.7]# cd ..
[root@justin src]# tar zxvf apr-1.5.0.tar.gz
[root@justin src]# cd apr-1.5.0
[root@justin apr-1.5.0]# mkdir -p /usr/local/apr
[root@justin apr-1.5.0]# ./configure --prefix=/usr/local/apr/
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Configuring APR library
Platform: i686-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.5.0
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/apr-1.5.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@justin apr-1.5.0]# 又出现了错误configure: error: no acceptable C compiler found in$PATH,从字面意思大致意思是没有发现可接受的C编辑器,因此需要安装下gcc套件
[root@justin apr-1.5.0]# ./configure --prefix=/usr/local/apr/
[root@justin apr-1.5.0]# make
[root@justin apr-1.5.0]# make install apr安装好了再来安装apache
[root@justin src]# cd httpd-2.4.7
[root@justin httpd-2.4.7]# ./configure --prefix=/usr/local/apache/
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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
[root@justin httpd-2.4.7]# 再次出错configure: error: APR-util not found. Please readthe documentation.没有找到APR-util,下载APR-util
[root@justin httpd-2.4.7]# wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz -P /usr/local/src/
[root@justin httpd-2.4.7]# cd ..
[root@justin src]# tar zxvf apr-util-1.5.3.tar.gz
[root@justin src]# cd apr-util-1.5.3
[root@justin apr-util-1.5.3]# mkdir -p /usr/local/apr-util
[root@justin apr-util-1.5.3]# ./configure --prefix=/usr/local/apr
apr/ apr-util/
[root@justin apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/bin/apr-1-config
[root@justin apr-util-1.5.3]# make && make install 再次回到安装apache
[root@justin apr-util-1.5.3]# cd ../httpd-2.4.7
[root@justin httpd-2.4.7]# ./configure --prefix=/usr/local/apache/
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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
[root@justin httpd-2.4.7]# 已经安装好了APR-util还是提示没安装,我们需要在配置是指定他位置
[root@justin httpd-2.4.7]# ./configure --prefix=/usr/local/apache/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
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... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 http://pcre.org/
[root@justin httpd-2.4.7]# 编译安装就是这么坑,你需要解决一系列的依赖关系,再次提示错误configure: error: pcre-config forlibpcre not found. PCRE is required and available from http://pcre.org/,同样我们需要先安装这个pcre
[root@justin src]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip -P /usr/local/src/
[root@justin httpd-2.4.7]# cd ..
[root@justin src]# unzip -o pcre-8.34.zip
[root@justin src]# cd pcre-8.34
[root@justin pcre-8.34]# mkdir /usr/local/pcre
[root@justin pcre-8.34]# ./configure --prefix=/usr/local/pcre/
checking for dirent.h... yes
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
configure: error: You need a C++ compiler for C++ support.
[root@justin pcre-8.34]# configure: error: You need a C++ compiler forC++ support.需要安装C++,前面安装gcc的时候可以一起安装了,免得这步又的安装