最近折腾了一个VPS,想把django部署上去,部署的过程很遇到过很多问题。下面就先把安装apache2.4.x的过程写出来,同时也为了帮助他人。
环境:CentOS release 6.6 (Final)
卸载老版本的 apache2.2.x ,安装 apache2.4.x
1.检查是否安装了apache
#rpm -qa | grep httpd
httpd-2.2.15-39.el6.centos.i686
httpd-tools-2.2.15-39.el6.centos.i686```
2.发现已经安装,但是版本太低(也可以使用),卸载已安装的旧版本
rpm -e --nodeps httpd-2.2.15-39.el6.centos.i686
rpm -e --nodeps httpd-tools-2.2.15-39.el6.centos.i686
yum remove apache #使用yum卸载
yum remove apr
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
3.安装新版本 apache 2.4.x
wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.23.tar.gz
tar -zxvf httpd-2.4.23.tar.gz
cd httpd-2.4.23
./configure
报错,缺少APR(Apache Portable Runtime )
configure: error: APR not found. Please read the documentation.
安装APR,需要装3个依赖 apr, apr-util, pcre
3.1 安装apr
wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure
报错,缺少了C语言的编译器,要先安装C语言的编译器
configure:5368: error: no acceptable C compiler found in $PATH
yum 安装 gcc
yum install gcc
再次config
./configure
make
make install
3.2安装apr-util
wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure
错误,apr已经安装,但是系统没有安装
configure: error: APR could not be located.
查找刚才的APR安装在哪里了
find / -name 'apr'
/usr/local/apr
带上参数config
./configure --with-apr=/usr/local/apr
make
make install
3.3 安装pcre (Perl库)
提前安装gcc
yum install -y gcc gcc-c++
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar zxvf pcre-6.5.tar.gz
cd pcre-6.5
./configure
make
make install
apr依赖都安装完成后,再次安装apache
cd httpd-2.4.23
./configure
make
make install
####apache启动
找到apache安装位置
find / -name apachectl
/usr/local/apache2/bin/apachectl
/usr/local/apache2/bin/apachectl start
访问127.0.0.1 ,出现 It works!
#####OK ,apache完成了安装
网友评论