Linux基础命令介绍十一:软件包管理

可以执行./configure --help查看有哪些配置参数,此步骤的执行会检查系统是否符合编译要求。如果报错,很多情况下是因为少了一些编译工具,可以使用yum安装这些工具(当然也可以装源码)。

在本例中报错:./configure: error: the HTTP rewrite module requires the PCRE library.。

说明少了pcre库,查看一下系统:

[root@idc-v-71252 nginx-1.9.6]rpm -qa pcre pcre-8.32-15.el7.x86_64 [root@idc-v-71252 nginx-1.9.6]

系统有pcre安装,但没有devel包,使用yum安装

[root@idc-v-71252 nginx-1.9.6]# yum install pcre-devel -y 

再次执行configure发现报错变了:./configure: error: the HTTP gzip module requires the zlib library.

重复上述操作直到所需软件都安装完毕,之后再次执行./configure --prefix=/usr/local/nginx

4、编译

[root@idc-v-71252 nginx-1.9.6]# make -j8 

使用make进行编译,选项-j表示指定并发执行的数量,这里指定了和系统逻辑CPU数(可以使用命令grep -c "^processor" /proc/cpuinfo查看逻辑CPU数)相同的并发数。