How to install mod_ta.c on Fedora Core Linux.

Starting Point

To install  mod_ta.c module on Apache2 we need Apache's apxs to compile it.

1.  skip this section,  if   the apxs tool already installed in your system.

[ludab@lanlproto ~]$ sudo yum install httpd-devel
        [sudo] password for ludab: 
        Loaded plugins: fastestmirror, presto, refresh-packagekit
        Loading mirror speeds from cached hostfile
        | 1.7 kB     00:00     
         * fedora:
         * rpmfusion-free:
         * rpmfusion-free-updates:
         * rpmfusion-nonfree:
         * rpmfusion-nonfree-updates:
         * updates:
        | 3.3 kB     00:00     
        | 3.3 kB     00:00     
        Setting up Install Process
        Resolving Dependencies
        --> Running transaction check
        ---> Package httpd-devel.x86_64 0:2.2.17-1.fc13.1 set to be installed
        --> Processing Dependency: apr-util-devel for package:
        --> Processing Dependency: apr-devel for package:
        --> Running transaction check
        ---> Package apr-devel.x86_64 0:1.4.5-1.fc13 set to be installed
        --> Processing Dependency: apr = 1.4.5-1.fc13 for package:
        ---> Package apr-util-devel.x86_64 0:1.3.12-1.fc13 set to be
        --> Processing Dependency: apr-util = 1.3.12-1.fc13 for package:
        --> Running transaction check
        ---> Package apr.x86_64 0:1.4.5-1.fc13 set to be updated
        --> Processing Dependency: apr-util = 1.3.10-1.fc13 for package:
        ---> Package apr-util.x86_64 0:1.3.12-1.fc13 set to be updated
        --> Running transaction check
        ---> Package apr-util-ldap.x86_64 0:1.3.12-1.fc13 set to be updated
        --> Finished Dependency Resolution
        Dependencies Resolved
 Package                                        Arch                                   Version                                           Repository                               Size =======================================================================================================================================================================================
Installing:  httpd-devel                                    x86_64                                 2.2.17-1.fc13.1                                   updates                                 143 k Installing for dependencies:  apr-devel                                      x86_64                                 1.4.5-1.fc13                                      updates                                 179 k  apr-util-devel                                 x86_64                                 1.3.12-1.fc13                                     updates                                  70 k Updating for dependencies:  apr                                            x86_64                                 1.4.5-1.fc13                                      updates                                  97 k  apr-util                                       x86_64                                 1.3.12-1.fc13                                     updates                                  80 k  apr-util-ldap                                  x86_64                                 1.3.12-1.fc13                                     updates                                  16 k Transaction Summary =======================================================================================================================================================================================
Install       3 Package(s) Upgrade       3 Package(s) Total download size: 585 k Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata Processing delta metadata Download delta size: 97 k (1/3): apr-1.3.9-3.fc13_1.4.5-1.fc13.x86_64.drpm                                                                                                                |  55 kB     00:01     (2/3): apr-util-1.3.10-1.fc13_1.3.12-1.fc13.x86_64.drpm                                                                                                         |  28 kB     00:00     (3/3): apr-util-ldap-1.3.10-1.fc13_1.3.12-1.fc13.x86_64.drpm                                                                                                    |  14 kB     00:05     Finishing rebuild of rpms, from deltarpms <delta rebuild>                                                                                                                                                 | 193 kB     00:01     Presto reduced the update size by 50% (from 193 k to 97 k). Package(s) data still to download: 392 k (1/3): apr-devel-1.4.5-1.fc13.x86_64.rpm                                                                                                                        | 179 kB     00:02     (2/3): apr-util-devel-1.3.12-1.fc13.x86_64.rpm                                                                                                                  |  70 kB     00:00     (3/3): httpd-devel-2.2.17-1.fc13.1.x86_64.rpm                                                                                                                   | 143 kB     00:02     ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                   52 kB/s | 392 kB     00:07     Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction   Updating       : apr-1.4.5-1.fc13.x86_64                                                                                                                                         1/9   Updating       : apr-util-1.3.12-1.fc13.x86_64                                                                                                                                   2/9   Installing     : apr-devel-1.4.5-1.fc13.x86_64                                                                                                                                   3/9   Updating       : apr-util-ldap-1.3.12-1.fc13.x86_64                                                                                                                              4/9   Installing     : apr-util-devel-1.3.12-1.fc13.x86_64                                                                                                                             5/9   Installing     : httpd-devel-2.2.17-1.fc13.1.x86_64                                                                                                                              6/9   Cleanup        : apr-util-ldap-1.3.10-1.fc13.x86_64                                                                                                                              7/9   Cleanup        : apr-util-1.3.10-1.fc13.x86_64                                                                                                                                   8/9   Cleanup        : apr-1.3.9-3.fc13.x86_64                                                                                                                                         9/9 Installed:   httpd-devel.x86_64 0:2.2.17-1.fc13.1                                                                                                                                                

Dependency Installed:   apr-devel.x86_64 0:1.4.5-1.fc13                                                         apr-util-devel.x86_64 0:1.3.12-1.fc13                                                       
Dependency Updated:   apr.x86_64 0:1.4.5-1.fc13                              apr-util.x86_64 0:1.3.12-1.fc13                              apr-util-ldap.x86_64 0:1.3.12-1.fc13                            
Complete! [ludab@lanlproto ~]$ 

2. check where  the  apxs installed  by  "locate apxs ",  ours is in  standard  location such as  /usr/sbin/apxs

[ludab@lanlproto projects]$ ls -la /usr/sbin/apxs
-rwxr-xr-x. 1 root root 22085 Oct 27  2010 /usr/sbin/apxs

