Install apache in linux(ubuntu or redhat/centos)
#! /bin/bash
cd /usr/local/src
#yum install -y gcc make gcc-c++ wget pcre*
apt-get install build-essential
#download files
wget http://mirror.bit.edu.cn/apache/apr/apr-1.4.6.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.1.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-iconv-1.2.1.tar.gz
wget http://sourceforge.net/projects/pcre/files/pcre/8.31/pcre-8.31.tar.gz
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.3.tar.gz
#install apr
tar -xvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
# install apr-util
cd ..
tar -xvf apr-util-1.5.1.tar.gz
cd apr-util-1.5.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make && make install
#install apr-iconv
cd ..
tar -xvf apr-iconv-1.2.1.tar.gz
cd apr-iconv-1.2.1
./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
make && make install
#install pcre
cd ..
tar -xvf pcre-8.31.tar.gz
cd pcre-8.31
./configure --prefix=/usr/local/pcre
make && make install
#install httpd
cd ..
tar -xvf httpd-2.4.3.tar.gz
cd httpd-2.4.3
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-pcre=/usr/local/pcre/bin/pcre-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config
make && make install
#remove extracted and downloaded files
cd ..
rm -rf apr-1.4.6
rm -rf apr-util-1.5.1
rm -rf apr-iconv-1.2.1
rm -rf pcre-8.31
rm -rf httpd-2.4.3
rm -rf apr-1.4.6.tar.gz
rm -rf apr-iconv-1.2.1.tar.gz
rm -rf apr-util-1.5.1.tar.gz
rm -rf pcre-8.31.tar.gz
rm -rf httpd-2.4.3.tar.gz
浙公网安备 33010602011771号