apache在SUSE linux下的源碼安裝配置(httpd-2.2.22)

1. 下載httpdhttp://labs.renren.com/apache-mirror/httpd/,下載了httpd-2.4.2.tar.gz

2. 安裝apache

#tar zxvf httpd-2.4.2.tar.gz

#cd httpd-2.4.2

#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max

出現錯誤如下

checking for APR... no

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

Apr系統中沒有,於是用zypper在線下載安裝

 # zypper search APR

正在恢復系統源…

對以下項的元數據進行語法分析SUSE Linux Enterprise Server 10 SP4...

S | Catalog                             | Type    | Name               | Version                                                                                                                                                                     | Arch

--+-------------------------------------+---------+--------------------+--------                                                                                                                                                             --------+-----

  | SUSE Linux Enterprise Server 10 SP4 | package | libapr-util1       | 1.2.2-1                                                                                                                                                             3.13.18 | i586

  | SUSE Linux Enterprise Server 10 SP4 | package | libapr-util1-devel | 1.2.2-1                                                                                                                                                             3.13.18 | i586

  | SUSE Linux Enterprise Server 10 SP4 | package | libapr1            | 1.2.2-1                                                                                                                                                             3.8.1   | i586

  | SUSE Linux Enterprise Server 10 SP4 | package | libapr1-devel      | 1.2.2-1                                                                                                                                                             3.8.1   | i586

linux-ku0s:/home/archerwu/code/httpd-2.4.2 # zypper install libapr-util1 libapr-                                                                                                                                                             util1-devel libapr1 libapr1-devel

正在恢復系統源…

對以下項的元數據進行語法分析SUSE Linux Enterprise Server 10 SP4...

正在對 RPM 數據庫進行語法分析...

摘要:

<install>[S1:1][package]libapr-util1-1.2.2-13.13.18.i586

<install>[S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586

<install>[S1:1][package]libapr1-1.2.2-13.8.1.i586

<install>[S1:1][package]libapr1-devel-1.2.2-13.8.1.i586

是否繼續? [y/n]: y

Downloading: [S1:1][package]libapr1-1.2.2-13.8.1.i586, 99.0 K(238.3 K unpacked)

Installing: [S1:1][package]libapr1-1.2.2-13.8.1.i586

Downloading: [S1:1][package]libapr-util1-1.2.2-13.13.18.i586, 59.9 K(134.9 K unp                                                                                                                                                             acked)

Installing: [S1:1][package]libapr-util1-1.2.2-13.13.18.i586

Downloading: [S1:1][package]libapr1-devel-1.2.2-13.8.1.i586, 545.7 K(4.6 M unpac                                                                                                                                                             ked)

Installing: [S1:1][package]libapr1-devel-1.2.2-13.8.1.i586

Downloading: [S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586, 243.6 K(2.1                                                                                                                                                              M unpacked)

Installing: [S1:1][package]libapr-util1-devel-1.2.2-13.13.18.i586

接着運行

#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max

出現如下問題:

checking for pcre-config... false

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

仍然用zypper安裝

linux-ku0s:/home/archerwu/code/httpd-2.4.2 # zypper search pcre-config

正在恢復系統源…

對以下項的元數據進行語法分析SUSE Linux Enterprise Server 10 SP4...

No packages found.

沒辦法,只能在網上下載。

souceforge上下載了pcre-8.30.zip

直接./configure;make;make install安裝

然後再#./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=max

出現如下錯誤

checking for APR version 1.3.0 or later... no

configure: error: APR version 1.3.0 or later is required

由於系統是SLES10,對應的apr版本才1.2.2,而http版本比較新,所以改用較低版本再嘗試,換成httpd-2.2.22.tar.gz

之後./configure通過,但是make的時候出錯

In file included from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,

                 from exports.c:38:

/usr/include/apr-1/apr_ldap.h:67:18: error: lber.h: No such file or directory

/usr/include/apr-1/apr_ldap.h:68:18: error: ldap.h: No such file or directory

/usr/include/apr-1/apr_ldap.h:97:2: error: #error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.

In file included from /usr/include/apr-1/apr_ldap.h:120,

                 from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,

                 from exports.c:38:

/usr/include/apr-1/apr_ldap_init.h:112: error: expected declaration specifiers or '...' before 'LDAP'

In file included from /usr/include/apr-1/apr_ldap.h:121,

                 from /home/archerwu/code/httpd-2.2.22/include/util_ldap.h:31,

                 from exports.c:38:

/usr/include/apr-1/apr_ldap_option.h:204: error: expected declaration specifiers or '...' before 'LDAP'

/usr/include/apr-1/apr_ldap_option.h:226: error: expected declaration specifiers or '...' before 'LDAP'

In file included from exports.c:38:

/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:89: error: 'LDAP_DEREF_NEVER' undeclared here (not in a function)

/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:90: error: 'LDAP_DEREF_SEARCHING' undeclared here (not in a function)

/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:91: error: 'LDAP_DEREF_FINDING' undeclared here (not in a function)

/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:92: error: 'LDAP_DEREF_ALWAYS' undeclared here (not in a function)

/home/archerwu/code/httpd-2.2.22/include/util_ldap.h:97: error: expected specifier-qualifier-list before 'LDAP'

make[2]: *** [exports.lo] 錯誤 1

make[2]: Leaving directory `/home/archerwu/code/httpd-2.2.22/server'

make[1]: *** [all-recursive] 錯誤 1

make[1]: Leaving directory `/home/archerwu/code/httpd-2.2.22/server'

make: *** [all-recursive] 錯誤 1

估計大概是ldap沒安裝引起的問題,於是用zypper安裝ldap

#zypper install ldapcpplib ldapcpplib-devel openldap2 openldap2-devel

然後再#make

出現如下問題

modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange':

byterange_filter.c:(.text+0x1201): undefined reference to `apr_array_clear'

collect2: ld returned 1 exit status

make[1]: *** [httpd] 錯誤 1

make[1]: Leaving directory `/home/archerwu/code/httpd-2.2.22'

make: *** [all-recursive] 錯誤 1

網上搜這個錯誤http://ggb98.blog.163.com/blog/static/9206852201212404951746/ 說是編譯apache之前應該先安裝aprapr-util,然後編譯選項加上aprapr-util的安裝路徑 

於是重新./configure如下

#./configure --prefix=/usr/local/apache --with-included-apr --with-apr=/home/archerwu/code/httpd-2.2.22/srclib/apr --with-apr-util=/home/archerwu/code/httpd-2.2.22/srclib/apr-util --enable-modules=most --enable-mods-shared=max

然後

#make

編譯成功!!

然後#make install進行安裝

3. 配置apache

配置系統啓動時自動啓動apache服務

/etc/rc.local中加入如下一下

/usr/local/apache/apachectl -k start

但是在SUSE系統中,沒有rc.local,爲此參考網上方法在系統中自己建了一個rc.local

http://wenku.baidu.com/view/c0f66574a417866fb84a8ed9.html 

Apache的配置文件httpd.conf的配置可以參考

http://wenku.baidu.com/view/6781e29951e79b89680226f2.html

還有其他具體的配置方法不細講了,網上說明挺多的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章