Installing mod_ta.c

1 . For the purposes at hand, we proceed to install mod_ta.c  module:

sudo /usr/sbin/apxs -c -i –acs mod_ta.c
        [sudo] password for ludab: 
        /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic
        -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
        -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
        -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd 
        -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_ta.lo mod_ta.c
        && touch mod_ta.slo
        mod_ta.c: In function ‘myta_register_hooks’:
        mod_ta.c:519: warning: implicit declaration of function
        mod_ta.c: At top level:
        mod_ta.c:61: warning: ‘threaded_mpm’ defined but not used
        /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o 
        -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_ta.lo –a
        /usr/lib64/apr-1/build/libtool --mode=install cp
        libtool: install: cp .libs/ /usr/lib64/httpd/modules/
        libtool: install: cp .libs/mod_ta.lai /usr/lib64/httpd/modules/
        libtool: install: cp .libs/mod_ta.a /usr/lib64/httpd/modules/mod_ta.a
        libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_ta.a
        libtool: install: ranlib /usr/lib64/httpd/modules/mod_ta.a
        libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n
        Libraries have been installed in:
        If you ever happen to want to link against installed libraries
        in a given directory, LIBDIR, you must either use libtool, and
        specify the full pathname of the library, or use the `-LLIBDIR'
        flag during linking and do at least one of the following:
           - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
             during execution
           - add LIBDIR to the `LD_RUN_PATH' environment variable
             during linking
           - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
           - have your system administrator add LIBDIR to `/etc/'
        See any operating system documentation about shared libraries for
        more information, such as the ld(1) and manual pages.
        chmod 755 /usr/lib64/httpd/modules/

2.  checking that  mod_ta is included in  httpd.conf

[ludab@lanlproto conf]$ cd /etc/httpd/conf 

3.  adding LoadModule directive to the httpd.conf,  if apxs installation (step 1) did not update the httpd.conf.

        # Dynamic Shared Object (DSO)
        # To be able to use the functionality of a module which was built
        as a DSO
        # have to place corresponding `LoadModule' lines at this location
        # directives contained in it are actually available _before_ they
        # Statically compiled modules (those listed by `httpd -l') do not
        # to be loaded
        # LoadModule foo_module

        LoadModule disk_cache_module modules/
        LoadModule cgi_module modules/
        LoadModule ta_module modules/
4. Reboot the apache server :

[ludab@lanlproto conf]$ sudo  service httpd stop
        [sudo] password for ludab: 
        Stopping httpd:                                            [  OK  ]
        [ludab@lanlproto conf]$ sudo  service httpd start
        Starting httpd:                                            [  OK  ]

Configuring mod_ta

1.   Directory where appache2 installed on you server can  differ than example, but I will use ours.

cd  /etc/httpd

we  keep our virtual host config files in config.d directory

 [ludab@lanlproto httpd]$ ls
        conf  conf.d  logs  modules  run

2.   I  added  to the  lanlsource.conf  ( our  virtual host config file) configuration  snippet for the mod_ta module.     

        <VirtualHost *:80>
         ErrorLog logs/lanlsource_error_log
         LogLevel debug
             # .....
            <IfModule ta_module>
EnableArchiving On
    ArchivePort 80
    ArchivePath /1/put/
    EnableIP On 
    Excluded /search /test </IfModule>
I also added  LogLevel debug  directive to the config. It is temporary to check that mod_ta is working fine.

3. Reboot the server

[ludab@lanlproto conf]$ sudo  service httpd stop
        [sudo] password for ludab: 
        Stopping httpd:                                            [  OK  ]
        [ludab@lanlproto conf]$ sudo  service httpd start
        Starting httpd:                                            [  OK  ]

4. To test,  access some page in you server:


5. Check your apache log that mod_ta is logging messages.

   the verbose debugging message  at log ( in out case  lanlsource_error_log at /etc/httpd/logs) will have similar output below:

 [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(224): [client] mod_ta: in headers  request
        [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(225): [client]
        mod_ta: in headers  request  GET /hello
        HTTP/1.1\r\nUser-Agent:Mozilla/5.0 (X11; U; Linux;en-US)\r\n
Accept-Encoding:gzip\r\nConnection:Keep-Alive\r\\r\nX-Client-IP:\r\n [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(228): [client] mod_ta: in headers  request  /hello [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(301): [client] mod_ta: fisrst chunk:PUT /1/put/ HTTP/1.1\r\nHost:\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n10c\r\nGET /hello HTTP/1.1\r\nUser-Agent:Mozilla/5.0 (X11; U; Linux;en-US)\r\n
Accept-Encoding:gzip\r\nConnection:Keep-Alive\r\\r\nX-Client-IP:\r\n\r\n\r\n\r\n [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(337): [client] mod_ta:  mod_ta_out3 (data-HEAP): 438 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(391): [client] mod_ta: length from nbytes:438 [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(337): [client] mod_ta:  mod_ta_out3 (data-IMMORTAL): 10 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(391): [client] mod_ta: length from nbytes:10 [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(337): [client] mod_ta:  mod_ta_out3 (data-HEAP): 1674 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(391): [client] mod_ta: length from nbytes:1674 [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(337): [client] mod_ta:  mod_ta_out3 (data-POOL): 8 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(391): [client] mod_ta: length from nbytes:8 [Sun Feb 12 06:00:01 2012] [debug] mod_ta.c(337): [client] mod_ta:  mod_ta_out3 (metadata-EOS): 0 bytes

After checking your log and conforming that  module is sending HTTP PUT requests, you can comment out that #LogLevel debug to avoid stress on server