目录
始【如果没有gcc/gcc-c++的需要安装(pcre需要c++环境)】
1. Apache HTTP Serverhttp://httpd.apache.org/download.cgi#apache24
2. APR 和 APR-Utilhttps://apr.apache.org/download.cgi
3. PCREhttps://sourceforge.net/projects/pcre/
二、在Linux环境下上传下载好的文件,并查看是否上传成功:
三、解压文件(记住解压的位置,方便打开,建议桌面),并查看是否解压成功
始【如果没有gcc/gcc-c++的需要安装(pcre需要c++环境)】
[root@localhost ~]# yum install -y gcc gcc-c++
一、准备——下载软件:
1. Apache HTTP Server
http://httpd.apache.org/download.cgi#apache24
2. APR 和 APR-Util
https://apr.apache.org/download.cgi
3. PCRE
https://sourceforge.net/projects/pcre/
二、在Linux环境下上传下载好的文件,并查看是否上传成功:
[root@localhost poem]# cd /home/poem/Desktop/
[root@localhost Desktop]# rz -be //上传文件指令
[root@localhost Desktop]# ls //查看是否上传成功
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.53.tar.gz pcre-8.45.tar.bz2
三、解压文件(记住解压的位置,方便打开,建议桌面),并查看是否解压成功
[root@localhost Desktop]# tar -zxf apr-1.7.0.tar.gz
[root@localhost Desktop]# tar -zxf apr-util-1.6.1.tar.gz
[root@localhost Desktop]# tar -zxf httpd-2.4.53.tar.gz
[root@localhost Desktop]# tar -jxf pcre-8.45.tar.bz2
[root@localhost Desktop]# ls
apr-1.7.0 apr-util-1.6.1 httpd-2.4.53 pcre-8.45
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.53.tar.gz pcre-8.45.tar.bz2
[root@localhost Desktop]#
四、安装APR:
[root@localhost Desktop]# cd apr-1.7.0/
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/loacl/apr
——出现问题:
—— 解决:
[root@localhost apr-1.7.0]# yum install libtool ——安装libtool
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/loacl/apr ——重新编译一遍
——继续编译:
[root@localhost apr-1.7.0]# make
[root@localhost apr-1.7.0]# make install
——————————————————————————————————————成功安装APR
五、安装 APR-Util:
[root@localhost Desktop]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config ——写清楚依赖关系
[root@localhost apr-util-1.6.1]# make ——出现问题——解决
——出现问题:
—— 解决:
[root@localhost apr-util-1.6.1]# yum install expat-devel
[root@localhost apr-util-1.6.1]# make install
——————————————————————————————————————————成功安装APR-Util
六、安装pcre:
[root@localhost Desktop]# cd pcre-8.45/
[root@localhost pcre-8.45]# ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost Desktop]#make
[root@localhost Desktop]#make install
七、安装Apache :
[root@localhost Desktop]# cd httpd-2.4.53/
[root@localhost httpd-2.4.53]# ./configure --prefix=/usr/local/httpd --enable-module=so --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config
[root@localhost Desktop]# make ——出现问题
——出现问题:
——解决问题:
删除-并查看是否删除成功:
[root@localhost local]# rm -rf httpd
[root@localhost local]# ls
apr apr-util bin etc games include lib lib64 libexec pcre sbin share src
[root@localhost local]#
——解决:
错误为apr apr-util 缺失,需要把apr目录及apr-util目录(解压后的包)拷贝到http下的srclib里面
在重新编译:
[root@localhost Desktop]# cp -r apr-1.7.0/ /home/poem/Desktop/httpd-2.4.53/srclib/apr
[root@localhost Desktop]# cp -r apr-util-1.6.1/ /home/poem/Desktop/httpd-2.4.53/srclib/apr-util
[root@localhost Desktop]# cd httpd-2.4.53/
[root@localhost httpd-2.4.53]# ./configure --prefix=/usr/local/httpd --enable-module=so --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-pcre=/usr/local/pcre/bin/pcre-config --with-included-apr
[root@localhost httpd-2.4.53]#make
[root@localhost httpd-2.4.53]#make install
——查看:
——————————————————————————————————————安装成功
八、启动服务:
[root@localhost httpd]# cd bin
[root@localhost bin]# ls
ab apu-1-config dbmmanage fcgistarter htdigest httxt2dbm
apachectl apxs envvars htcacheclean htpasswd logresolve
apr-1-config checkgid envvars-std htdbm httpd rotatelogs
[root@localhost bin]# ./apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost bin]#
九:验证:
[root@localhost poem]# cd /usr/local/
[root@localhost local]# ls
apr bin games include lib64 pcre share
apr-util etc httpd lib libexec sbin src
[root@localhost local]# cd httpd/
[root@localhost httpd]# ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
[root@localhost httpd]# cd bin/
[root@localhost bin]# ls
ab apu-1-config dbmmanage fcgistarter htdigest httxt2dbm
apachectl apxs envvars htcacheclean htpasswd logresolve
apr-1-config checkgid envvars-std htdbm httpd rotatelogs
[root@localhost bin]# cd ..
[root@localhost httpd]# cd htdocs/
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# vim index.html ——查看
用vim查看,页面代码如下:
修改文字并保存:
虚拟机浏览器,web页面查看,浏览器访问127.0.0.1:
——————————————————————————————————————————验证完毕!恭喜你!安装成功!