Linux系統安裝Apache 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:安裝包gccgcc-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:安裝包APRAPR-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]#

轉載于:https://www.cnblogs.com/hyl8218/p/7543404.html

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

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

相關文章

深淺拷貝

lst1 ["金毛獅王", "紫衫龍王", "白眉鷹王", "青翼蝠王"] lst2 lst1 print(lst1) print(lst2) lst1.append("楊逍") print(lst1) print(lst2) # 結果: # [金毛獅王, 紫衫龍王, 白眉鷹王, 青翼蝠王, 楊逍] # [金毛獅王 紫衫…

lnmp化境開啟pathinfo,支持tp5.0等訪問

一、 開啟pathinfo   #注釋 下面這一行 #include enable-php.conf #載入新的配置文件 include enable-php-pathinfo.conf #添加如下location / {if (!-e $request_filename){rewrite ^/(.*)$ /index.php/$1 last;break;}}location ~ /index.php {fastcgi_pass 127.0.0.1:…

深度解密GO語言之反射

反射和 Interface 息息相關&#xff0c;而 Interface 是我們上一篇文章的內容。在開始正文前&#xff0c;和大家說點題外話。 上一篇關于 Interface 的文章發出后&#xff0c;獲得了很多的關注和閱讀。比如&#xff0c;登上了 GoCN 的每日新聞第一條&#xff1a; 可能是編輯者覺…

Python爬蟲-正則表達式

正則表達式 只提取關注的數據&#xff0c;進行數據賽選 原子&#xff1a; 基本組成單位 普通的字符 非打印支付 通用字符 普通的字符 >>> import re >>> pat"yue" >>> string"http://yum.iqianyue.com" >>> rst1re.se…

openfire(一):使用idea編譯openfire4.2.3源碼

最近公司項目要使用openfire&#xff0c;并對源碼做一些修改&#xff0c;使用的openfire版本為官網目前最新版本4.2.3&#xff0c;網上資料較少&#xff0c;踩了很多坑&#xff0c;特此記錄。 1.下載源碼 http://www.igniterealtime.org/downloads/source.jsp 2.使用idea導入源…

JAVA synchronized關鍵字鎖機制(中)

synchronized 鎖機制簡單的用法&#xff0c;高效的執行效率使成為解決線程安全的首選。 下面總結其特性以及使用技巧&#xff0c;加深對其理解。 特性: 1. Java語言的關鍵字&#xff0c;當它用來修飾一個方法或者一個代碼塊的時候&#xff0c;能夠保證在同一時刻最多只有一個線…

Python多線程豆瓣影評API接口爬蟲

爬蟲庫 使用簡單的requests庫&#xff0c;這是一個阻塞的庫&#xff0c;速度比較慢。 解析使用XPATH表達式 總體采用類的形式 多線程 使用concurrent.future并發模塊&#xff0c;建立線程池&#xff0c;把future對象扔進去執行即可實現并發爬取效果 數據存儲 使用Python ORM sq…

【自制工具類】Java刪除字符串中的元素

這幾天做項目需要把多個item的id存儲到一個字符串中&#xff0c;保存進數據庫。保存倒是簡單&#xff0c;只需要判斷之前是否為空&#xff0c;如果空就直接添加&#xff0c;非空則拼接個“&#xff0c;” 所以這個字符串的數據結構是這樣的 String str "a,b,c,d"; 保…

DMA存儲器到外設代碼講解

實驗目的: bsp_dma_mtp.h #ifndef __BSP_DMA_MTP_H #define __BSP_DMA_MTP_H#include "stm32f10x.h" #include <stdio.h>// 串口工作參數宏定義 #define DEBUG_USARTx USART1 #define DEBUG_USART_CLK RCC_APB2Periph_USAR…

java基礎集合類——LinkedList 源碼略讀

1.概覽 LinkedList是java的動態數組另一種實現方式&#xff0c;底層是基于雙向鏈表&#xff0c;而不是數組。 public class LinkedList<E>extends AbstractSequentialList<E>implements List<E>, Deque<E>, Cloneable, java.io.Serializable LinkedLis…

[BZOJ] 1688: [Usaco2005 Open]Disease Manangement 疾病管理

1688: [Usaco2005 Open]Disease Manangement 疾病管理 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 727 Solved: 468[Submit][Status][Discuss]Description Alas! A set of D (1 < D < 15) diseases (numbered 1..D) is running through the farm. Farmer John woul…

es6 var、let、const命令

1.let和var <1>let聲明的變量僅在塊級作用域內有效&#xff1b; var聲明的變量在全局有效&#xff1b; <2> var變量樂意在聲明之前使用&#xff0c;輸出undefined; let 不可以&#xff0c;直接拋出一個錯誤&#xff1b; 例如&#xff1a;//var 聲明console.log(a);…

實例屬性和類屬

1.Python是動態語言&#xff0c;根據類創建的實例&#xff0c;可以任意綁定屬性 2.給實例綁定屬性的方法有兩種&#xff1a; 通過實例變量或者通過self變量。 1 class Student(object): 2 def __init__(self, name): 3 self.namename 4 5 ##或者如下&#xff1a; 6 &g…

vim中跳到第一行和最后一行

底線命令模式 :0或:1跳到文件第一行 :$跳到文件最后一行 命令模式 gg跳到第一行 shiftg跳到文件最后一行轉載于:https://www.cnblogs.com/liuys635/p/10831196.html

bootstrap-table 刷新頁面數據

bom.bootstrapTable(load,msg[object]);//這一步 務必要添加。if(msg[code]1){bom.find(tbody).css(display,table-row-group)bom.bootstrapTable({data: msg[object],columns: columns,resizable: true,cache:false,pagination: true,sidePagination: client,pageNumber: 1,pa…

Image-to-Image Translation with conditional Adversarial Networks ---- Pix-2-Pix

任務場景 Photos to semantic segmentationCityscapes labels to photosColorizationFacades labels to photoDay to nightThe edges to photoAnd so on.在生成器模型中&#xff0c;條件變量y實際上是作為一個額外的輸入層&#xff08;additional input layer&#xff09;&…

5分鐘從零構建第一個 Apache Flink 應用

為什么80%的碼農都做不了架構師&#xff1f;>>> 在本文中&#xff0c;我們將從零開始&#xff0c;教您如何構建第一個Apache Flink &#xff08;以下簡稱Flink&#xff09;應用程序。 開發環境準備 Flink 可以運行在 Linux, Max OS X, 或者是 Windows 上。為了開發…

WinForm窗體中如何在一個窗體中取到另一個窗體的值

例如我們定義兩窗體&#xff0c;Form1和Form2&#xff0c;如何在Form2中取到Form1中的一個值呢&#xff1f; 解決方法1&#xff1a; 在Form1 中定義一個成員變量&#xff0c;例如public string a “ ”: 然后給這個成員變量賦值&#xff0c;例如 a lblname.text; 在Form2中我…

Android6.0------權限申請RxPermissions

前面寫了Android6.0權限介紹和權限單個&#xff0c;多個申請&#xff0c;用的是純Java代碼&#xff0c;本文主要說的是借助第三方庫來實現權限申請。 借助第三方庫 RxPermissions來申請6.0權限。 RxPermissions庫地址&#xff1a;https://github.com/tbruyelle/RxPermissions …

如何給 mongodb 設置密碼

言簡意賅&#xff0c;步驟如下&#xff1a; 連接mongo mongo進入admin數據庫 use admin  創建管理員賬戶db.createUser({ user: "adminName", pwd: "adminPassword", roles: [{ role: "userAdminAnyDatabase", db: "admin&qu…