【CentOS 7笔记29】,源码安装#

shallow丿ovehtml


配置相关的选项并生成Makefile

[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
	--2017-11-14 16:45:00--  http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
	Resolving mirrors.cnnic.cn (mirrors.cnnic.cn)... 101.6.6.178, 2402:f000:1:416:101:6:6:178
	Connecting to mirrors.cnnic.cn (mirrors.cnnic.cn)|101.6.6.178|:80... connected.
	HTTP request sent, awaiting response... 200 OK
	Length: 7684419 (7.3M) [application/octet-stream]
	Saving to: ‘httpd-2.2.34.tar.gz’

	100%[========================================================>] 7,684,419   72.5KB/s   in 99s    

	2017-11-14 16:46:39 (76.2 KB/s) - ‘httpd-2.2.34.tar.gz’ saved [7684419/7684419]
[root@localhost src]# ls
	httpd-2.2.34.tar.gz
[root@localhost src]# tar -zxvf httpd-2.2.34.tar.gz
	#拆包解压的文件
[root@localhost src]# ls
	httpd-2.2.34  httpd-2.2.34.tar.gz
[root@localhost src]# cd httpd-2.2.34/
[root@localhost httpd-2.2.34]# ls
	ABOUT_APACHE  config.layout  httpd.dep       libhttpd.dsp  modules.o         srclib
	acinclude.m4  config.log     httpd.dsp       libhttpd.mak  NOTICE            support
	Apache.dsw    config.nice    httpd.mak       LICENSE       NWGNUmakefile     test
	build         config.status  httpd.spec      Makefile      os                VERSIONING
	BuildAll.dsp  configure      include         Makefile.in   README
	BuildBin.dsp  configure.in   INSTALL         Makefile.win  README.platforms
	buildconf     docs           InstallBin.dsp  modules       README-win32.txt
	buildmark.o   emacs-style    LAYOUT          modules.c     ROADMAP
	CHANGES       httpd          libhttpd.dep    modules.lo    server

文档web

[root@localhost httpd-2.2.34]# more README
	                          Apache HTTP Server
	
	  What is it?
	  -----------
	
	  The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant
	  web server.  Originally designed as a replacement for the NCSA HTTP
	  Server, it has grown to be the most popular web server on the
	  Internet.  As a project of the Apache Software Foundation, the
	  developers aim to collaboratively develop and maintain a robust,
	  commercial-grade, standards-based server with freely available
	  source code.
	
	  The Latest Version
	  ------------------
	
	  Details of the latest version can be found on the Apache HTTP
	  server project page under <http://httpd.apache.org/>.
	--More--(11%)

安装说明apache

[root@localhost httpd-2.2.34]# more INSTALL
	
	  Quick Start - Unix
	  ------------------
	
	  For complete installation documentation, see [ht]docs/manual/install.html or
	  http://httpd.apache.org/docs/2.2/install.html
	
	     $ ./configure --prefix=PREFIX
	     $ make
	     $ make install
	     $ PREFIX/bin/apachectl start
	
	     NOTES: * Replace PREFIX with the filesystem path under which 
	              Apache should be installed.  A typical installation
	              might use "/usr/local/apache2" for PREFIX (without the
	              quotes).
	
	            * If you are a developer who will be linking your code with
	--More--(26%)
[root@localhost ~]# rpm -q gcc
	package gcc is not installed
	[root@localhost ~]# yum install -y gcc
	Loaded plugins: fastestmirror
	Loading mirror speeds from cached hostfile
	 * epel: mirror.nes.co.id
	Resolving Dependencies
	--> Running transaction check
	---> Package gcc.x86_64 0:4.8.5-16.el7 will be installed
	--> Processing Dependency: libgomp = 4.8.5-16.el7 for package: gcc-4.8.5-16.el7.x86_64
	
	……

	Verifying  : glibc-common-2.17-55.el7.x86_64                                              13/15 
	  Verifying  : libgomp-4.8.2-16.el7.x86_64                                                  14/15 
	  Verifying  : libgcc-4.8.2-16.el7.x86_64                                                   15/15 

	Installed:
	  gcc.x86_64 0:4.8.5-16.el7                                                                       

	Dependency Installed:
	  cpp.x86_64 0:4.8.5-16.el7                    glibc-devel.x86_64 0:2.17-196.el7                  
	  glibc-headers.x86_64 0:2.17-196.el7          kernel-headers.x86_64 0:3.10.0-693.5.2.el7         
	  libmpc.x86_64 0:1.0.1-3.el7                  mpfr.x86_64 0:3.1.1-4.el7                          

	Dependency Updated:
	  glibc.x86_64 0:2.17-196.el7    glibc-common.x86_64 0:2.17-196.el7  libgcc.x86_64 0:4.8.5-16.el7 
	  libgomp.x86_64 0:4.8.5-16.el7 

	Complete!
[root@localhost httpd-2.2.34]# ./configure --prefix=/usr/local/apache2	#需安装gcc
	#配置信息
[root@localhost httpd-2.2.34]# echo $?
	0	#这里返回值0,表示成功,不然失败

进行编译

[root@localhost httpd-2.2.34]# make
	#编译信息
[root@localhost httpd-2.2.34]# echo $?
	0	#验证成功

安装

[root@localhost httpd-2.2.34]# make install
	#安装信息
[root@localhost httpd-2.2.34]# echo $?
	0	#验证成功
[root@localhost httpd-2.2.34]# ls /usr/local/apache2/
	bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules

此时Apache源码已经安装成功了。其实在平常的源码安装过程当中,遇到错误不能成功安装的状况,一般都是由于缺乏某个库文件。这时候就须要咱们仔细查看报错信息或者查看当前目录下config.log日志获得相关信息。app

相关文章
相关标签/搜索