本文主要参考了:https://www.cnblogs.com/wcwnina/p/8029156.html,在此表示感谢。
apache在linux下的安装比windows麻烦很多。根据自己的实践,把过程整理更简洁,备查。
1、下载apache及依赖包
apache下载地址:The Apache HTTP Server Project
APR 和 APR-Util,下载地址:http://apr.apache.org/download.cgi
PCRE包下载地址:https://sourceforge.net/projects/pcre/files/pcre/
2、安装gcc及gcc-c++
yum install gcc
yum install gcc-c++
3、安装包APR和APR-Util
分别上传后解压。
mkdir /usr/local/apr
mkdir /usr/local/apr-until
建两个目录用于存放 安装文件
进入目录,执行:
./configure --prefix=/usr/local/apr
make
make install
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
4、安装包PCRE
mkdir /usr/local/pcre
./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
5、安装Apache
./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make
make install
apche目录会自动创建
6、Aapache常用命令
启动:
/usr/local/apache/bin/apachectl start
关闭:
/usr/local/apache/bin/apachectl stop
重新启动:
/usr/local/apache/bin/apachectl restart
服务:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
成功运行!