Saturday, 2 June 2012

Configuring httpd on RHEL 6 / Centos 6



[root@client129 httpd-2.4.1]# ./configure --enable-ssl --enable-so
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

Configuring Apache Portable Runtime library ...

checking for APR... no
configure: error: APR not found.  Please read the documentation.



{   When it tells you Please read documentation it means that you should go read Apache documentation ( http://httpd.apache.org/docs/2.4/install.html ) which tells you to
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 domain names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/)

then do

./configure --with-included-apr   }


now download and install apr and apr-utils

*******************************************************************
apr:

./configure --prefix=/usr/local/apr

Could not compile libxml2: /bin/rm: cannot remove `libtoolT’: No such file or directory

solution:

When I compile libxml2-2.7.8 under Ubuntu 11.04, it always complain that:
/bin/rm: cannot remove `libtoolT’: No such file or directory.
I did a search on google, but none of them works.
From the console output, I found that it failed because removing a file which does not exists.
So I edit the configure file, find the line which contains $RM “$cfgfile”, and replace it with $RM -f “$cfgfile”, then everything works.
(‘rm -f’ means do not stop even if the file doesn’t exists)

make
make test
make install
cd test/
./testall

***************************************************************************
apr-utils:

./configure --with-apr=/usr/local/apr/
make
make install

***************************************************************************

[root@client129 httpd-2.4.1]# ./configure --enable-ssl --enable-so  --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/src/apr-util-1.4.1/
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

Configuring Apache Portable Runtime library ...

checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
.........
....
...
..


[root@client129 httpd-2.4.1]# make

exports.c:1191: note: previous definition of 'ap_hack_apr_xml_quote_elem' was here
exports.c:1607: error: redefinition of 'ap_hack_apr_xml_insert_uri'
exports.c:1192: note: previous definition of 'ap_hack_apr_xml_insert_uri' was here
exports.c:1616: error: redefinition of 'ap_hack_apu_version'
exports.c:1201: note: previous definition of 'ap_hack_apu_version' was here
exports.c:1617: error: redefinition of 'ap_hack_apu_version_string'
exports.c:1202: note: previous definition of 'ap_hack_apu_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/apache.1/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/apache.1/server'
make: *** [all-recursive] Error 1

solution:
*********

[root@pc server]# rm /usr/local/httpd/server/export_files
rm: détruire fichier régulier `export_files'? y
[root@pc server]# make export_files
tmp=export_files_unsorted.txt; \
rm -f $tmp && touch $tmp; \
for dir in /usr/local/httpd-2.0.53/include /usr/local/httpd-2.0.53/os/unix
/usr/local/httpd-2.0.53/modules/http; do \
    ls $dir/*.h >> $tmp; \
done; \
for dir in /usr/local/httpd-2.0.53/srclib/apr/include
/usr/local/httpd-2.0.53/srclib/apr-util/include; do \
    ls $dir/ap[ru].h >> $tmp; \
    ls $dir/ap[ru]_*.h >> $tmp; \
done; \
sort -u $tmp > export_files; \
rm -f $tmp
[root@pc server]# ll export_files
-rw-r--r--    1 root     root         7945 avr  4 19:28 export_files
[root@pc server]# more export_files
/usr/local/httpd-2.0.53/include/ap_compat.h
/usr/local/httpd-2.0.53/include/ap_config_auto.h
/usr/local/httpd-2.0.53/include/ap_config.h
/usr/local/httpd-2.0.53/include/ap_config_layout.h
/usr/local/httpd-2.0.53/include/ap_listen.h
/usr/local/httpd-2.0.53/include/ap_mmn.h
/usr/local/httpd-2.0.53/include/ap_mpm.h
/usr/local/httpd-2.0.53/include/ap_provider.h
/usr/local/httpd-2.0.53/include/apr_allocator.h



[root@client129 httpd-2.4.1]# make


[root@client129 httpd-2.4.1]# make install



***************************************************************************

[root@client129 httpd-2.4.1]# ./configure --prefix=/usr/local/apache --enable-ssl --enable-so --with-included-apr

[root@client129 httpd-2.4.1]# make clean

# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-ssl.conf


vi /usr/local/apache2/conf/extra/httpd-ssl.conf

# egrep 'server.crt|server.key' httpd-ssl.conf
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"


cd ~
openssl genrsa -des3 -out server.key 1024


openssl req -new -key server.key -out server.csr


cd ~
cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/


/usr/local/apache2/bin/apachectl start


/usr/local/apache2/bin/httpd -k start


**************************************************************************************

how to add apache modules


./configre --prefix=/usr/local/ --with-axps=/usr/local/apache/bin/apxs

Configuration summary for mod_mono

   * Installation prefix = /usr
   * Apache version = 2.0
   * Apache modules directory = /usr/local/apache/modules
   * apxs = /usr/local/apache/bin/apxs
   * apr-config = /usr/local/apache/bin/apr-1-config
   * apu-config = /usr/local/apache/bin/apu-1-config
   * CFLAGS = -g -O2 -I/usr/local/apache/include  -g -O2 -pthread  -I/usr/local/apache/include  -g -O2 -pthread  -I/usr/local/apache/include
   * Verbose logging (debug) = no
   * GCOV options used = no
   * Profiling enabled = no
   * mono prefix = /usr
   * Default MonoApplicationsConfigDir = /usr/local/apache/conf/mod-mono-applications


No comments:

Post a Comment