【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

相關文章
相關標籤/搜索