[英]Apache httpd setup and installation
這是我第一次嘗試以普通用戶(非 root 用戶)身份在我的機器中本地安裝 Apache HTTP 服務器。
我已經下載了 Apache HTTP 服務器的 Apache 2.4.1 版本 [http://httpd.apache.org/download.cgi]。 但是,當我嘗試在我的盒子中本地構建和安裝時,出現以下錯誤:
httpd/httpd-2.4.1 1059> ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring Apache Portable Runtime library ...
checking for APR... no
configure: error: APR not found. Please read the documentation.
我不確定它在尋找什么依賴項 - 我的意思是下載包不包含它? 我需要做什么來構建/部署 Apache HTTP 服務器?
提前致謝。
當它告訴您Please read documentation
這意味着您應該閱讀 Apache 文檔( http://httpd.apache.org/docs/2.4/install.html ),它告訴您
從Apache APR下載 APR 和 APR-Util 的最新版本,解壓到 ./srclib/apr 和 ./srclib/apr-util (確保域名沒有版本號;例如,APR 發行版必須在 ./srclib/apr/ 下)
然后做
./configure --with-included-apr
對於 Ubuntu 11.10,此選項似乎運行良好:
# APR
wget http://mirrors.axint.net/apache//apr/apr-1.4.6.tar.gz
tar -xvzf apr-1.4.6.tar.gz
cd apr-1.4.6/
./configure
make
make install
cd ..
# APR Utils
wget http://mirrors.axint.net/apache//apr/apr-util-1.4.1.tar.gz
tar -xvzf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
make
make install
cd ..
# Apache
wget http://apache.petsads.us//httpd/httpd-2.4.1.tar.gz
tar -xvzf httpd-2.4.1.tar.gz
cd httpd-2.4.1
./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-ssl --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-apr=/usr/local/apr/
make
make install
cd ..
你可以在下面找到更多關於它的信息
資料來源: VaporCreations.com
如果你有 Debian/Ubuntu,你可以:
apt-get install libapr1-dev libaprutil1-dev
然后./configure
完畢
以下是我如何在非 root 用戶上安裝 apache-httpd 的步驟:
重要提示:不要忘記將默認端口從 80 更改為其他端口,例如 8080,這對於非 root 用戶尤其重要。 (如何?打開httpd.conf -> 搜索“Listen 80” -> 將其更改為“Listen 8080”。
就是這樣,現在打開瀏覽器輸入“localhost: 8080 ”,它應該顯示“It works!”。
如果您使用的是 Fedora,則可以使用yum安裝APR、APR-Util 和 PCRE 。 您還需要下載 apr-devel、apr-util-devel 和 pcre-devel。
話雖如此,您只需在終端上運行以下命令,就不會再出現“ configure: error: APR not found.. ..APR-Util and PCRE ”錯誤。
yum -y install arp apr-devel apr-util apr-util-devel pcre pcre-devel
我正在使用 fedora 17 並計划使用 shell 腳本來設置 apache 2.4.3。 所以yum工作得非常流暢,而不是手動下載 apr、apr-util 和 pcre。
1、你需要APR(apache可移植運行時),它是apache web服務器的核心組件
2、如果你想進行make install,可能需要root賬號
3、即使沒有,如果沒有root賬號,apache也無法開始監聽非特權端口(低於1024)
4,獲得root權限或要求有root權限的人從官方repo(我不知道你運行的是哪個發行版)安裝apache,例如使用yum,apt-get等......
與 Apr 或 pcre 相關的錯誤需要下載源代碼,並且需要讓 Apache HTTPD“配置”過程了解文件系統上的這些源位置。 例如:如果您在 ./srclib(相對於 apache httpd)下載了 APR 的源代碼,那么您將使用
--with-included-apr
作為配置選項。
另一方面,如果您不想構建而是安裝 APR / APR-UTIL,那么您在 CentOS / RedHat 上需要以下內容:
yum 安裝 apr-util-devel apr-devel
但是,yum 提供的 APR 版本可能與此版本的 Apache httpd 所期望的不匹配。 在這種情況下,您可以下載 APR 和 APR-UTIL 並使用 --with-included-apr 選項。
您還可以使用相同的“配置、制作、制作安裝”過程構建 PCRE,然后從您停止構建 Apache httpd 的地方繼續。
或者你可以安裝 pcre: yum install pcre-devel
如果在構建 PCRE 時:您看到“編譯:無法識別的選項”,那么您可能還需要其他依賴項:請參閱以下詳細信息:
http://khanna111.com/wordPressBlog/2012/09/11/94087-2/
它還包括“mod_deflate”和“zlib”。
基本步驟
tar -xvf httpd-2.4.1-customized.tar -C ../
#Balancer folder will be created
tar -xvzf openssl-1.0.1.tar.gz -C /balancer/
cd ->/balancer/openssl-1.0.1
./config --prefix=/usr/local/ssl/ shared zlib-dynamic enable-camellia
make depend
make
make install
tar -xvzf pcre-8.30.tar.gz -C ../balancer/
/balancer/pcre-8.30
./configure --prefix=/usr/local/pcre/
make
make install
刪除 pcre 和 openssl
在 Ubuntu 機器上安裝和編譯 Apache 服務器
第一步:安裝Java JDK
sudo apt install openjdk-11-jdk
sudo gedit /etc/environment
JAVA_HOME="/usr/lib/jvm/openjdk-11"
source /etc/environment
echo $JAVA_HOME
驗證java版本
javac --version
**** 安裝其他需要的包:**
sudo apt-get install apache2-dev -y
sudo apt-get install libpcre3 libpcre3-dev
第 2 步:安裝 Apache HTTP 服務器
#1 對於 ubuntu,安裝包括 C 編譯器在內的開發工具:
sudo apt-get install build-essential checkinstall
#2 下載並解壓所需文件
假設所有文件都已經下載到 ~/Downloads 目錄中
從 Apache 下載頁面 ( https://httpd.apache.org/download.cgi ) 下載 Apache HTTP Server httpd-2.4.41.tar.gz
並遵循編譯 apache HTTP 服務器所需的庫:
****閱讀需求部分( http://httpd.apache.org/docs/2.4/install.html)***
#3 解壓tar文件
解壓后,您應該會在 ~/Downloads 中看到以下目錄列表
#4 為 apache HTTP Server 創建一個目錄
*確保賦予此目錄的所有權限,以便在編譯文件時可以讀/寫
sudo mkdir /home{your username here}/apache
授予 apache 目錄的所有權限:
sudo chmod -R 777 /home{your username here}/apache
#5 將arp和arp-util目錄復制到~/Downloads/httpd-2.4.41/srclib/
cd ~/Downloads
mv apr-util-1.6.1 ~/Downloads/httpd-2.4.41/srclib/apr-util
mv apr-1.7.0 ~/Downloads/httpd-2.4.41/srclib/apr
#6 配置編譯源。 --prefix 選項可用於將 Web 服務器安裝在可以寫入文件的位置。
cd ~/Downloads/httpd-2.4.41/
./configure --prefix=/home/{username here}/apache --with-pcre=~/Downloads/pcre2-10.34
注意:如果您在運行上述命令時遇到一些問題,您也可以嘗試
在 /usr/local/pcre 中安裝 pcre,使用
./configure --prefix=/usr/local/pcre make sudo make install
命令,然后通過運行以下命令:
cd ~/Downloads/httpd-2.4.41/
./configure --prefix=/home/{username here}/apache --with-pcre=/usr/local/pcre
制作
sudo make install
如果您仍然遇到一些問題,請確保 ~/apache 及其嵌套目錄具有讀/寫權限。 如果沒有再次運行**sudo chmod -R 777 /home{your username here}/apache**
命令。
#7 編譯 Apache HTTP 服務器。
cd ~/Downloads/httpd-2.2.25
sudo make
#8 安裝 Apache HTTP 服務器。
cd ~/Downloads/httpd-2.2.25
sudo make install
可選#9 准備您的主機文件
sudo gedit /etc/hosts
27.0.0.1 本地主機 www.example.com
sudo gedit /home/{your username here}/apache/conf/httpd.conf
並復制:
Listen 8000
ServerName www.example.com:8000
#10 測試安裝以確保 Apache HTTP Server 正常工作。
/home/{your username here}//apache/bin/apachectl -k start
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.