功能描述:
在CentOS6.7操作系统上,编译安装apache服务,实现定制功能等
一、安装前提
1)安装编译httpd需要的软件包
[[email protected] ~]# yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype* pcre-devel
2)安装pcre,apr,apr-uril
[[email protected] ~]# wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
[[email protected] ~]# wget http://101.96.10.41/downloads.sourceforge.net/project/pcre/pcre2/10.22/pcre2-10.22.zip?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2F&ts=1472808609&use_mirror=nchc
[[email protected] ~]#wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
[[email protected] ~]#wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz
[[email protected] ~]#unzip pcre2-10.22.zip
[[email protected] pcre2-10.22]#cd pcre2-10.22
[[email protected] pcre2-10.22]#./configure --prefix=/usr/local/pcre
[[email protected] pcre2-10.22]#make && make install
[[email protected] ~]#tar xf apr-1.5.2.tar.gz
[[email protected] apr-1.5.2]#cd apr-1.5.2
[[email protected] apr-1.5.2]#./configure --prefix=/usr/local/apr
[[email protected] apr-1.5.2]#make && make install
[[email protected] ~]#tar xf apr-util-1.5.4.tar.gz
[[email protected] apr-util-1.5.4]#cd apr-util-1.5.4
[[email protected] apr-util-1.5.4]#./configure --prefix=/usr/local/apr-uril --with-apr=/usr/local/apr
[[email protected] apr-util-1.5.4]#make && make install
[[email protected] ~]#tar xf apr-iconv-1.2.1.tar.gz
[[email protected] apr-iconv-1.2.1]#cd apr-iconv-1.2.1
[[email protected] apr-iconv-1.2.1]#./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
[[email protected] apr-iconv-1.2.1]#make && make install
一、编译安装apache服务
1)软件下载
[[email protected] ~]#wget http://mirrors.sohu.com/apache/httpd-2.4.20.tar.gz
2) 创建apache用户
[[email protected] ~]#useradd -r -s /sbin/nologin apache
3) 编译httpd2.4
[[email protected] ~]#tar xf httpd-2.4.20.tar.gz
[[email protected] httpd-2.4.20]#
[[email protected] httpd-2.4.20]#make && make install
4)启动mysq服务
[[email protected] httpd-2.4.20]# /usr/local/apache/bin/apachectl start