【魄爺】 发表于 2018-11-23 10:29:01

Centos 编译Apache

  以CentOS-6.4安装的基础上进行编译安装Apache:
  检查gcc编译器:
gcc-v#检查gcc编译器
yum -y install gcc automake autoconf libtool make#安装GCC
yum install gcc gcc-c++#安装C++编译器  下载httpd,即apache软件源码:
#下载Apache
mkdir /usr/local/source
cd /usr/local/source
wget http://archive.apache.org/dist/httpd/httpd-2.2.10.tar.gz
#下载完后解压
tar xzfv httpd-2.2.10.tar.gz
#附上其他版本的Apache地址http://archive.apache.org/dist/httpd/  先进行简单编译,看看是否缺少某些运行库
#简单检查还需要安装那些运行库
cd /usr/local/source/httpd-2.2.10
#配置
./configure
  这是不加任何参数执行的正常情况:
  下面加上参数编译:
#加入一些常用的参数进行配置
./configure--prefix=/usr/local/apache2#设置安装目录
--sysconfdir=/etc/httpd   #设置配置文件的目录
--with-zlib=/usr/local/zlib#增加zlib的支持,可以使用gzip压缩
--with-include-apr   #使用绑定的apr副本
--enable-so   #动态加载模块
--enable-deflate=share #缩小传输编码支持
--enable-expire=share#期满值控制
--enable-rewrite=share#url重写支持
--enable-static-support#使用静态编译
--with-mpm=worker   #使用mpm 的worker模式,更多模式与编译参数参考apache文档
  提示缺少zlib的支持:
  usr
#下载zlib运行库
cd /usr/local/source
wget http://down1.chinaunix.net/distfiles/zlib-1.2.7.tar.gz
#编译安装
cd /usr/local/source/zlib-1.2.7
./configure
make
make install  使用history 找到配置Apache的命令
history
  使用刚才的命令,
!95 #将会执行apache配置的命令  进行编译:
make
  以上为正常编译:
  安装apache:
make install
  以上正常安装
  启动apache:
  /
cd /usr/local/apache2/bin
./apachectl start #启动apache
#关闭防火墙
service iptables stop
#暂时关闭selinux
setrnforce 0
#在浏览器中输入地址访问,
127.0.0.1
  添加到自动启动;
#开机时自动启动
echo '/usr/local/apache2/bin/apachectl start' >> /etc/rc.d/rc.local  




页: [1]
查看完整版本: Centos 编译Apache