设为首页 收藏本站
查看: 505|回复: 0

[经验分享] Build Apache 2.2.X on AIX 5.3 Platforms

[复制链接]

尚未签到

发表于 2017-1-9 07:19:12 | 显示全部楼层 |阅读模式
  Build Apache 2.2.X on AIX 5.3 Platforms Part I: Basics
http://olex.openlogic.com/wazi/2008/how-to-build-apache-22x-on-aix-53-platforms/

Part II: Common Issues
http://olex.openlogic.com/wazi/2008/how-to-build-apache-22x-on-aix-53-platforms-part-ii-some-common-errors-and-pitfalls/


Build Apache 2.2.X on AIX 5.3 Platforms Part I: Basics
While there are many binary versions of Apache available for the AIX platform, many people wish to build it themselves so they can add modules or custom locations to the Apache Web server. Should you need that flexibility, this tutorial will guide you.

This is not an AIX administration guide, and any administration tasks suggested by this guide will need to be performed as a “root” user. If you’re unsure of whether or not you are a “root” user, then you should stop now, and find someone who knows for sure.

This tutorial will also assume that we’re building Apache with GCC (GNU Compiler Collection). The steps outlined here may work with other compilers, but have only been tested with GCC.
  
Before You Start

In order to properly prepare the system and the Apache build configuration, we need to make a checklist of where you want Apache and what use you wish to make of it.
Where will you install Apache? In order to compile Apache you’ll need ~250MB of free disk space in the following areas:
Build Directory – this is where you’ll build the code. It can be anywhere on the file system. Although many people choose to do this in their home directory, we recommend that you create a specific directory.  Something like /build in the root directory, or in a place where you have free space.
Prefix Directory – this is where you want Apache to be installed when you’re done. By default, Apache installs in the /usr partition.
Tmp Directory - It’s always a good idea to have some free space in /tmp during builds.
You’ll need the following tools :
Apache Source Code: Download Apache version 2.2.8.
GCC 4.0: GNU C compiler version 4 for AIX 5.3. You’ll find it here.
libgcc 4.0: the library for GCC for AIX 5.3. Go here to get it.
You’ll also need to install libm.a from the AIX 5.3 installation disk 1.  We recommend using “smitty installp” to accomplish this install.
Uncompress the Apache source code into a temporary location. We usually create a /hold/Apache-2.2.8 directory, but any directory where you have space is fine.
Change directory to /hold/Apache-2.2.8 ( cd /hold/Apache-2.2.8 )
Run the configure command with the prefix option.   ( ./configure --prefix=/usr/local/apache ). This command evaluates your system for its readiness to build Apache. You’ll notice that some things will be found, and others will not be found. As long as the configure completes without errors, you may continue the build process.

Note: Installing the RPMs (Red Hat Package Managers) for GCC should be done as the root user.
  
Meat & Potatoes
Building Apache

First you’ll want to uncompress the Apache source code into a temporary location. We usually create a /hold/Apache-2.2.8 directory, but any directory where you have space is fine.

This tutorial will assume that directory is /hold/Apache-2.2.8 and will assume that the answer to question 1 in the Prerequisites section above is /usr/local/apache.
Make the Apache project. ( make ) The make command reads the Makefile that was created in the configuration step. This will run for approximately 15 minutes. You may see some warnings, but again, as with the configuration step, if it completes without errors, it is fine.
Deploy the Apache Project.  ( make install )  Once more, this should be accomplished as the ‘root’ user.
Test the project. Change directory to /usr/local/apache/bin.  Run the Apache start-up script. (./apachectl start ) You may be warned that Apache can’t determine the server’s name, but no worries – that’s to be expected, as we have not configured Apache. The server will still start up.
In a web browser go to URL http://localhost.
Finishing Up

You should see the page load, and it will report “It Works!”

Build Apache 2.2.X on AIX 5.3 Platforms Part I: Basics
Purpose

Building the Apache Web server on AIX is generally a straightforward enterprise in which you: obtain the code, run a few simple commands (configure, make, and make install) and then stop by your boss’s cube to ask if she’s got anything she’d like you to take off her plate.

You don’t know us very well yet, so we’ll be frank: we say “straightforward” with tongue firmly planted in cheek. A quick Google search on the topic will return a plethora of issues users encounter while building the code if they try anything beyond straight vanilla. In other words, if you need an install with any additional modules or capabilities, expect some issues.

We’ve already covered the vanilla installation, in the first installment of the Building Apache on AIX. This second part of the tutorial takes you beyond those basics. Before attempting any of these work-arounds, we recommend that you have met all the requirements for a “basic” build.
Before You Start

Follow the setup from the first installment of this guide, Building Apache 2.2.X on AIX 5.3 platforms.
Meat & Potatoes
Common Problems


Neglecting to  clean between failed builds (or builds with numerous, particular errors)
During compilation phase of the build, if any errors are encountered, the subsequent build
must be preceded by a make clean. As Joe Biden would say “Let me repeat that”, make clean.
It is important that your build runs from start to finish without errors and that there is
not any artifacts from previous build attempts giving you false positive or false negative results.

