Linux下安装Apache 2.4
2014-06-19 09:51
274 查看
本文为Rainisic原创,欢迎转载,转载请在文章明显可见处张贴原帖信息:
/article/5707584.html
下载Apache 2.4及依赖包
Apache官网下载:http://httpd.apache.org/download.cgi由于Apache依赖于APR、APR-Util和PCRE,所以需要下载:
APR + APR-Util:http://apr.apache.org/download.cgi
PCRE:http://sourceforge.net/projects/pcre/files/pcre/
在此,笔者使用均为目前最新版本,Apache 1.4.6,APR 1.4.1,APR-Util 2.4.1,Perl 5.14.2,PCRE 8.30
安装依赖
APR及APR-Util安装
解压缩APR及APR-Utilshell> sudo tar zxvf apr-1.4.6.tar.gz -C /opt/sources shell> sudo tar zxvf apr-util-1.4.1.tar.gz -C /opt/sources
创建安装目录并创建软链接
shell> sudo mkdir /opt/software/develop/apr-1.4.6 shell> sudo mkdir /opt/software/develop/apr-util-1.4.1 shell> sudo ln -s /opt/software/develop/apr-1.4.6 /usr/local/apr shell> sudo ln -s /opt/software/develop/apr-util-1.4.1 /usr/local/apr-util
安装APR及APR-Util
shell> cd /opt/sources/apr-1.4.6 shell> sudo ./configure --prefix=/usr/local/apr shell> sudo make shell> sudo make install shell> cd /opt/sources/apr-util-1.4.1 shell> sudo ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr shell> sudo make shell> sudo make install
安装PCRE
首先请确定系统安装了Perl,Perl在此不再赘述,如有需要请去官网查看安装细则:http://www.cpan.org/src/README.html解压缩PCRE
shell> sudo tar zxvf pcre-8.30.tar.gz -C /opt/sources
创建PCRE安装目录及软链接
shell> sudo mkdir /opt/software/develop/pcre-8.30 shell> sudo ln -s /opt/software/develop/pcre-8.30 /usr/local/pcre
安装PCRE
shell> cd /opt/sources/pcre-8.30 shell> sudo ./configure --prefix=/usr/local/pcre shell> sudo make shell> sudo make install
安装Apache 2.4
解压缩Apache 2.4shell> sudo tar zxvf httpd-2.4.2.tar.gz -C /opt/sources
创建Apache安装目录及软链接
shell> sudo mkdir /opt/software/develop/httpd-2.4.2 shell> sudo ln -s /opt/software/develop/httpd-2.4.2 /usr/local/apache2
安装Apache
shell> cd /opt/sources/httpd-2.4.2 # 此处请根据自己要搭建的环境进行配置,我这里是为了配置PHP环境 shell> sudo ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite=shared --with-mpm=prefork --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre shell> sudo make shell> sudo make install
启动Apache
通过apachectl启动Apachshell> sudo /usr/local/apache2/bin/apachectl start
检查是否有Apache进程
shell> ps aux | grep httpd
如果有Apache的进程,则证明启动成功,浏览器地址栏输入 http://localhost 试试吧~
启动成功之后,可以将apachectl拷贝到/etc/init.d下,作为service启动。
shell> sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd shell> sudo service httpd start
扩展阅读
Apache官方安装文档:http://httpd.apache.org/docs/2.4/install.html相关文章推荐
- linux安装配置Apache2.4
- Linux系统下安装 apache2.4的过程
- linux下安装apache2.4
- 我的linux之路[第六篇] 在CentOS7.3中安装配置Apache2.4+Subversion1.9.5版本库
- linux使用-apache2.4通过apt-get方式安装
- Linux系统下安装 apache2.4的过程
- apache2.4脚本一键安装(linux环境)
- Linux下编译安装Apache 2.4
- linux下安装apache2.4
- Linux下编译安装Apache httpd 2.4
- Linux下安装Apache 2.4
- ubuntu14.0(linux) 安装 apache2.4+ 报 apr not found
- linux安装apache2.4
- Amazon Linux 编译安装 Apache 2.4 + PHP 5.5
- Linux下安装Apache 2.4
- Linux运维实战之Apache2.4编译安装及其新特性 推荐
- Linux下安装Apache 2.4
- linux 源码安装apache2.4并添加服务
- Linux 下安装apache2.4
- Linux下 源码 PHP7+Apache2.4整合,安装禅道9.5项目管理软件