源代码安装软件
0》下载软件安装包 wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.29.tar.gz
解压压缩包 tar zxvf httpd-2.4.29.tar.gz
1》生成配置文件
cd httpd-2.4.29
./configure --prefix=/usr/local/apache2
2》编译
make
3》安装
make install
4》启动服务 /usr/local/apache2/apachectl start
设置开机自启动 vi /etc/rc.d/rc.local 在最后一行加入 /usr/local/apache2/bin/apachectl start
关闭防火墙 service iptables stop
5》查看80端口 netstat -tunpl |grep httpd
查看apache进程是否运行,ps -ef |grep httpd
6》卸载源代码安装的软件,rm -rf /usr/local/apache2
#./configure --prefix……检查编辑环境时出现:
checking for APR... no
configure: error: APR not found . Please read the documentation
1》下载apr、apr-util、pcre源代码包
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.10.tar.gz
2》卸载yum安装的apr、apr-util、pcre
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
3》安装apr,解决apr not found问题
[root@xt test]# tar -zxf apr-1.4.5.tar.gz
[root@xt test]# cd apr-1.4.5
[root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@xt apr-1.4.5]# make && make install
4》安装apr-util,解决apr-util not found问题
[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
[root@xt test]# cd apr-util-1.3.12
[root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@xt apr-util-1.3.12]# make && make install
5》解决pcre问题
[root@xt test]#tar -zxvf pcre-8.10.tar.gz
[root@xt test]#cd pcre-8.10
[root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre
[root@xt pcre-8.10]#make && make install
6》再次安装apache
[root@xt test]#cd httpd-2.4.29
[root@xt test]#./configure --prefix=/usr/local/apache2 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--with-pcre=/usr/local/pcre
7》源代码安装apache,网站根目录位置 /usr/local/apache2/htdocs,apache配置文件 /usr/local/apache2/conf/httpd.conf,apache应用程序 /usr/local/apache2/bin/apachectl