操作系统CentOS 7
linux下,默认Apache安装软件,其路径是随着开发软件人员的习惯而定,在开发过程中会经常不知道到所需的程序路径,因此手动安装程序对后续的使用会提供非常大的便利
一:准备
1.安装 apr
下载地址:http://apr.apache.org/download.cgi
[[email protected]:/usr/local/src]# tar zxvf apr-1.5.2.tar.gz
[[email protected]:/usr/local/src/apr-1.5.2]# ./configure --prefix=/usr/lcoal/apr
[[email protected]:/usr/local/src/apr-1.5.2]# make
[[email protected]:/usr/local/src/apr-1.5.2]# make install
2.安装 apr-util
下载地址:http://apr.apache.org/download.cgi
[[email protected]:/usr/local/src]# tar zxvf apr-util-1.5.4.tar.gz
[[email protected]:/usr/local/src/apr-util-1.5.4]# ./configure --prefix=/usr/lcoal/apr-util --with-apr=/usr/lcoal/apr
[[email protected]:/usr/local/src/apr-util-1.5.4]# make
[[email protected]:/usr/local/src/apr-util-1.5.4]# make install
3.安装 pcre
下载地址:http://pcre.org/
[[email protected]:/usr/local/src]# tar jxvf pcre-8.37.tar.gz
[[email protected]:/usr/local/src/pcre-8.37]# ./configure --prefix=/usr/lcoal/pcre
[[email protected]:/usr/local/src/pcre-8.37]# make
[[email protected]:/usr/local/src/pcre-8.37]# make install
注意:如果在安装 pcre 时,遇到问题:configure: error: You need a C++ compiler for C++ support.
解决方法:yum install -y gcc gcc-c++
二:安装Apache
下载地址:http://httpd.apache.org/
[[email protected]:/usr/local/src]# tar zxvf httpd-2.4.16.tar.gz
[[email protected]:/usr/local/src/httpd-2.4.16]# ./configure --prefix=/usr/lcoal/apache --with-apr=/usr/lcoal/apr --with-apr-util=/usr/lcoal/apr-util --with-pcre=/usr/lcoal/pcre
[[email protected]:/usr/local/src/httpd-2.4.16]# make
[[email protected]:/usr/local/src/httpd-2.4.16]# make install
三:配置
1.启动
[[email protected]:/usr/local/apache]# ./bin/apachectl start
2.开机启动
打开文件:/etc/rc.local
[[email protected]:/]# vim /etc/rc.local
添加:/work/installed/apache/bin/apachectl start
OK啦 http://localhost OR http://ip