日期:2014-05-16  浏览次数:20865 次

apache 的下载编译及安装

apache 的下载编译及安装

将APACHE统一安装目录,到这个目录下:
/usr/alibaba/install
然后在这个目录/usr/alibaba 下建立软链接:
cd /usr/alibaba
ln -s install/httpd-2.0.61/ httpd

1. wget http://archive.apache.org/dist/httpd/httpd-2.0.61.tar.gz
2. tar -zxvf httpd-2.0.61.tar.gz
3. 进入httpd-2.0.61,执行安装

  • $ ./configure --prefix=/usr/alibaba/install/httpd-2.0.61 --enable-rewrite=static --with-mpm=worker --enable-so --enable-proxy --enable-proxy-http --enable-deflate
  • $ make
  • $ make install

apache的模块

对应自己的开发机大多都是ubuntu系统,并且是32位机,可以找一台32位开发机上已经安装好的,把其中的
/usr/alibaba/install/httpd-2.0.61/modules
这个目录下的内容全部拷贝过来

也可以按照http://b2b-doc.alibaba-inc.com/pages/viewpage.action?pageId=27133140
中提到的
第2步骤:mod_jk
第3步骤:编译image module
去做

cronolog

检查自己机器上的cronolog有没有安装

(这个跟apache日志格式有关 %w 就是利用这个模块搞出来的见 httpd.conf.vm
CustomLog "|/usr/local/sbin/cronolog ${exodus2_output}/logs/cookie_logs/%w/cookie_log" cookie_log
)

如果没有安装则

1, wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
2, tar zxvf cronolog-1.6.2.tar.gz
3, cd cronolog-1.6.2
4, ./configure
5, make
6, sudo make install
7, which cronolog (查看是否安装成功)
8, 和线上环境保持路径统一:sudo ln -s /usr/local/sbin/cronolog /usr/alibaba/cronolog/sbin/cronolog

检查权限

cd /usr/alibaba/install/httpd-2.0.61/bin
注意第二行 apachectl,倒数第四行httpd 的权限如果是 如下图,那么apache是启动不起来的,除非你用root启动。
于是修改权限

-rwxr-xr-x 1 root root   74837 2009-08-05 11:23 ab
-rwxr-xr-x 1 root root    3318 2009-08-05 11:17 apachectl
-rwxr-xr-x 1 root root    6829 2009-08-05 11:23 apr-config
-rwxr-xr-x 1 root root    5828 2009-08-05 11:23 apu-config
-rwxr-xr-x 1 root root   22951 2009-08-05 11:17 apxs
-rwxr-xr-x 1 root root   12555 2009-08-05 11:23 checkgid
-rwxr-xr-x 1 root root    8876 2009-08-05 11:17 dbmmanage
-rw-r--r-- 1 root root     993 2009-08-05 11:17 envvars
-rw-r--r-- 1 root root     993 2009-08-05 11:17 envvars-std
-rwxr-xr-x 1 root root   28325 2009-08-05 11:23 htdbm
-rwxr-xr-x 1 root root   20986 2009-08-05 11:23 htdigest
-rwxr-xr-x 1 root root   28142 2009-08-05 11:23 htpasswd
-rwxr-xr-x 1 root root 1938830 2009-08-05 11:23 httpd
-rwxr-xr-x 1 root root   19360 2009-08-05 11:23 httxt2dbm
-rwxr-xr-x 1 root root   21021 2009-08-05 11:23 logresolve
-rwxr-xr-x 1 root root   20970 2009-08-05 11:23 rotatelogs

sudo chmod a+s apachectl

sudo chmod a+s httpd

赋予超级权限以后可以看到目录权限如下:

-rwxr-xr-x 1 root root   74837 2009-08-05 11:23 ab
-rwsr-sr-x 1 root root    3318 2009-08-05 11:17 apachectl
-rwxr-xr-x 1 root root    6829 2009-08-05 11:23 apr-config
-rwxr-xr-x 1 root root    5828 2009-08-05 11:23 apu-config
-rwxr-xr-x 1 root root   22951 2009-08-05 11:17 apxs
-rwxr-xr-x 1 root root   12555 2009-08-05 11:23 checkgid
-rwxr-xr-x 1 root root    8876 2009-08-05 11:17 dbmmanage
-rw-r--r-- 1 root root     993 2009-08-05 11:17 envvars
-rw-r--r-- 1 root root     993 2009-08-05 11:17 envvars-std
-rwxr-xr-x 1 root root   28325 2009-08-05 11:23 htdbm
-rwxr-xr-x 1 root root   20986 2009-08-05 11:23 htdigest
-rwxr-xr-x 1 root root   28142 2009-08-05 11:23 htpasswd
-rwsr-sr-x 1 root root 1938830 2009-08-05 11:23 httpd
-rwxr-xr-x 1 root root   19360 2009-08-05 11:23 httxt2dbm
-rwxr-xr