1. 程式人生 > >Linux系統安裝Apache 2.4.6

Linux系統安裝Apache 2.4.6

2013-08-15 23:19 by 瀟湘隱者, 28516 閱讀, 0 評論, 收藏編輯

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軟體下載

1.   Apache HTTP Server

2.   APR and APR-Util包

  • 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,下載地址如下

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

Apache安裝要求

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++

[[email protected] 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

[[email protected] 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

[[email protected] pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

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

[[email protected] pcre-8.33]#yum install  gcc-c++

Step 2:安裝包APRAPR-Util

[[email protected] kerry]# ls apr*

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

[[email protected] kerry]#

[[email protected] kerry]# tar -zxf apr-1.4.8.tar.gz

[[email protected] kerry]# cd apr-1.4.8

[[email protected] apr-1.4.8]# ls

clip_image002

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

[[email protected] apr-1.4.8]# mkdir /usr/local/apr

[[email protected] apr-1.4.8]# ./configure --prefix=/usr/local/apr

clip_image004

[[email protected] apr-1.4.8]# make

[[email protected] apr-1.4.8]# make install

clip_image006

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

[ [email protected] 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

[[email protected] kerry]# mkdir /usr/local/apr-util

[[email protected] kerry]# tar -zxf apr-util-1.5.2.tar.gz

[[email protected] kerry]# cd apr-util-1.5.2

clip_image008

[[email protected] apr-util-1.5.2]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

clip_image010

[[email protected] apr-util-1.5.2]# make

[[email protected] apr-util-1.5.2]# make install

clip_image012

Step 3:安裝包PRCE

[[email protected] kerry]# unzip pcre-8.33.zip

[[email protected] kerry]# cd pcre-8.33

[[email protected] kerry]#mkdir /usr/local/pcre

[[email protected] pcre-8.33]# ./configure --prefix= /usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config

clip_image014

[[email protected] pcre-8.33]# make

[[email protected] pcre-8.33]# make install

clip_image016

Step 4:安裝Apache Http Server

[[email protected] kerry]# tar zxvf httpd-2.4.6.tar.gz

[[email protected]  kerry]#cd httpd-2.4.6

[[email protected] 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

[[email protected] httpd-2.4.6]#make

[[email protected] httpd-2.4.6]#make install

Step 5:啟動Apache服務

[[email protected] httpd-2.4.6]#  /usr/local/apache/bin/apachectl start

Apache安裝問題錦集

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

[[email protected] kerry]# unzip pcre-8.33.zip

[[email protected] kerry]# cd pcre-8.33

[[email protected] pcre-8.33]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config

clip_image018

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

[[email protected] 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[email protected] 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

[[email protected] pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

[[email protected] pcre-8.33]# rpm -q gcc-c++

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

[[email protected] 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.

[[email protected] httpd-2.4.6]#

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

[[email protected] apr]# cd /usr/local/apr-util

[[email protected] apr-util]# ls

問題3:沒有指定PCRE引數

[[email protected] 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/

[[email protected] httpd-2.4.6]#

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

[[email protected] 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.

[[email protected] httpd-2.4.6]#

問題5:啟動服務時報錯

[[email protected] 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地址。如下所示

[[email protected] conf]# cd /usr/local/apache/conf/

[[email protected] conf]# ls

extra  httpd.conf  magic  mime.types  original

[[email protected] conf]# vi httpd.conf

ServerAdmin [email protected]

#

# 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

[[email protected] conf]# /usr/local/apache/bin/apachectl restart

httpd not running, trying to start

[[email protected] conf]# /usr/local/apache/bin/apachectl start

httpd (pid 7797) already running

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

[[email protected] conf]# chkconfig iptables off

[[email protected] conf]# chkconfig iptables off

[[email protected] conf]# /usr/local/apache/bin/apachectl restart

[[email protected] conf]# /usr/local/apache/bin/apachectl restart

[[email protected] conf]#

相關推薦

Linux系統安裝Apache 2.4.6

2013-08-15 23:19 by 瀟湘隱者, 28516 閱讀, 0 評論, 收藏, 編輯 Apache簡介         Apache HTTP Server(簡稱Apache)是Apache軟體基金會的一個開放原始碼的網頁伺服器,可以在大多數計算機作業

Centos 6.9 編譯安裝 apache 2.4+php7.2.3 + Fast-cgi

apache 2.4+php7.2. php7.2.3 + Fast-cgi 1. 編譯安裝apache 2.4 參考Centos 6.9 apahce 2.4.29編譯安裝 2. PHP官網下載Stable版本 http://php.net/downloads.php #curl -O http:/

linux 安裝apache 2.4.9+php 7.0.28

apache apache 2.4.9 php php 7.0.28 安裝apache 2.4支持php7 安裝準備工作yum install -y apr- gcc- libpcre- pcre- openssl-*由於系統包中的curl版本低不支持,所以需要手動下載安裝wget

Linux下編譯安裝Apache 2.4

Linux一般會自帶httpd服務,但是版本一般不是最新,效能也不是最好,生產中建議手動安裝官方原始碼包,安裝Apache官方包之前首先要停止之前的httpd服務,停止後也可以解除安裝之前的版本   準備工作做完,首先去官網下載Apache的原始碼包,http://httpd.apache.org/ 這裡下

redhat 6.6安裝apache 2.4.20

一. 下載安裝包一次性把檔案(包括關聯檔案——請原諒我不放連結,下次安裝的時候補上)下載好,其中包括: apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz pcre-8.37.tar.gz httpd-2.4.20.tar.gz 二. 安裝編譯

Oracle數據庫12cR2(項目實戰之二):Linux系統安裝Oracle12.2

oracle12cr2 oracle視頻教程 oracle12cr2安裝 linux上安裝12c linux上安裝12cr2 oracle數據庫12cR2(項目實戰之二):linux系統安裝Oracle12.2一、課程主題:風哥Oracle數據庫教程12cR2(項目實戰之二):在linux

源碼安裝 apache 2.4.27

源碼安裝 apache 2.4.27源碼安裝 apache 2.4.27登陸apache官網下載源碼安裝包http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz下載所需軟件源碼包§ ApacheApr: http://mirr

源碼安裝apache 2.4.29

apache 2.4.29安裝 apr apr-until prce 安裝apache的依賴程序。https://www.cnblogs.com/visec479/p/5160297.html [root@Office-test-007113 tools]# wget http://mirrors.shu.

Linux 系統安裝[Redhat]2

1.4 all tables centos6 端口 更新 none gen script 1.1. 配置網絡 echo "nameserver 8.8.8.8" >>/etc/resolv.conf ping www.baidu.com 1.2. Alias配

編譯安裝Apache 2.4

好幾年沒有編譯安裝Apahce,今天一試,發現還真不是一件容易事兒。幾經測試,發現我們在安裝前需要以下幾樣東西: 1)gcc 2)gcc-c++ 3)APR 4)APR-Utils 5)PCRE 6)YUM 操作步驟如下: 第1步: # yum -y groupi

原始碼編譯安裝Apache/2.4.37-------踩了無數坑,重灌了十幾次伺服器才會的,不容易啊!

1.先進入/usr/local/中建立三個資料夾 apr apr-util apache cd /usr/local目錄 mkdir apr  mkdir apr-util  mkdir apache 2.再進入 src中  cd src   

CentOS 7.4編譯安裝Apache 2.4.29

Apache2.4.29依賴包: apr-1.6.3.tar.gz    下載:wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.3.tar.gz apr-util-1.6.1.tar.gz  下載

Centos6.8下編譯安裝Apache 2.4.25詳細過程

一、下載原始碼安裝包 # cd /usr/local/src # wget 'http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.25.tar.gz' 二、解壓安裝 # tar zxf httpd-2.4.25.tar.gz

CentOS6.5安裝apache 2.4.37

1.1 安裝Apache2.4    1.1.1 安裝前準備       解除安裝系統預設安裝的Apache           

apache+apache_tomcat-Apache/2.4.6+mod_jk配置完整版對應的 mod_jk

第一步: 先是 安裝apache系列 yum -y install httpd.x86_64 //++++++++++++++++++++++++++ yum -y install httpd-devel.x86_64 //+++++++++++

linux系統安裝有關1: CentOS-6.3安裝配置Nginx

安裝說明 系統環境:CentOS-6.3 軟體:nginx-1.2.6.tar.gz 安裝方式:原始碼編譯安裝 安裝位置:/usr/local/nginx 下載地址:http://nginx.org/en/download.html 安裝前提 在安裝nginx前,需要

Apache 2.4.6 多域名多網站配置

用的是Centos7.2 64位的系統 Apache 2.4.6 安裝Apache # 檢視httpd包是否可用: yum list | grep httpd #安裝Apache yum install httpd 修改配置檔案

CentOS 7上編譯安裝 apache 2.4.25

安裝路徑 top ive fig config art 命令 con archive 在CentOS 7上編譯安裝 apache 2.4.25 源碼包,並啟動此服務. 配置環境 Systemctl disable firewalld Systemctl stop fire

linux安裝ORACLE_10.2.0提示缺少系統安裝包libXp.so.6,呼叫jdk報錯

今天在VWMARE上做了下Linux, oracle 的安裝實驗, 我係統環境配置: OS:Linux test 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux Datab

linux安裝apache(httpd-2.4.3版本)各種坑

博主的linux是ubuntu 14.04.3。 在安裝apache最新版httpd-2.4.3的時候遇到各種坑。 先提供安裝apache httpd-2.4.3所需要的包,博主已經整理好,下載地址:http://download.csdn.net/down