一.下载apache源代码

1.下载地址:http://httpd.apache.org/download.cgi  找稳定的最新的版本(Stable Release)

得到文件 httpd-2.4.3.tar.gz

2. 上传到你的服务器目录,如:/home/tnuser/installers

解压:tar -zxvf httpd-2.4.3.tar.gz   (我们下载的是源代码,所以这一步只是把源代码解压) 

移动解压后的目录到目标地址:mv /home/tnuser/installers/httpd-2.4.3  /home/tnuser/  (这一步只是把解压后的目录放在合适的位置方便管理,可以不做)

3. 接下来我们需要编译刚才解压的源文件,这是重点

配置编译时的一些参数: 

  1. cd  /home/tnuser/installers/httpd-2.4.3  (切换到apache源代码目录下)
  2. ./configure --prefix=/home/tnuser/apache/   (设置apache安装目录,这里的 /home/tnuser/apache/ 才是apache真正的安装目录)

二. 到这里时,回车运行命令,报错:

如果你能正常执行,说明你以前安装过apache环境,请直接make & make install 并请跳过下面一段

checking for APR... no
configure: error: APR not found.  Please read the documentation.

解决方案:

Apache在安装时需要一些准备环境,这里需要安装另外一个东西 APR(Apache Portable Runtime)。

下载地址: http://archive.apache.org/dist/apr/ 同样找最新版本

得到文件:apr-1.4.6.tar.gz

解压:tar -zxvf apr-1.4.6.tar.gz

编译:

  1. cd /home/tnuser/installers/apr-1.4.6
  2. ./configure --prefix=/home/tnuser/apr/  (一堆日志信息)
  3. make (一堆日志信息)
  4. make install (一堆日志信息)

完成后在指定地址生成目录和文件

接着装apache,切换到源代码目录设置编译参数: ./configure --prefix=/home/tnuser/apache/

还是报上面的错,这是因为上面自定义了apr的安装目录,所以得把这个信息告诉apache。

正确的运行命令为:

  1. ./configure --prefix=/home/tnuser/apache/  --with-apr=/home/tnuser/apr/

三. 执行后继续报错

不过这次错误信息变成了:(不要紧,这说明你的apr安装好了,只是又发现少了另外一个环境,慢慢来)

checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.

解决方案: 下载 APR-util

下载地址:http://archive.apache.org/dist/apr/ 找最新版本

得到文件:apr-util-1.5.1.tar.gz

解压: tar -zxvf apr-util-1.5.1.tar.gz

编译:

  1. cd /home/tnuser/installers/apr-util-1.5.1
  2. ./configure --prefix=/home/tnuser/apr-util/

这次运行会报错:

checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
看到提示你就懂了,不多说:

  1. ./configure --prefix=/home/tnuser/apr-util/ --with-apr=/home/tnuser/apr/
  2. make
  3. make install

在你指定的安装地址生成目录就说明安装成功了

四. 再转回去继续安装apache

有了上回的经验,这次就知道运行什么命令了。切到apache源代码目录下运行:

  1. ./configure --prefix=/home/tnuser/apache/  --with-apr=/home/tnuser/apr/  --with-apr-util=/home/tnuser/apr-util/

照旧报错:

checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方案:发现还是少环境,不多说,下载 PCRE

下载地址: http://jaist.dl.sourceforge.net/project/pcre/pcre/ 找最新版下

得到文件: pcre-8.32.tar.gz

解压:tar -zxvf pcre-8.32.tar.gz

编译:

  1. cd /home/tnuser/hunter/installers/pcre-8.32
  2. ./configure --prefix=/home/tnuser/pcre/

这次错误信息如下:

checking for windows.h... no
configure: error: You need a C++ compiler for C++ support.

