如何在 centos 上离线安装一个 openresty
参照 OpenResty® Linux Packages( openresty.org/en/linux-packages.html) 提供。
RPM originally stands for Red Hat Package Manager.( e7z 组织网/open-rpm.htm)
An RPM package is simply a header structure on top of a CPIO archive. The package itself is comprised of four sections: a header with a leading identifier (magic number) that identifies the file as an RPM package, a signature to verify the integrity of the package, the header or ‘tagged’ data containing package information, version numbers, and copyright messaging, and the archive containing the actual program files.
RPM 包括是使用 cpio 格式打包的,因此可以先转成 cpio 然后解压,如下所示:
rpm2cpio xxx.rpm | cpio -div
rpm2cpio 命令用于将 rpm 软件包转换为 cpio 格式的文件。
[vagrant@bogon openresty.centos.el7]$ rpm2cpio openresty-pcre-8.42-1.el7.centos.x86_64.rpm | cpio -div
./usr/local/openresty/pcre/lib/libpcre.so
./usr/local/openresty/pcre/lib/libpcre.so.1
./usr/local/openresty/pcre/lib/libpcre.so.1.2.10
892 块
[vagrant@bogon openresty.centos.el7]$ rpm2cpio openresty-1.15.8.1-1.el7.x86_64.rpm | cpio -div
./etc/init.d/openresty
./usr/bin/openresty
./usr/local/openresty/COPYRIGHT
./usr/local/openresty/bin/openresty
./usr/local/openresty/luajit/bin
./usr/local/openresty/luajit/bin/luajit
./usr/local/openresty/luajit/bin/luajit-2.1.0-beta3
./usr/local/openresty/luajit/include
./usr/local/openresty/luajit/include/luajit-2.1
./usr/local/openresty/luajit/include/luajit-2.1/lauxlib.h
./usr/local/openresty/luajit/include/luajit-2.1/lua.h
./usr/local/openresty/luajit/include/luajit-2.1/lua.hpp
./usr/local/openresty/luajit/include/luajit-2.1/luaconf.h
./usr/local/openresty/luajit/include/luajit-2.1/luajit.h
./usr/local/openresty/luajit/include/luajit-2.1/lualib.h
./usr/local/openresty/luajit/lib
./usr/local/openresty/luajit/lib/libluajit-5.1.so
./usr/local/openresty/luajit/lib/libluajit-5.1.so.2
./usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0
./usr/local/openresty/luajit/lib/lua
./usr/local/openresty/luajit/lib/lua/5.1
./usr/local/openresty/luajit/lib/pkgconfig
./usr/local/openresty/luajit/lib/pkgconfig/luajit.pc
./usr/local/openresty/luajit/share
./usr/local/openresty/luajit/share/lua
./usr/local/openresty/luajit/share/lua/5.1
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/bc.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/bcsave.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_arm.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_arm64.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_arm64be.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_mips.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_mips64.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_mips64el.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_mipsel.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_ppc.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_x64.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dis_x86.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/dump.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/p.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/v.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/vmdef.lua
./usr/local/openresty/luajit/share/luajit-2.1.0-beta3/jit/zone.lua
./usr/local/openresty/lualib/cjson.so
./usr/local/openresty/lualib/librestysignal.so
./usr/local/openresty/lualib/ngx
./usr/local/openresty/lualib/ngx/balancer.lua
./usr/local/openresty/lualib/ngx/base64.lua
./usr/local/openresty/lualib/ngx/errlog.lua
./usr/local/openresty/lualib/ngx/ocsp.lua
./usr/local/openresty/lualib/ngx/pipe.lua
./usr/local/openresty/lualib/ngx/process.lua
./usr/local/openresty/lualib/ngx/re.lua
./usr/local/openresty/lualib/ngx/resp.lua
./usr/local/openresty/lualib/ngx/semaphore.lua
./usr/local/openresty/lualib/ngx/ssl
./usr/local/openresty/lualib/ngx/ssl.lua
./usr/local/openresty/lualib/ngx/ssl/session.lua
./usr/local/openresty/lualib/redis
./usr/local/openresty/lualib/redis/parser.so
./usr/local/openresty/lualib/resty
./usr/local/openresty/lualib/resty/aes.lua
./usr/local/openresty/lualib/resty/core
./usr/local/openresty/lualib/resty/core.lua
./usr/local/openresty/lualib/resty/core/base.lua
./usr/local/openresty/lualib/resty/core/base64.lua
./usr/local/openresty/lualib/resty/core/ctx.lua
./usr/local/openresty/lualib/resty/core/exit.lua
./usr/local/openresty/lualib/resty/core/hash.lua
./usr/local/openresty/lualib/resty/core/misc.lua
./usr/local/openresty/lualib/resty/core/ndk.lua
./usr/local/openresty/lualib/resty/core/phase.lua
./usr/local/openresty/lualib/resty/core/regex.lua
./usr/local/openresty/lualib/resty/core/request.lua
./usr/local/openresty/lualib/resty/core/response.lua
./usr/local/openresty/lualib/resty/core/shdict.lua
./usr/local/openresty/lualib/resty/core/time.lua
./usr/local/openresty/lualib/resty/core/uri.lua
./usr/local/openresty/lualib/resty/core/utils.lua
./usr/local/openresty/lualib/resty/core/var.lua
./usr/local/openresty/lualib/resty/core/worker.lua
./usr/local/openresty/lualib/resty/dns
./usr/local/openresty/lualib/resty/dns/resolver.lua
./usr/local/openresty/lualib/resty/limit
./usr/local/openresty/lualib/resty/limit/conn.lua
./usr/local/openresty/lualib/resty/limit/count.lua
./usr/local/openresty/lualib/resty/limit/req.lua
./usr/local/openresty/lualib/resty/limit/traffic.lua
./usr/local/openresty/lualib/resty/lock.lua
./usr/local/openresty/lualib/resty/lrucache
./usr/local/openresty/lualib/resty/lrucache.lua
./usr/local/openresty/lualib/resty/lrucache/pureffi.lua
./usr/local/openresty/lualib/resty/md5.lua
./usr/local/openresty/lualib/resty/memcached.lua
./usr/local/openresty/lualib/resty/mysql.lua
./usr/local/openresty/lualib/resty/random.lua
./usr/local/openresty/lualib/resty/redis.lua
./usr/local/openresty/lualib/resty/sha.lua
./usr/local/openresty/lualib/resty/sha1.lua
./usr/local/openresty/lualib/resty/sha224.lua
./usr/local/openresty/lualib/resty/sha256.lua
./usr/local/openresty/lualib/resty/sha384.lua
./usr/local/openresty/lualib/resty/sha512.lua
./usr/local/openresty/lualib/resty/shell.lua
./usr/local/openresty/lualib/resty/signal.lua
./usr/local/openresty/lualib/resty/string.lua
./usr/local/openresty/lualib/resty/upload.lua
./usr/local/openresty/lualib/resty/upstream
./usr/local/openresty/lualib/resty/upstream/healthcheck.lua
./usr/local/openresty/lualib/resty/websocket
./usr/local/openresty/lualib/resty/websocket/client.lua
./usr/local/openresty/lualib/resty/websocket/protocol.lua
./usr/local/openresty/lualib/resty/websocket/server.lua
./usr/local/openresty/lualib/tablepool.lua
./usr/local/openresty/nginx/conf/fastcgi.conf
./usr/local/openresty/nginx/conf/fastcgi.conf.default
./usr/local/openresty/nginx/conf/fastcgi_params
./usr/local/openresty/nginx/conf/fastcgi_params.default
./usr/local/openresty/nginx/conf/koi-utf
./usr/local/openresty/nginx/conf/koi-win
./usr/local/openresty/nginx/conf/mime.types
./usr/local/openresty/nginx/conf/mime.types.default
./usr/local/openresty/nginx/conf/nginx.conf
./usr/local/openresty/nginx/conf/nginx.conf.default
./usr/local/openresty/nginx/conf/scgi_params
./usr/local/openresty/nginx/conf/scgi_params.default
./usr/local/openresty/nginx/conf/uwsgi_params
./usr/local/openresty/nginx/conf/uwsgi_params.default
./usr/local/openresty/nginx/conf/win-utf
./usr/local/openresty/nginx/html/50x.html
./usr/local/openresty/nginx/html/index.html
./usr/local/openresty/nginx/logs
./usr/local/openresty/nginx/sbin/nginx
./usr/local/openresty/nginx/sbin/stap-nginx
./usr/local/openresty/nginx/tapset/nginx.stp
./usr/local/openresty/nginx/tapset/ngx_lua.stp
./usr/local/openresty/site/lualib
7156 块
cpio 参数说明:
-t 列出的意思,和"--list"等同,注意,此时列出的是“相对路径”
-i 抽取的意思,和"--extract"等同
-d 建立目录,和"--make-directories"等同
-v 冗余信息输出,和"--verbose"等同
rpm 参数说明:
-q --query 查询
-l --list 列出
-f --file 指定文件
-p --package 指定rpm包
[vagrant@bogon openresty.centos.el7]$ rpm -qp --scripts openresty-1.15.8.1-1.el7.x86_64.rpm
postinstall scriptlet (using /bin/sh):
/sbin/chkconfig --add openresty
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
/sbin/service openresty stop >/dev/null 2>&1
/sbin/chkconfig --del openresty
fi
[vagrant@bogon openresty.centos.el7]$ rpm -pqi openresty-1.15.8.1-1.el7.x86_64.rpm
Name : openresty
Version : 1.15.8.1
Release : 1.el7
Architecture: x86_64
Install Date: (not installed)
Group : System Environment/Daemons
Size : 3640924
License : BSD
Signature : RSA/SHA1, 2019年05月17日 星期五 01时39分29秒, Key ID 97db7443d5edeb74
Source RPM : openresty-1.15.8.1-1.el7.src.rpm
Build Date : 2019年05月17日 星期五 01时39分26秒
Build Host : centos7
Relocations : (not relocatable)
URL : https://openresty.org/
Summary : OpenResty, scalable web platform by extending NGINX with Lua
Description :
This package contains the core server for OpenResty. Built for production
uses.
OpenResty is a full-fledged web platform by integrating the standard Nginx
core, LuaJIT, many carefully written Lua libraries, lots of high quality
3rd-party Nginx modules, and most of their external dependencies. It is
designed to help developers easily build scalable web applications, web
services, and dynamic web gateways.
By taking advantage of various well-designed Nginx modules (most of which
are developed by the OpenResty team themselves), OpenResty effectively
turns the nginx server into a powerful web app server, in which the web
developers can use the Lua programming language to script various existing
nginx C modules and Lua modules and construct extremely high-performance
web applications that are capable to handle 10K ~ 1000K+ connections in
a single box.
In fact that's not a one but four different questions:
1、First you can quickly list a downloaded package's dependencies/requirements by using the following commands:
$ rpm -qp mypackage.rpm --provides
$ rpm -qp mypackage.rpm --requires
2、Second, you can use yum utility in order to satisfy these (somewhat cryptic) dependencies automatically (assuming that all your repositories are set up correctly, and all the dependencies are available):
$ sudo yum install mypackage.rpm
3、Third, there are several RPM search resources, some of them already suggested above. I'd like to list another one, just for the reference - pkgs.org.
4、Fourth, there is an additional popular repository for RHEL5 and RHEL6 distros - EPEL. Note that it's not supported by Red Hat.
| Syntax | Description | Example(s) |
|---|---|---|
| rpm -ivh {rpm-file} | Install the package | rpm -ivh mozilla-mail-1.7.5-17.i586.rpm rpm -ivh --test mozilla-mail-1.7.5-17.i586.rpm |
| rpm -Uvh {rpm-file} | Upgrade package | rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm rpm -Uvh --test mozilla-mail-1.7.6-12.i586.rpm |
| rpm -ev {package} | Erase/remove/ an installed package | rpm -ev mozilla-mail |
| rpm -ev --nodeps {package} | Erase/remove/ an installed package without checking for dependencies | rpm -ev --nodeps mozilla-mail |
| rpm -qa | Display list all installed packages | rpm -qarpm -qa | less |
| rpm -qi {package} | Display installed information along with package version and short description | rpm -qi mozilla-mail |
| rpm -qf {/path/to/file} | Find out what package a file belongs to i.e. find what package owns the file | rpm -qf /etc/passwdrpm -qf /bin/bash |
| rpm -qc {pacakge-name} | Display list of configuration file(s) for a package | rpm -qc httpd |
| rpm -qcf {/path/to/file} | Display list of configuration files for a command | rpm -qcf /usr/X11R6/bin/xeyes |
| rpm -qa --last | Display list of all recently installed RPMs | rpm -qa --lastrpm -qa --last | less |
| rpm -qpR {.rpm-file} rpm -qR {package} |
Find out what dependencies a rpm file has | rpm -qpR mediawiki-1.4rc1-4.i586.rpm rpm -qR bash |