Environment Issues
The most frequent issues with a build are ones that are encountered because the build environment
is not set up correctly. Incorrect gcc version, gcc library version, and not adding the
math library (libm.a) are the most common. Setup of these environment elements are covered in
the first installment of this guide.
Configuration Options

The latest versions of Apache Web server have over 160 configuration options and flags, making for millions potential combinations. These options control exactly how the Web server is going to build and, more importantly, how it is going to run. On AIX, there are several options that we have found are either required, or particularly beneficial to complete the build.

--prefix=PATH
Setting this option is required. PATH is the exact path where the Web server will be installed and run from post compilation.

--with-included-apr
apr and apr-util are bundled with the Apache Web server source releases, and will be used without any problems in almost all circumstances. However, if apr or apr-util versions 1.0 or 1.1, are installed on your system (as is the case if you are using AIX 5.3), you must either upgrade your apr/apr-util installations to 1.2 and force the use of the bundled libraries, or have httpd use separate builds.

To use the bundled apr/apr-util sources, specify the --with-included-apr option added in version 2.2.3 of Apache Web server.

--enable-ssl=shared
If you choose to add ssl capabilities to your Web server, you must enable this option. This also means that you must have OpenSSL installed on your system. On AIX systems a typical install will litter OpenSSL elements across your file system, and this will cause issues as you compile. For instance, we have found complete or portions of OpenSSL installed in the following directories : /usr , /usr/bin, /opt/freeware/bin, /usr/include, /usr/linux. Most often, the correct OpenSSL to use is the libraries found in /usr.  To specify using this one, you must set the following options:

--with-ssl=/usr This tells the configuration step to bind to libraries found in and under /usr.

--enable-mods-shared=ssl This tells the system to create the ssl module as a shared object.

Other important configuration options include:

--enable-so: This configures apache for later installation of shared objects (modules).  Apache httpd can be built either with static, built-in modules, or be built so that modules can be stored outside of the httpd binary file, and may be compiled and added at a later time. Having the ability to add modules after the main build is accomplished using the Apache Extention Tool (apxs).  This dynamic build is enabled by the –enable-so option. The modules that are built as extentions to the main binary are called Dynamic Shared Objects (DSO).

Finally, here are a few optional modules you may include during your configuration:

Proxy Modules
--enable-proxy
--enable-proxy-ajp
--enable-proxy-balancer

Configuring Proxy
Forward Proxy

ProxyRequests On
ProxyVia On

<Proxy *>
Order deny,allow
Deny from all
Allow from internal.example.com
</Proxy>
Reverse Proxy

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /path http://domainname.com/thing
ProxyPassReverse /path http://domainname.com/thing

Proxy Access

<Proxy *>
Order Deny,Allow
Deny from all
Allow from 192.168.0
</Proxy>

Helper Modules
--enable-module=rewrite
  
--enable-module=log_referer
  
Common Error Messages

Openssl compilation error.
Sample error: /usr/include/openssl/pq_compat.h:1:3: error: invalid preprocessing directive #IBM_PROLOG_BEGIN_TAG

On AIX, it is not uncommon to encounter errors during compilation if ssl is enabled. This is because
IBM’s OpenSSL package contains a number of include files in /usr/include/openssl where a special “IBM Prolog” include line has been added, making the header files incompatible with gcc.
The fix is to edit pq_compat.h, and comment out any lines with IBM_PROLOG_BEGIN_TAG, as well as any associated lines with the Prolog include tag.

Linker errors
Sample error: 0711-317 ERROR: Undefined symbol: .BIO_clear_flags

On AIX, once you have satisfied the gcc requirements to build Apache two linkers will exist
on your system. Linker errors, like the one seen above, are a result of the pathing to libraries being
different for the compiler and the linker, and can be resolved by setting environment flags.

Now, on all UNIX systems there is a library path that is to be used during link phase, and runtime,
and on all UNIX systems this path is set via the LD_LIBRARY_PATH variable. All Unix systems, that is, except AIX. For this reason, we usually set the path using both the standard and the AIX variable as a safety precaution. The native AIX linker should use LIBPATH, while LD_LIBRARY_PATH will be used by the Gnu linker.

Example library path setup looks like this:
set LIBPATH=/usr/lib:/lib
set LD_LIBRARY_PATH=/usr/lib:/lib
export LIBPATH LD_LIBRARY_PATH

  Finishing Up

Augmenting the basic build with additional modules will add complexity to the build process, but by following this tutorial and properly setting up your environment, most errors can be avoided. Of course, each system can have other libraries and packages installed that can cause additional error messages, or warnings. While we have built Apache on AIX many times, on many different systems, this guide does not claim to, and can’t possibly, anticipate every situation. Should you encounter other errors, please email them to us, and we’ll include them in a future revision.

We wish you good luck, and happy compiling.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-325682-1-1.html 上篇帖子: Tomcat + apache 做web 负载平衡和群集 下篇帖子: 合理设置apache httpd的最大连接数
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表