- 曝光:Linux企业运维实战
- 吴光科
- 431字
- 2025-02-23 04:16:00
6.4 源码包软件安装
通常使用RPM工具管理以.rpm结尾的二进制包,而标准的以.zip、.tar结尾的源代码包则不能使用RPM工具去安装、卸载及升级。源码包安装有以下三个步骤:
□./configure:预编译,主要用于检测系统基准环境库是否满足gcc环境,生成makefile文件。
□make:编译,基于第一步生成的makefile文件,进行源代码的编译。
□make install:安装,编译完毕之后将相关的可运行文件安装至系统中。
使用make编译时Linux操作系统必须有GCC编译器,用于编译源码。
源码包安装通常需要./configure、make、make install三个步骤,某些特殊源码可以只有三步中的其中一个或者两个步骤。
以CentOS 7 Linux系统为基准,在其上安装Nginx源码包,企业中源码安装软件的详细步骤如下:
(1)Nginx.org官网下载Nginx-1.13.0.tar.gz包:

(2)Nginx源码包解压:

(3)进入源码包解压后的目录,执行./configure指令进行预编译,分号“;”表示连接多个命令:

(4)make编译:

(5)make install安装:

通过以上5个步骤,源码包软件安装成功。源码包在编译及安装时,可能会遇到各种错误,需要把错误解决之后,再进行下一步安装即可。后面章节会重点针对企业使用的软件进行案例演练。