Build Apache 2.2.X on AIX 5.3 Platforms

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.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值