原来pcre需要用C++编译(我只想说:Why I need C++ while I'm a Javaprogrammer? Eggache! Holy Shit!)

解决方案:

首先,区分你的系统是Debian还是Fedora。

我的系统是Fedora,所以配置步骤如下:(Debian系统使用命令apt-get,对应工具包为build-essential,命令使用方法:apt-get install build-essential)

sudo yum groupinstall "Development Tools"

这里会花费很长时间安装东西,中间会让你选择是否安装,输入 y 就行了。

下载过程完成后会自动安装,最终见到  Complete! 就结束了。

返回来还得继续安装PCRE啊,Go:

  1. ./configure --prefix=/home/tnuser/pcre/
  2. make
  3. make install

安装成功,以最终在目标位置生成相应目录为准。

至此,令人eggache的apache准备环境就算搞定了。

五. 继续apache的安装,一定要在参数中带上以上3种环境配置:

  1. ./configure --prefix=/home/tnuser/apache/  --with-apr=/home/tnuser/apr/  --with-apr-util=/home/tnuser/apr-util/  --with-pcre=/home/tnuser/pcre/

大块的log,终于没报错(唯有泪千行啊。。。泪千行。。。)

make

make install

六. 最后测试apache:

cd /home/tnuser/apache/bin

apachectl -k start

如果不能启动,查下端口冲突之类的问题(一般会与系统自带的httpd服务端口冲突)。

启动好后,访问你的apache,看到经典

It works!

关闭时用:apachectl -k stop

linux 安装Apache----tar.gz文件安装方式(零环境安装)的更多相关文章

  1. [Linux] 解压tar.gz文件,解压部分文件

    遇到数据库无法查找问题原因,只能找日志,查找日志的时候发现老的日志都被压缩了,只能尝试解压了   数据量比较大,只能在生产解压了,再进行查找 文件名为*.tar.gz,自己博客以前记录过解压方法: h ...

  2. 46. linux下解压.tar.gz文件

    tar -zxvf jdk-7u55-linux-i586.tar.gz 步骤二:解压jdk-7u55-linux-i586.tar.gz ,执行以下命令: #mkdir /usr/local/jav ...

  3. 在linux下解压缩 tar.gz文件

    解压:tar -xzvf 文件名 压缩 tar czf xx.tar.gz xxxx文件名

  4. Linux 下解压.tar.gz文件报错 gzip:stdin:not in gzip format 的解决办法!

    [root@hzp124 opt]# tar xzvf 1577255462-qypt.tar gzip: stdin: not in gzip formattar: Child returned s ...

  5. ubuntu 安装 tar.gz 文件

    ubuntu 安装 tar.gz 文件 本文链接:https://blog.csdn.net/caloriesung/article/details/81536144 tar zxvf FileNam ...

  6. windows下python的tar.gz文件安装

    windows下下载了django,PIL,web.py发现都是tar.gz格式的文件,网上查找也非常系统的方法,总结一下其他大神的方法,归纳于此. 首先下载tar.gz文件,比如web.py,下载后 ...

  7. centos下解压rar文件,Linux解压tar.gz和tar.bz2的命令

    1.下载:根据主机系统下载合适的版本,当前64为centos系统演示下载: wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz 2.解压安 ...

  8. Ubuntu 12.10 安装 jdk-7u10-linux-x64.tar.gz(转载)

    在Ubuntu 12.10下安装 jdk-7u10-linux-x64.tar.gz 总的原则:将jdk-7u10-linux-x64.tar.gz压缩包解压至/usr/lib/jdk,设置jdk环境 ...

  9. 【Linux命令】linux一次性解压多个.gz或者.tar.gz文件

    原文:linux一次性解压多个.gz或者.tar.gz文件 解压多个压缩包 对于解压多个.gz文件的,用此命令: for gz in *.gz; do gunzip $gz; done 对于解压多个. ...

  10. linux commands - 一次性解压多个tar.gz文件

    tar -zxvf list所有tar.gz文件,然后利用xargs将其作为参数传给tar命令.-n 1表示每次传一个参数. xargs: https://www.cnblogs.com/wangqi ...

随机推荐

  1. 【转】 IOS 项目配置--构建输出DIR

    原文网址:http://blog.csdn.net/fengsh998/article/details/8868871 通常在情一般都不建议使用绝对路径,因为写死之后,换环境,换平台,又要重新修改路径 ...

  2. XX.frame.origin.x 赋值问题

    can't use that myView.frame.origin.x=25.0; 因为.操作 和 = 一起用的话会调用 set方法.所以上式是行不通的. 可以用下面的方式来实现. that I h ...

  3. Cent OS5.2安装Hyper-V集成光盘

    一.Hyper-V安装windows系统没有问题,windows2000以后系统都可以,一切顺利. 驱动程序:IDE.SCSI.网络.视频和鼠标 要想实现更强的功能,宿主机需要安装Hyper-V集成光 ...

  4. 修复duilib CEditUI控件和CWebBrowserUI控件中按Tab键无法切换焦点的bug

    转载请说明原出处,谢谢~~:http://blog.csdn.net/zhuhongshu/article/details/41556615 在duilib中,按tab键会让焦点在Button一类的控 ...

  5. a different object with the same identifier value was already associated with **(ssh异常转)

      Hibernate:a different object with the same identifier value was already associated with ...异常解决 今天 ...

  6. CH340在STM32实现一键下载电路

    在做基于STM32的多功能MP3播放器的课题时,在程序下载这部分时借鉴了正点原子开发板上的一键下载电路,采用CH340G这款芯片设计. 在画PCB初期原理图部分,对采用CH340G设计的一键下载电路不 ...

  7. 查找指定目录下的文件 .xml

    pre{ line-height:1; color:#9f1d66; background-color:#cfe4e4; font-size:16px;}.sysFunc{color:#5d57ff; ...

  8. PHP相关图书推荐

    PHP和MySQL Web开发(原书第4版) 作      者 [澳] Luke Welling,[澳] Luke Welling 著:武欣 等 译 出 版 社 机械工业出版社 出版时间 2009-0 ...

  9. effective c++:资源管理

    对象管理资源 createInvestment 函数作用时创建一个invest对象: void f() { Investment *pInv = createInvestment(); // call ...

  10. geeksforgeeks@ Minimum Points To Reach Destination (Dynamic Programming)

    http://www.practice.geeksforgeeks.org/problem-page.php?pid=91 Minimum Points To Reach Destination Gi ...