準(zhǔn)備工作:去apache官方網(wǎng)站下載apache源碼包
1.首先需要將apache源碼包移動到linux服務(wù)器下
2.記性解壓縮 命令一半 使用tar -zxvf ?[壓縮包名稱](你下載到apache源碼包名)
3.進入壓縮之后的源碼包文件夾
4.進入之后進行檢測操作
分解上面命令作用:
./configure ? ? ? #檢查編譯環(huán)境 執(zhí)行后將生成MakeFile文件
--prefix=/usr/local/apache2/?#指定安裝路徑
--sysconfdir=/usr/local/apache2/etc/?#指定在單個機器上使用的只讀數(shù)據(jù)的安裝位置.
--with? ?#with選項來指定具體的軟件包地址,通過without選項來指定不使用指定的軟件包。
-included-apr#指定C頭文件的安裝位置.其他語言如C++的頭文件也可以使用此選項
--enable#當(dāng)你想開啟某個文件的的時候可以使用它
5.檢測完成之后進行
make 進行編譯操作
6.編譯完成之后進行安裝操作
make install
7.安裝完成測試?
?啟動Apache測試:
????????/usr/local/apache2/bin/apachectl start
ps?aux | grep httpd ?檢測進行
netstat -tlun |grep :80 檢測80端口
如果存在則apache安裝完成
特別注意:
? ? ?安裝apache 的時候經(jīng)常容易出現(xiàn)一些錯誤,如果出現(xiàn) 如下錯誤我們應(yīng)如何調(diào)整
? 1.configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.? ??
解決方法:
? ??tar -zxvf??apr-1.4.6.tar.gz
? ? tar -zxvf??apr-util-1.4.1.tar.gz?
????cp?-r??/lamp/apr-1.4.6??/lamp/httpd-2.4.7/srclib/apr
????cp?-r??/lamp/apr-util-1.4.1??/lamp/httpd-2.4.7/srclib/apr-util
?2.configure: error: pcre-config for libpcre not found. PCRE is required and available from
解決方法:
? ??tar zxvf pcre-8.34.tar.gz
? ?cd /lamp/pcre-8.34?
? ./configure && make && make install
3.checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
解決方法:
? ? ?yum install openssl-devel