Apache 2.4.1 is the latest stable version available on Apache.org download section. Since it is the latest version so it may have plenty of dependencies issues. In my case, i am installing it from source(httpd-2.4.1.tar.bz2).

Currently i am logged in using SSH on Plain CentOS 6.2 server and it has very basic packages installed.

Downloading and compiling Apache 2.4.1

cd /usr/local/src/
wget http://apache.mirrors.pair.com//httpd/httpd-2.4.1.tar.bz2
tar -jxf httpd-2.4.1.tar.bz2
cd httpd-2.4.1
./configure --prefix=/usr/local/apache --enable-so --enable-deflate --enable-expires --enable-headers --enable-rewrite

Note : Here i required deflate,expires,headers and other modules so i included that.

Ops, failed to dependencies.. because we don’t have gcc compiler and other devel packages for apr, apr-utils, openssl and so on.
yum install apr-devel apr-util-devel gcc pcre-devel.x86_64 zlib-devel openssl-devel

Great. Here we go;
make
again ERROR :

rotatelogs.c:298: warning: implicit declaration of function ‘apr_file_link’
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -pthread
-o rotatelogs  rotatelogs.lo      /usr/lib64/libaprutil-1.la -ldb-4.7 -lexpat
-ldb-4.7 /usr/lib64/libapr-1.la -lpthread
rotatelogs.o: In function `post_rotate':
rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link'
collect2: ld returned 1 exit status
make[2]: *** [rotatelogs] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.4.1/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.1/support'
make: *** [all-recursive] Error 1

Current apr and apr-util version is older while Apache 2.4.1 requires latest APR and APR-utils e.g 1.4.x is the latest available version.
Lets include the latest apr and apr-util into apache srlib/ so it can also be compiled along with Apache.
cd /usr/local/src/httpd-2.4.1/srclib/

Installing APR & APR-Utils dependencies :

wget http://mirror-cybernet.lums.edu.pk/pub/apache//apr/apr-util-1.4.1.tar.bz2
wget http://mirror-cybernet.lums.edu.pk/pub/apache//apr/apr-1.4.6.tar.bz2

Note : If this mirror doesn’t work, chose other mirrors

tar -jxf apr-1.4.6.tar.bz2
tar -jxf apr-util-1.4.1.tar.bz2
mv apr-1.4.6 apr
mv apr-util-1.4.1 apr-util

Lets configure it now :
./configure --prefix=/usr/local/apache --enable-so --enable-deflate --enable-expires --enable-headers --enable-rewrite --with-included-apr --with-included-apr-util
make
make install

Following this tutorial i was able to install Apache 2.4.1 successfully on CentOS 6.2. If you are unable to install or having difficulty you can leave a comment and i will try to respond you quickly as much possible.

 

출처 : http://www.hackersgarage.com/installing-apache-2-4-1-from-source-on-centos-6-2-linux.html

'apache' 카테고리의 다른 글

APM(apache 2.4.1) 설치시 문제 해결  (0) 2012.07.10
[Ubuntu] Apache2.4.x 설치  (0) 2012.07.10
mod_deflate 설치 / 사용  (0) 2012.02.16
아파치 mod_deflate로 압축 전송하기  (0) 2012.02.16
[Apache] MPM(Prefork VS Worker)  (0) 2011.04.19

설치 환경
OS : CentOS release 6.2 (Final)
Mysql : 5.1.60
Apache : 2.4.1
Php : 5.3.10

[Mysql]
# groupadd mysql
# useradd -g mysql mysql
./configure --prefix=/data/mysql --localstatedir=/data/mysql/data --with-charset=euckr --with-extra-charsets=all
make && make install

/data/mysql/bin/mysql_install_db --datadir=/data/mysql/var --force
chown -R mysql:mysql /data/mysql

*오류*
mysql checking for termcap functions library... configure: error: No curses/termcap library found
*해결 방법*
yum install libtermcap-devel

*오류*
my_global.h:1110: error: redeclaration of C++ built-in
*해결 방법*
1.yum install gcc-c++설치
2.make clean
3. 재 컴파일

[Apache]
./configure --prefix=/data/apache --enable-so --enable-rewrite --enable-proxy --enable-ssl --enable-unique-id

make && make install

Apache 컴파일 시 오류 처리 사항

*오류*
checking for OpenSSL version >= 0.9.7... FAILED
configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
*해결 방법*
yum install openssl-devel
yum update openssl

*오류*
rotatelogs.o: In function `post_rotate':
rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link'
collect2: ld returned 1 exit status
make[2]: *** [rotatelogs] Error 1
make[2]: Leaving directory `/root/src/httpd-2.4.1/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/src/httpd-2.4.1/support'
make: *** [all-recursive] Error 1
*해결 방법*
Apache 2.4.에서는 apr 1.4이상이 필요하다 따라서 rpm apr 패키지 버전이 1.4이하라면 소스컴파일을 해야 한다.
1. yum remove "apr*"
2.APR 소스 설치
wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-1.4.6.tar.gz
tar xzf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure ; make ; make install
wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-util-1.4.1.tar.gz
tar zxvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
yum install -y pcre-devel lua-devel libxml2-devel

[php]
./configure --prefix=/data/php --with-mysql=/data/mysql --with-apxs2=/data/apache/bin/apxs --enable-sysvshm=yes --enable-sysvsem --enable-debug=no --with-ttf --with-png-dir=/usr --with-zlib-dir --with-jpeg-
dir=/usr --with-gdbm=/usr --enable-ftp --enable-mbstring --enable-sockets --enable-wddx --with-freetype-dir=/usr --enable-bcmath --with-curl --with-mcrypt --enable-mbregex --enable-exif --with-gd --enable-gd-
native-ttf --enable-calendar --with-openssl --with-mysqli=/data/mysql/bin/mysql_config

make && make install

출처 : http://absorbed.tistory.com/

+ Recent posts