RHEL6.6下面搭建LAMP環境(之__Apache源碼安裝)

本文使用軟件:

Red Hat Enterprise Linux 6.6  httpd-2.4.20


第一:Apache 安裝  :

下載Apache安裝包和依賴包

http://mirrors.hust.edu.cn/apache//httpd/   httpd-2.4.20.tar.gz
http://apr.apache.org/download.cgi  apr-1.5.2.tar.gz   apr-util-1.5.4.tar.gz apr-iconv-1.2.1.tar.gz
http://exim.mirror.fr/pcre/    pcre-8.38.tar.gz
http://www.zlib.net   zlib-1.2.8.tar.gz        

      

(1) 安裝apr
tar -zxvf apr-1.5.2.tar.gz
 ./configure --prefix=/usr/local/apr
make
make install

(2) 安裝apr-iconv
tar -zxvf apr-iconv-1.2.1.tar.gz
./configure --prefix=/usr/local/apr-iconv/ --with-apr=/usr/local/apr
make
make install

(3)、安裝apr-util

tar -zxvf apr-util-1.5.4.tar.gz
# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv
# make
# make install
(4) 安裝 pcre
# tar -zxvf pcre-8.38.tar.gz
# ./configure --prefix=/usr/local/pcre
# make
# make install

(5)
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib/
make
make install


(6) 安裝apache
tar -zxvf httpd-2.4.20.tar.gz
cd httpd-2.4.20

./configure --prefix=/usr/local/apache2  --enable-ssl --enable-rewrite --enable-so --enable-headers --enable-expires --with-mpm=worker --enable-modules=most --enable-deflate --with-z=/usr/local/zlib/ --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util/  --with-pcre=/usr/local/pcre/ --enable-ssl
make
make install


vi /usr/local/apache2/conf/httpd.conf
ServerName localhost:80
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

配置開機啓動
echo "/usr/local/apache2/bin/apachectl start">>/etc/rc.local

cp /usr/local/apache2/bin/httpd /etc/init.d/
chmod a+x /etc/init.d/httpd

配置環境變量
vi ~/.bash_profile
    PATH=$PATH:$HOME/bin:/usr/local/apache2/bin
    export PATH

 source ~/.bash_profile


驗證:

/usr/local/apache2/bin/apachectl start  啓動apache

在瀏覽器中輸入http://localhost  

顯示:IT works  說明apache部署正常

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章