Linux系統安裝Appach 2.4.6

轉載鏈接:http://www.cnblogs.com/kerrycode/p/3261101.html

Apache簡介

?

????? ? Apache HTTP Server(簡稱Apache)是Apache軟件基金會的一個開放源碼的網頁服務器,可以在大多數計算機操作系統中運行,由于其多平臺和安全性被廣泛使用,是最流行的Web服務器端軟件之一。它快速、可靠并且可通過簡單的API擴展,將Perl/Python等解釋器編譯到服務器中。關于更多Apache的介紹,可以參考百科“http://baike.baidu.com/view/28283.htm或官網http://www.apache.org/http://httpd.apache.org/的介紹

?

Apache軟件下載

? Apache的相關軟件包下載地址http://apr.apache.org/projects.html

1.?? Apache HTTP Server

??? 截止目前為止,Apache HTTP Server 目前最新的版本是 Apache httpd 2.4.6 Released, 下載地址:http://httpd.apache.org/download.cgi#apache24

2.?? APR and APR-Util包

??? 截止目前為止,APR and APR-Util的最新版本如下,下載地址:http://apr.apache.org/download.cgi

  • APR 1.4.8, released June 21, 2013
  • APR-util 1.5.2, released April 4, 2013
  • APR-iconv 1.2.1, released November 26, 2007

3.?? PCRE包

?? 截止目前為止,PCRE最新的包為8.33,下載地址如下

  • https://sourceforge.net/projects/pcre/files/pcre/

?

? 可以下載了相關安裝包,上傳到/root/kerry這個臨時目錄。也可以直接通過wget下載

Apache安裝要求

下面是官方文檔的要求,必須安裝APR、APR-Util、PCRE,gcc-c++等包,文檔URL地址http://httpd.apache.org/docs/2.4/install.html

?

Requirements

The following requirements exist for building Apache httpd:

APR and APR-Util

Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/) and use ./configure's --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

Perl-Compatible Regular Expressions Library (PCRE)

This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package. If your build system can't find the pcre-config script installed by the PCRE build, point to it using the --with-pcre parameter. On some platforms, you may have to install the corresponding -dev package to allow httpd to build against your installed copy of PCRE.

Disk Space

Make sure you have at least 50 MB of temporary free disk space available. After installation the server occupies approximately 10 MB of disk space. The actual disk space requirements will vary considerably based on your chosen configuration options, any third-party modules, and, of course, the size of the web site or sites that you have on the server.

ANSI-C Compiler and Build System

Make sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended. If you don't have GCC then at least make sure your vendor's compiler is ANSI compliant. In addition, your PATH must contain basic build tools such as make.

Accurate time keeping

Elements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting some time synchronization facility on your system. Usually thentpdate or xntpd programs are used for this purpose which are based on the Network Time Protocol (NTP). See the NTP homepage for more details about NTP software and public time servers.

Perl 5 [OPTIONAL]

For some of the support scripts like apxs or dbmmanage (which are written in Perl) the Perl 5 interpreter is required (versions 5.003 or newer are sufficient). If you have multiple Perl interpreters (for example, a systemwide install of Perl 4, and your own install of Perl 5), you are advised to use the --with-perl option (see below) to make sure the correct one is used by configure. If no Perl 5 interpreter is found by the configure script, you will not be able to use the affected support scripts. Of course, you will still be able to build and use Apache httpd.

?

Apache安裝過程

?

Step 1:安裝包gcc或gcc-c++

[root@getlnx05 pcre-8.33]# yum list gcc-c++

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Available Packages

gcc-c++.x86_64?????????????????????????????????????????????????????????????? 4.1.2-51.el5??????????????????????????????????????????????????????????????? rhel-debuginfo

[root@getlnx05 pcre-8.33]# yum list gcc

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Installed Packages

gcc.x86_64??????????????????????????????????????????????????????????????????? 4.1.2-51.el5??????????????????????????????????????????????????????????????????? installed

