转载自:
http://blog.sina.com.cn/s/blog_71f475350101c5of.html
虚拟机平台vmware 9.0,CentOS-6.4-i386-bin-DVD1,
gcc 可以这样安装yum install gcc -y,从网上下载大约六十兆文件完成安装
如果有安装的文件夹,用 rm –rf 文件夹名称 删除,下面前四个是要用到的安装包
apr-1.4.6.tar.gz
apr-util-1.3.8.tar.gz
pcre-8.32.tar
httpd-2.4.4.tar.gz
MySQL-server-5.6.11-2.el6.i686.rpm
php-5.4.15.tar.gz
安装httpd的时候会提示需要安装apr,安装完apr后再次编译httpd,提示安装apr-util,问题在于安装apr-util提示“configure: error: APR could not be located. Please use the --with-apr option.”这时候需要在后面配置加参数“[root@localhost apr-util-1.3.8]# ./configure --with-apr=/usr/local/apr”
安装过程又出现“configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
这样的提示
去下载http://sourceforge.net/projects/pcre/files/pcre/8.32/
安装httpd-2.4.4.tar.gz
tar zxvf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure
提示如下错误信息
configure: error: APR not found.
Please read the documentation.
解压缩,安装apr-1.4.6
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure
make
make install
再次编译
cd ..
cd httpd-2.4.4
./configure
提示如下错误信息
configure: error: APR-util not found.
Please read the documentation.
解压缩,安装APR-util
tar zxvf
apr-util-1.3.8.tar.gz
cd apr-util-1.3.8
./configure
提示需要指定--with-apr参数
configure: error: APR could not be located. Please use the --with-apr option.
指定参数编译
./configure --with-apr=/usr/local/apr
make
make install
以下安装包的命令和上面一样,编译apache时
./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
其实安装时候默认的路径就是/usr/local/apache2。不用建一个文件夹也可以的
(#./configure --prefix=/usr/local/apache2
--enable-modules=so
/DSO模式安装apache
--enable-rewrite)
启动apache服务
[root@localhost bin]# /usr/local/apache2/bin/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 7861) already running
在浏览器输入127.0.0.1会出现“It works!”再详细配置/apache2/conf/里面的httpd.conf
在187行 ServerName www.example.com:80
192.168.160.133(自己的ip)
这样在浏览器输入192.168.160.133也可以访问
[root@localhost conf]# poweroff