Linux下安装Apache

已经安装过mysql


从官网下载了httpd-2.4.2.tar.gz

地址:http://httpd.apache.org/download.cgi#apache24

将该文件从下载文件夹 cp到 /usr/src下面

cp httpd-2.4.2.tar.gz /usr/src


cd /usr/src

gunzip -c httpd-2.4.2.tar.gz | tar xvf -

cd httpd-2.4.2

.configure --prefix=/usr/local/apache2



出现如下错误:

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

Configuring Apache Portable Runtime library ...

checking for APR... no
configure: error: APR not found.  Please read the documentation.


APR找不到???

http://code.sh/linux/apache%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%9Aapr-not-found/

下载:http://apr.apache.org/download.cgi

#cd /usr/src                    (源码存放位置)
#gunzip -c apr-1.4.2.tar.gz | tar xvf -
#cd apr-1.4.2
#./configure
#make
#make install


这样,在/usr/local/下出现了apr文件夹

再次检查编译环境出现

checking for APR-util... no
configure: error: APR-util not found .  Please read the documentation.


也就是没有apr-util这个文件 ,继续从官网上下载,解压,配置,make,make install

下载:http://apr.apache.org/download.cgi

root@xxl-pc:/home/xxl/下载# cd /usr/src
root@xxl-pc:/usr/src# gunzip -c apr-util-1.4.1.tar.gz | tar xvf -
#cd apr-1.4.2
root@xxl-pc:/usr/src# cd apr-util-1.4.1
root@xxl-pc:/usr/src/apr-util-1.4.1# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install

这样,在在/usr/local/下出现了apr-util文件夹。

重新进入httpd文件夹

root@xxl-pc:/usr/src/apr-util-1.4.1# cd ..
root@xxl-pc:/usr/src# cd httpd-2.4.2

进行预配置:

root@xxl-pc:/usr/src/httpd-2.4.2# ./configure --prefix=/usr/local/apache2 --with-apr-util=/usr/local/apr-util --with-apr=/usr/local/apr
又出现错误:

error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

PCRE又没有,去网站下载

下载:http://sourceforge.net/projects/pcre

root@xxl-pc:/usr/src# gunzip -c pcre-8.30.tar.gz | tar xvf -
#./configure --prefix=/usr/local/pcre

#cd pcre-8.30
#make
#make install

继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了


注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

#echo $?
0

#make
#make install


#cd /usr/local/httpd/bin/

#cp apachectl /sbin/

启动Apache
#apachectl start


添加对MySQL,Apache、PDFLib和gd的支持



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值