liunx64位系统下安装apache
64位的linux系统在/usr下面有lib和lib64这两个库,在安装apr-util时会报错,说是找不到一个库文件,这时只要在./configure里加上lib的路径就可以了,如下:
apache 需要的编译器gcc,查看gcc是否已安装:rpm -qa |grep gcc* 若没安装则先安装gcc:yum install gcc -y
查看zlib-devel是否已安装,若无,则安装:yum install zlib-devel
# cd /usr/local/
# tar xvfz httpd-2.2.15.tar.gz
# cd httpd-2.2.15
1.编译和安装 apr
cd srclib/apr
./configure --libdir=/usr/lib64 --prefix=/usr/local/apr
make
make install
2. 编译和安装 apr-util
cd ../apr-util
./configure --libdir=/usr/lib64 --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make (如果这一步报错,就先执行下面的再执行本步)
make install
# vi Makefile
将
APRUTIL_LIBS = -lsqlite3 /usr/lib/libexpat.la /root/tar/httpd-2.2.3/srclib/apr/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
改为
APRUTIL_LIBS = -lsqlite3 /usr/lib64/libexpat.la /root/tar/httpd-2.2.3/srclib/apr/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
3. 安装Apache
cd ../../apache2.2.4
./configure LDFLAGS="-L/usr/lib64 -L/lib64"--prefix=/usr/local/httpd-2.2.15 --enable-mods-shared=all --with-mpm=worker --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy –-enable-proxy-ajp –-enable-proxy-balancer –enable-proxy-http --enable-rewrite --enable-charset-lite --disable-ipv6 -disable-dav -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util
make
make install
或者直接用--libdir=/usr/lib64也可以
./configure --libdir=/usr/lib64 --prefix=/usr/local/httpd-2.2.15 --enable-mods-shared=all --with-mpm=worker --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy –-enable-proxy-ajp –-enable-proxy-balancer –enable-proxy-http --enable-rewrite --enable-charset-lite --disable-ipv6 -disable-dav -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util
( 上最好手动输入,否则可能会报错)
(先输入这个)./configure --libdir=/usr/lib64 --prefix=/usr/local/httpd-2.2.15 --enable-mods-shared=all --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy --enable-proxy-ajp --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-charset-lite --disable-ipv6 --disable-dav --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util