源码安装及定制rpm包
Posted 0_o
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了源码安装及定制rpm包相关的知识,希望对你有一定的参考价值。
源码安装及定制rpm包
[TOC]
linux中软件的安装方式
安装包 | 安装方式 |
rpm包 | rpm,yum |
源码包 | 源码安装 |
二进制包 | 解压既用 |
获取源码包
安装什么服务,就去什么服务的官方网站,下载源码包
linux安装源码包
# 1.进入linux官网,下载源码包
http://nginx.org/
# 2.下载
[root@zxw <sub>]# wget http://nginx.org/download/nginx-1.20.2.tar.gz
[root@zxw </sub>]# ll
total 1040
-rw-r--r--. 1 root root 1062124 Nov 16 22:51 nginx-1.20.2.tar.gz
# 3.解压
[root@zxw <sub>]# tar xf nginx-1.20.2.tar.gz
[root@zxw </sub>]# ll
total 1040
drwxr-xr-x. 8 1001 1001 158 Nov 16 22:44 nginx-1.20.2
-rw-r--r--. 1 root root 1062124 Nov 16 22:51 nginx-1.20.2.tar.gz
# 4.进入解压好的目录里
[root@zxw <sub>]# cd nginx-1.20.2
[root@zxw nginx-1.20.2]# ll
total 796
drwxr-xr-x. 6 1001 1001 4096 Apr 27 19:27 auto
-rw-r--r--. 1 1001 1001 312251 Nov 16 22:44 CHANGES
-rw-r--r--. 1 1001 1001 476577 Nov 16 22:44 CHANGES.ru
drwxr-xr-x. 2 1001 1001 168 Apr 27 19:27 conf
-rwxr-xr-x. 1 1001 1001 2590 Nov 16 22:44 configure
drwxr-xr-x. 4 1001 1001 72 Apr 27 19:27 contrib
drwxr-xr-x. 2 1001 1001 40 Apr 27 19:27 html
-rw-r--r--. 1 1001 1001 1397 Nov 16 22:44 LICENSE
drwxr-xr-x. 2 1001 1001 21 Apr 27 19:27 man
drwxr-xr-x. 2 root root 77 Apr 27 19:51 objs
-rw-r--r--. 1 1001 1001 49 Nov 16 22:44 README
drwxr-xr-x. 9 1001 1001 91 Apr 27 19:27 src
# 5.生成
./configure --prefix=/opt/nginx-1.20.2 --with-http_ssl_module --with-http_stub_status_module
[root@zxw nginx-1.20.2]# ./configure --prefix=/opt/nginx-1.20.2 --with-http_ssl_module --with-http_stub_status_module
checking for OS
+ Linux 3.10.0-1160.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
#报错
./configure: error: C compiler cc is not found
#报错原因:缺少C语言环境
#解决方法:yum install -y gcc gcc-c++ glibc
# 6.再执行
[root@zxw nginx-1.20.2]# ./configure --prefix=/opt/nginx-1.20.2 --with-http_ssl_module --with-http_stub_status_module
#报错
./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=<path> option.
#报错原因:缺少openssl库文件
#解决方法:yum install -y pcre-devel
# 7.再执行
[root@zxw nginx-1.20.2]# ./configure --prefix=/opt/nginx-1.20.2 --with-http_ssl_module --with-http_stub_status_module
#报错
./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=<path> option.
#报错原因:缺少openssl库文件
#解决方法:yum install -y openssl-devel
# 看到结尾是这玩意就算整好了
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
nginx path prefix: "/opt/nginx-1.20.2"
nginx binary file: "/opt/nginx-1.20.2/sbin/nginx"
nginx modules path: "/opt/nginx-1.20.2/modules"
nginx configuration prefix: "/opt/nginx-1.20.2/conf"
nginx configuration file: "/opt/nginx-1.20.2/conf/nginx.conf"
nginx pid file: "/opt/nginx-1.20.2/logs/nginx.pid"
nginx error log file: "/opt/nginx-1.20.2/logs/error.log"
nginx http access log file: "/opt/nginx-1.20.2/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
# 8.好了以后会生成Makefile文件
[root@zxw nginx-1.20.2]# ll
total 796
drwxr-xr-x. 6 1001 1001 4096 Apr 27 20:42 auto
-rw-r--r--. 1 1001 1001 312251 Nov 16 22:44 CHANGES
-rw-r--r--. 1 1001 1001 476577 Nov 16 22:44 CHANGES.ru
drwxr-xr-x. 2 1001 1001 168 Apr 27 20:42 conf
-rwxr-xr-x. 1 1001 1001 2590 Nov 16 22:44 configure
drwxr-xr-x. 4 1001 1001 72 Apr 27 20:42 contrib
drwxr-xr-x. 2 1001 1001 40 Apr 27 20:42 html
-rw-r--r--. 1 1001 1001 1397 Nov 16 22:44 LICENSE
-rw-r--r--. 1 root root 442 Apr 27 20:49 Makefile
drwxr-xr-x. 2 1001 1001 21 Apr 27 20:42 man
drwxr-xr-x. 3 root root 174 Apr 27 20:50 objs
-rw-r--r--. 1 1001 1001 49 Nov 16 22:44 README
drwxr-xr-x. 9 1001 1001 91 Apr 27 20:42 src
# 9.编译(让系统能识别你的代码,并且把刚才指定的功能和路径编译到源码中)
[root@zxw nginx-1.20.2]# make
# 9.5.安装(这玩意和编译一起做)
[root@zxw nginx-1.20.2]# make install
完事以后看看/opt有没有
[root@zxw nginx-1.20.2]# ll /opt/
total 0
drwxr-xr-x. 6 root root 54 Apr 27 20:53 nginx-1.20.2
[root@zxw nginx-1.20.2]# ll /opt/nginx-1.20.2/
total 4
drwxr-xr-x. 2 root root 4096 Apr 27 20:53 conf
drwxr-xr-x. 2 root root 40 Apr 27 20:53 html
drwxr-xr-x. 2 root root 6 Apr 27 20:53 logs
drwxr-xr-x. 2 root root 19 Apr 27 20:53 sbin
# 10.为了专业点,给他做个软连接
[root@zxw nginx-1.20.2]# ll /opt/
total 0
lrwxrwxrwx. 1 root root 18 Apr 27 linux不同版本的程序包安装