15、源码编译软件包

1.下载nginx的源码包

[root@www ~]# wget http://nginx.org/download/nginx-1.16.0.tar.gz 

2.解压源码包

[root@www ~]# tar xf nginx-1.16.0.tar.gz 

3.对软件进行各种自定义操作

[root@www ~]# cd nginx-1.16.0/
root@www nginx-1.16.0]# ./configure --prefix=/soft/nginx-1.16.0 --with-http_ssl_module 

4.生成makfile后,根据makefile的文件进行编译 使用make命令

[root@www nginx-1.16.0]# make 

5.将编译好的二进制文件和配置文件,拷贝到./configure指定的目录

[root@www nginx-1.16.0]# make install 

6.将程序设定一个软连接,便于后续的升级

[root@www soft]# ln -s /soft/nginx-1.16.0/ /soft/nginx 

7.执行二进制文件,然后在浏览器中输入当前服务器的IP地址,测试是否有welcome to nginx

[root@www ~]# /soft/nginx/sbin/nginx 

现在: 百分之90,能用上的软件,都提供了rpm包. --->使用户可以使用yum直接安装使用.

报错:

[root@www nginx-1.16.0]# ./configure --prefix=/soft/nginx-1.16.0 --with-http_ssl_module checking for OS 
+ Linux 3.10.0-957.el7.x86_64 x86_64 
checking for C compiler ... not found

./configure: error: C compiler cc is not found 
[root@www yum.repos.d]# yum install gcc 

./configure: error: the HTTP rewrite module requires the PCRE library. 
You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre= option. 
[root@www nginx-1.16.0]# yum install pcre-devel pcre -y 

./configure: error: SSL modules require the OpenSSL library. 
You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl= option. 
[root@www nginx-1.16.0]# yum install openssl-devel -y




猜你喜欢

转载自www.cnblogs.com/Forever-x/p/f142823ef6582cfa1d05b9d99b483a34.html