纸水仙 发表于 2018-11-25 12:50:17

Centos5.5整合Apache和Tomcat 之一安装Apache

  Apache系统环境如下:
  Centos 5.5
  httpd-2.4.3.tar.gz
  apr-util-1.4.1.tar.gz
  apr-1.4.6.tar.gz
  gcc编译器
  一、编译安装apache服务器
  wget :http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.3.tar.gz
  创建软件包得下载目录
  mkdir -p /tmp/tools
  cd /tmp/tools
  wget :http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.3.tar.gz
  # ls
  httpd-2.4.3.tar.gz
  tar zxvf httpd-2.4.3.tar.gz -C /usr/local/(解压并使用-C参数指定安装路径)
  # cd /usr/local/httpd-2.4.3/
  # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte
  编译的是时候报错了
  checking for APR... no
  configure: error: APR not found.Please read the documentation找到不到apr。
  下载apr wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.4.6.tar.gz
  下载apr-util wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.4.1.tar.gz
  查看tools目录下软件包 已下载完成
  # ll
  -rw-r--r-- 1 root root982243 2012-02-14 apr-1.4.6.tar.gz
  -rw-r--r-- 1 root root774770 2011-12-14 apr-util-1.4.1.tar.gz
  -rw-r--r-- 1 root root 6137268 08-20 21:22 httpd-2.4.3.tar.gz
  解压apr和apr-util
  # tar zxvf apr-util-1.4.1.tar.gz -C /usr/local/
  # tar zxvfapr-1.4.6.tar.gz-C /usr/local/
  # ll
  drwxr-sr-x 25 5000 10001 4096 2012-02-08 apr-1.4.6
  drwxr-xr-x 19501 games 4096 2011-12-08 apr-util-1.4.1
  编译安装apr
  # cd apr-1.4.6/
  # ./configure --prefix=/usr/local/apr
  # make && make install
  安装apr-util
  # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  # make && make install
  下面在次编译安装apache
  # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte
  还是报错。。找不到apr-util (刚刚已经安装了)
  checking for APR-util... no
  configure: error: APR-util not found.Please read the documentation.
  笔者试着指定apr-util得路径。。然后在试。。
  # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte--with-apr-util=/usr/local/apr-util
  再一次报错。。郁闷。。缺少pcre的库
  checking for pcre-config... false
  configure: error: pcre-config for libpcre not found. PCRE is required and availa
  安装pcre库
  # yum install pcre-devel
  在次编译apache,正常了
  # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte--with-apr-util=/usr/local/apr-util
  #make && make install
  安装完毕,查看目录文件
  # cd /usr/local/apache2/
  # ls
  bin    cgi-binerror   icons    logsmanual
  buildconf   htdocsincludeman   modules
  #
  启动apache服务
  # /usr/local/apache2/bin/apachectl start
  查看80端口
  #
  # lsof -i:80
  COMMAND   PID   USER   FD   TYPE DEVICE SIZE NODE NAME
  httpd   18724   root    3uIPv695945       TCP *:http (LISTEN)
  httpd   18725 daemon    3uIPv695945       TCP *:http (LISTEN)
  httpd   18727 daemon    3uIPv695945       TCP *:http (LISTEN)
  httpd   18729 daemon    3uIPv695945       TCP *:http (LISTEN)
  到处apache安装完成。。(本来想用网页访问以下呢。。但是截图以后不能粘贴。。只能这样了。)



页: [1]
查看完整版本: Centos5.5整合Apache和Tomcat 之一安装Apache