在Linux下用源碼編譯安裝apache2

Linux下安裝一個軟件,最好去看下它的官方guide,apache2.4的安裝安裝guidehtml

0. installation guide http://httpd.apache.org/docs/2.4/install.htmlshell


而後是下載源碼apache

1. download http2.4, 下載地址ide

下載好了之後,把它解壓到一個路徑下,這裏我把解壓後的路徑記爲$HTTPDui


2 接下來是下載它所依賴的包apr和apr-util,在這裏 http://apr.apache.org/download.cgi#aprutil1spa

apr的下載連接,即http://mirror.reverse.net/pub/apache/apr/apr-1.4.8.tar.gz.net

apr-util的下載連接,即http://apache.mesi.com.ar//apr/apr-util-1.5.2.tar.gzrest


3. apr和apr-util下載好了之後,把他們解壓並把內容分別放在$HTTPD/srclib/apr 和 $HTTPD/srclib/apr-util目錄下code


4. 接下來下載pcre,下載連接,即http://www.pcre.org/ htm

下載pcre後解壓,而後按以下命令安裝:

 

   ./configure
   make
   make install


5. 接下來轉到目錄$HTTPD下,用如下命令安裝apache2

 

 

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


6. 用如下命令啓動httpd ( apachectl start/stop/restart)

 

 

   cd /usr/local/apache2/bin/
   ./apachectl start


7. 啓動的時候發現如下error

 

 

error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory


8. 有人已經提供瞭解決方法, 連接在此

 

主要是一個依賴包問題:


用如下shell命令解決:

 

echo "/usr/local/lib" >> /etc/ld.so.conf.d/libc.conf
sudo ldconfig


注:安裝過程用root用戶

相關文章
相關標籤/搜索