[root@getlnx05 pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

從上面可見gcc包已經安裝,缺少gcc-c++包,那么接下來安裝包gcc-c++,如果此處不安裝該包,后面安裝過程中會報錯

[root@getlnx05 pcre-8.33]#yum install? gcc-c++

?

Step 2:安裝包APR和APR-Util

[root@getlnx05 kerry]# ls apr*

apr-1.4.8.tar.gz? apr-util-1.5.2.tar.gz

[root@getlnx05 kerry]#

[root@getlnx05 kerry]# tar -zxf apr-1.4.8.tar.gz

[root@getlnx05 kerry]# cd apr-1.4.8

[root@getlnx05 apr-1.4.8]# ls

clip_image002

新建目錄/usr/local/apr,用作安裝目錄:

[root@getlnx05 apr-1.4.8]# mkdir /usr/local/apr

[root@getlnx05 apr-1.4.8]# ./configure --prefix=/usr/local/apr

clip_image004

[root@getlnx05 apr-1.4.8]# make

[root@getlnx05 apr-1.4.8]# make install

clip_image006

安裝完成后,可以驗證一下

[ root@getlnx05 apr]# ls -lrt

total 32

drwxr-xr-x 3 root root 4096 Aug 15 06:57 include

drwxr-xr-x 3 root root 4096 Aug 15 06:57 lib

drwxr-xr-x 2 root root 4096 Aug 15 06:57 build-1

drwxr-xr-x 2 root root 4096 Aug 15 06:57 bin

[root@getlnx05 kerry]# mkdir /usr/local/apr-util

[root@getlnx05 kerry]# tar -zxf apr-util-1.5.2.tar.gz

[root@getlnx05 kerry]# cd apr-util-1.5.2

clip_image008

[root@getlnx05 apr-util-1.5.2]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

clip_image010

[root@getlnx05 apr-util-1.5.2]# make

[root@getlnx05 apr-util-1.5.2]# make install

clip_image012

?

Step 3:安裝包PRCE

[root@getlnx05 kerry]# unzip pcre-8.33.zip

[root@getlnx05 kerry]# cd pcre-8.33

[root@getlnx05 kerry]#mkdir /usr/local/pcre

[root@getlnx05 pcre-8.33]# ./configure --prefix= /usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config

clip_image014

[root@getlnx05 pcre-8.33]# make

[root@getlnx05 pcre-8.33]# make install

clip_image016

?

Step 4:安裝Apache Http Server

[root@getlnx05 kerry]# tar zxvf httpd-2.4.6.tar.gz

[root@getlnx05? kerry]#cd httpd-2.4.6

[root@getlnx05 httpd-2.4.6]# ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

[root@getlnx05 httpd-2.4.6]#make

[root@getlnx05 httpd-2.4.6]#make install

Step 5:啟動Apache服務

[root@getlnx05 httpd-2.4.6]#? /usr/local/apache/bin/apachectl start

用瀏覽器訪問http://localhost時提示It works!

?

?

Apache安裝問題錦集

?

問題1:缺少包gcc-c++導致安裝包apr-util不通過

?

[root@getlnx05 kerry]# unzip pcre-8.33.zip

[root@getlnx05 kerry]# cd pcre-8.33

[root@getlnx05 pcre-8.33]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config

clip_image018

一般出現這個錯誤是因為沒有安裝包gcc-c++,可以通過如下命令檢查,

[root@getlnx05 pcre-8.33]# yum list gcc-c++

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Available Packages

gcc-c++.x86_64?????????????????????????????????????????????????????????????? 4.1.2-51.el5??????????????????????????????????????????????????????????????? rhel-debuginfo

[root@getlnx05 pcre-8.33]# yum list gcc

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Installed Packages

gcc.x86_64??????????????????????????????????????????????????????????????????? 4.1.2-51.el5??????????????????????????????????????????????????????????????????? installed

[root@getlnx05 pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

[root@getlnx05 pcre-8.33]# rpm -q gcc-c++

?

問題2:checking for APR-util... configure: error: the --with-apr-util parameter is incorrect

[root@getlnx05 httpd-2.4.6]#? ./configure --prefix=/usr/local/apache? --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

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

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... yes

? setting CC to "gcc"

? setting CPP to "gcc -E"

? setting CFLAGS to " -g -O2 -pthread"

? setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"

? setting LDFLAGS to " "

configure:

configure: Configuring Apache Portable Runtime Utility library...

configure:

checking for APR-util... configure: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.

[root@getlnx05 httpd-2.4.6]#

一般是由于APR-util沒有安裝成功,可以通過驗證該目錄是否為空來判斷,因為你有時候執行了make,忘了執行make isntall命令有可能導致這個錯誤。

[root@getlnx05 apr]# cd /usr/local/apr-util

[root@getlnx05 apr-util]# ls

?

問題3:沒有指定PCRE參數

[root@getlnx05 httpd-2.4.6]#? ./configure --prefix=/usr/local/apache? --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

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

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... yes

? setting CC to "gcc"

? setting CPP to "gcc -E"

? setting CFLAGS to " -g -O2 -pthread"

? setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"

? setting LDFLAGS to " "

configure:

configure: Configuring Apache Portable Runtime Utility library...

configure:

checking for APR-util... yes

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking how to run the C preprocessor... gcc -E

checking for gcc option to accept ISO C99... -std=gnu99

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

[root@getlnx05 httpd-2.4.6]#

?

問題4:安裝前忘了先安裝APR相關包

[root@getlnx05 httpd-2.4.6]#? ./configure --prefix=/usr/local/appache/

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

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... no

configure: error: APR not found.? Please read the documentation.

[root@getlnx05 httpd-2.4.6]#

?

問題5:啟動服務時報錯

[root@getlnx05 httpd-2.4.6]#? /usr/local/apache/bin/apachectl start

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using getlnx05.gfg1.esquel.com. Set the 'ServerName' directive globally to suppress this message

這個時候需要編輯httpd.conf配置文件,添加SeraverName的具體IP地址。如下所示

[root@getlnx05 conf]# cd /usr/local/apache/conf/

[root@getlnx05 conf]# ls

extra? httpd.conf? magic? mime.types? original

[root@getlnx05 conf]# vi httpd.conf

ServerAdmin you@example.com

#

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

#

#ServerName www.example.com:80

ServerName 192.168.9.122:80

#

# Deny access to the entirety of your server's filesystem. You must

# explicitly permit access to web content directories in other

# <Directory> blocks below.

#

"httpd.conf" 502L, 18179C written

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

httpd not running, trying to start

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl start

httpd (pid 7797) already running

如果從其它電腦連接訪問Apache時,輸入url地址:http://192.168.9.122頁面沒有顯示正常,而上面配置也OK,那么你必須關閉防火墻,有時候甚至需要重啟電腦才能OK,重啟Apache服務都無效。

[root@getlnx05 conf]# chkconfig iptables off

[root@getlnx05 conf]# chkconfig iptables off

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

[root@getlnx05 conf]#

?

作者:瀟湘隱者
出處:http://www.cnblogs.com/kerrycode/

本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/276459.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/276459.shtml
英文地址,請注明出處:http://en.pswp.cn/news/276459.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

[網摘].NET 程序員十種必備工具-概述

從 MSDN 中看到這篇文章&#xff0c;覺得不錯轉了過來&#xff0c;對于我這樣的.NET新手來說每個工具都是提高效率的好開始。將這十款軟件的介紹重新格式化一下&#xff0c;方便以后查閱。以 “.NET 程序員十種必備工具”開頭的10篇文章都是從這篇文章中分離出來&#xff0c;每…

完整asp.net圖形驗證碼程序

1、測試頁面&#xff1a;Default.aspx <% Page Language"C#" AutoEventWireup"true" CodeFile"Default.aspx.cs" Inherits"_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &q…

學習 redux 源碼整體架構,深入理解 redux 及其中間件原理

如果覺得內容不錯&#xff0c;可以設為星標置頂我的公眾號1. 前言你好&#xff0c;我是若川。這是學習源碼整體架構系列第八篇。整體架構這詞語好像有點大&#xff0c;姑且就算是源碼整體結構吧&#xff0c;主要就是學習是代碼整體結構&#xff0c;不深究其他不是主線的具體函數…

pdf安裝包_有么有pdf控件,不需要用戶安裝任何安裝包直接打印的?

如果開發一個軟件&#xff0c;需要用到PDF功能&#xff0c;您的選擇是基于Adobe PDF嗎&#xff1f; 如果是基于Adobe PDF&#xff0c;需要用戶安裝一個幾十M的Adobe的安裝包&#xff0c;這顯然是不友好的。即使目前也有了一些其它的閱讀器&#xff0c;大小也還好。但是&#xf…

Centos編譯安裝Apache 2.4.6筆記 配置

轉載鏈接&#xff1a;http://www.onepx.com/centos-apache-246.html 之前服務器 Apache 版本一直是 2.2.x&#xff0c;鑒于 Centos 更新軟件的惰性&#xff0c;我看直到 2014 年結束&#xff0c;apache 2.4 都不一定會出現在 Centos 中&#xff0c;我是不打算等了&#xff0c;…

[轉] C#異步操作

Title 通過委托實現異步調用中BeginInvoke及回調函數的使用 通過委托實現異步調用的步驟&#xff1a; 1.定義委托。 2.將要進行異步調用的方法“實例化”到定義的委托。 3.在委托上調用BeginInvoke方法。其中&#xff0c;BeginInvoke的參數由三個部分構成。第一部分&#xff1…

HTTP Server Error 500 內部服務器錯誤

問題&#xff1a;HTTP500錯誤 或 Server Application Error ------------------------------------Server Application ErrorThe server has encountered an error while loading an application during the processing of your request. Please refer to the event log for mo…

使用 ohmyzsh 打造 windows、ubuntu、mac 系統高效終端命令行工具

如果覺得內容不錯&#xff0c;可以設為星標置頂我的公眾號原標題名&#xff1a;oh my zsh 和 windows git bash 設置別名提高效率寫于2018年06月03日在我的微信交流群中聽聞很多前端開發比較貧窮&#xff0c;沒有買mac電腦&#xff08;比如我&#xff09;&#xff0c;也沒有用過…

request獲取mac地址_【Go】獲取用戶真實的ip地址

原文鏈接&#xff1a;https://blog.thinkeridea.com/201903/go/get_client_ip.html用戶請求到達提供服務的服務器中間有很多的環節&#xff0c;導致服務獲取用戶真實的 ip 非常困難&#xff0c;大多數的框架及工具庫都會封裝各種獲取用戶真實 ip 的方法&#xff0c;在 exnet 包…

Installation of Apache HTTPD

轉載鏈接&#xff1a;http://www.linuxfromscratch.org/blfs/view/svn/server/apache.html Installation of Apache-2.4.7 HTTPD For security reasons, running the server as an unprivileged user and group is strongly encouraged. Create the following group and user…

iPhone開發四劍客之《Objective-C基礎教程》

iPhone 開發四劍客之《Objective-C 基礎教程》 Objective-C 語言是 C 語言的一個擴展集&#xff0c;許多&#xff08;可能是大多數&#xff09;具備 Mac OS X 外觀的應用程序都是使用該語言開發的。它以 C 語言為基礎&#xff0c;添加了一些微妙但意義重大的特性。 蘋果公司為…

教師節,你記憶中老師說過印象最深的是什么話?(抽獎)

我記憶中老師說過印象最深的話小學老師&#xff1a;1、小學語文老師李老師說&#xff0c;以后你們可能帶個手機就可以支付了~不需要帶現金。&#xff08;在杭州確實實現了&#xff0c;用支付寶即可&#xff09; 2、小學數學老師李老師說&#xff1a;好好讀書的目的是啥&#xf…

Spark List組件滾動條加事件使datalist數據發生變化

<?xml version"1.0" encoding"utf-8"?><!-- http://blog.flexexamples.com/2009/05/31/detecting-when-the-vertical-scroll-bar-is-scrolled-on-a-spark-list-control-in-flex-4/ --><s:Application name"Spark_List_scroller_vert…

keras訓練完以后怎么預測_還在使用“龜速”的單顯卡訓練模型?動動手,讓TPU節省你的時間...

點擊上方關注&#xff0c;All in AI中國本文將介紹如何使用Keras和Google CoLaboratory與TPU一起訓練LSTM模型&#xff0c;與本地計算機上的GPU相比&#xff0c;這樣訓練能大大縮短訓練時間。很長一段時間以來&#xff0c;我都在單張GTX 1070顯卡上訓練我的模型&#xff0c;它的…

PHP5加載|安裝外部C動態庫

[1] cd php-5.3.9/ext[2] ./ext_skel --extnamencdocxml[3] cd ncdocxml[4] nano -w config.m4############刪除 3 個 dnldnl PHP_ARG_WITH(my_module, for my_module support,dnl Make sure that the comment is aligned:dnl [ --with-my_module Include my_module support])或…

手把手教你寫個小程序定時器管理庫

背景凹凸曼是個小程序開發者&#xff0c;他要在小程序實現秒殺倒計時。于是他不假思索&#xff0c;寫了以下代碼&#xff1a;Page({init: function () {clearInterval(this.timer)this.timer setInterval(() > {// 倒計時計算邏輯console.log(setInterval)})}, })可是&…

[New Portal]Windows Azure Virtual Machine (14) 在本地制作數據文件VHD并上傳至Azure(1)

《Windows Azure Platform 系列文章目錄》 之前的內容里&#xff0c;我介紹了如何將本地的Server 2012中文版 VHD上傳至Windows Azure&#xff0c;并創建基于該Server 2012 VHD的虛擬機。 我們知道&#xff0c;VHD不僅僅可以保存操作系統&#xff0c;而且可以保存數據文件。 如…

python 退出程序_Python:用Ctrl+C解決終止多線程程序的問題!(建議收藏)

前言&#xff1a;今天為大家帶來的內容是Python:用CtrlC解決終止多線程程序的問題&#xff01;文章中的代碼具有不錯的參考意義&#xff0c;希望在此能夠幫助到各位&#xff01;(多數代碼用圖片的方式呈現出來&#xff0c;方便各位觀看與收藏)出發點&#xff1a;前段時間&#…

Mysql InnoDB Plugin安裝 install

轉載鏈接&#xff1a;http://www.orczhou.com/index.php/2010/03/innodb-plugin-setup/ InnoDB Plugin較之Built-in版本新增了很多特性&#xff1a;包括快速DDL、壓縮存儲等&#xff0c;而且引入了全新的文件格式Barracuda。眾多測試也表明&#xff0c;Plugin在很多方面優于Bu…

Hibernate的數據過濾查詢

數據過濾并不是一種常規的數據查詢方法&#xff0c;而是一種整體的篩選方法。數據過濾也可對數據進行篩選&#xff0c;因此&#xff0c;將其放在Hibernate的數據查詢框架中介紹。 如果一旦啟用了數據過濾器&#xff0c;則不管數據查詢&#xff0c;還是數據加載&#xff0c;該過…