狼狼 发表于 2018-11-22 08:30:18

在Linux上自行编译安装apache

一、获取软件:
   http://httpd.apache.org/
二、安装步骤:
1、解压源文件:
tar -zxf httpd-2.2.9.tar.gz
2、configure:
    cd httpd-2.2.9
    ./configure --prefix=/usr/local/apache   --sysconfdir=/etc/httpd/   -enable-so   --enable-rewrite
3、make
4、make install,到此安装完成,
5、启动:进入/usr/local/apache/bin执行   
    A、启动apache: ./apachectl start      
    B、 停止apache: ./apachectl stop
  


  

6、说明:
    运行./configure 命令进行编译源代码,
    A、--prefix=/usr/local/apache 是设置编译安装到的系统目录,
   B、--sysconfdir 为配置文件的目录
   C、--enable-so参数是使httpd服务能够动态加载模块功能,
   D、--enable-rewrite是使httpd服务具有网页地址重写功能。


7、“头文件”导出:
    #ln -sv /usr/local/apach/include/usr/apach/httpd


8、“库文件”输出:
#vi/etc/ld.so.conf.d/httpd.conf,添加内容如下:
    /usr/local/apache/lib

注意:让系统重读生产库文件缓存的方法:重启系统或者执行命令#ldconfig -v


9、“帮助文件”导出:
    在 #vi/etc/man.config中,添加一行 MANPATH /usr/local/apache/man即可。


三、编译安装的步骤:
  1、获取源代码,并解压。
  #tar xf package-version.tar.{gz|bz2|xz}
  注意:展开后的目录名挺长为package-version
  

  2、切换到源码目录中
  #cd package-verion
  

  3、执行configure脚本
  #./configure
  

  4、编译
  #make
  

  5、安装
  #make install
  

  四、configure脚本的通用功能。
  1、指定安装路径。
  --prefix=/usr/local/package_name
  --sysconfdir=/etc/package_name
  

  2、指定启动、禁用的特性
  --enable-feature:如--enbale-ftm
  --disable-feature:如:--disable-socket
  

  3、指定所依赖的功能、程序或文件。
  --with-funtion:启用某功能。
  --without-function:禁用某功能。
  

  4、不同的程序,其configure脚本功能略有不同,要获取帮助。
  ./configure --help


  




页: [1]
查看完整版本: 在Linux上自行编译安装apache