1、自1.11.2.2开始,OpenResty版本已经包含并默认安装opm。所以通常你不需要自己安装opm。

2、我们在这里只需要做一个软连接就可以了

cd /usr/local/openresty/bin
sudo ln -s `pwd`/opm /usr/local/bin/opm

3、搜索指定软件包名称

www@TinywanAliYun:~$ opm search session
bungle/lua-resty-session Session Library for OpenResty - Flexible and Secure

4、搜索具有多个模式“lru”和“cache”的软件包名称和摘要。

www@TinywanAliYun:~$ opm search lru cache
openresty/lua-resty-lrucache Lua-land LRU Cache based on LuaJIT FFI

5、在一些作者的名字下安装名为lua-resty-logger-socket的软件包

www@TinywanAliYun:~$ opm get p0pr0ck5/lua-resty-logger-socket* Fetching p0pr0ck5/lua-resty-logger-socket
Downloading https://opm.openresty.org/api/pkg/tarball/p0pr0ck5/lua-resty-logger-socket-0.03.opm.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
Package p0pr0ck5/lua-resty-logger-socket 0.03 installed successfully under /usr/local/openresty/site/ .

结果在  /usr/local/openresty/lualib/resty  目录下没有这个文件下载下来

结果该文件默认下载到以下目录了

/usr/local/openresty/site/lualib/resty

编写代码测试

local uuid = require 'resty.jit-uuid'
ngx.say(uuid())

问题来了,项目中直接应用,报错,提示找不到该文件

[C]: in function 'require'
in function /status"
[error] 7626#7626: init_worker_by_lua error: init_worker_by_lua:2: module 'resty.jit-uuid' not found:
no field package.preload['resty.jit-uuid']
no file '/usr/local/openresty/lualib/resty/jit-uuid.lua'
no file '/usr/local/openresty/nginx/conf/waf/resty/jit-uuid.lua'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'
no file '/opt/verynginx/verynginx/lua_script/resty/jit-uuid.so'
no file '/usr/local/openresty/site/lualib/resty/jit-uuid.so'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'

如果复制到该目录下,则是可以正常访问的

/usr/local/openresty/lualib/resty  

要想安装到以上目录

则在下载的时候指定安装目录就可以了

opm --install-dir=/usr/local/openresty get thibaultcha/lua-resty-jit-uuid  

通过上面这种安装方式,直接在项目中就可以使用

参考

1、OpenResty 大跃进! opm 包管理尝鲜

Openresty 学习笔记(一)opm 工具的使用的更多相关文章

  1. openresty 学习笔记二:获取请求数据

    openresty 学习笔记二:获取请求数据 openresty 获取POST或者GET的请求参数.这个是要用openresty 做接口必须要做的事情.这里分几种类型:GET,POST(urlenco ...

  2. Oracle RAC学习笔记02-RAC维护工具集

    Oracle RAC学习笔记02-RAC维护工具集 RAC维护工具集 1.节点层 2.网络层 3.集群层 4.应用层 本文实验环境: 10.2.0.5 Clusterware + RAC 11.2.0 ...

  3. 并发编程学习笔记(10)----并发工具类CyclicBarrier、Semaphore和Exchanger类的使用和原理

    在jdk中,为并发编程提供了CyclicBarrier(栅栏),CountDownLatch(闭锁),Semaphore(信号量),Exchanger(数据交换)等工具类,我们在前面的学习中已经学习并 ...

  4. TensorFlow学习笔记2-性能分析工具

    TensorFlow学习笔记2-性能分析工具 性能分析工具 在spyder中运行以下代码: import tensorflow as tf from tensorflow.python.client ...

  5. openresty 学习笔记小结:综合应用实例

    openresty 学习笔记小结:综合应用实例 这个综合实验实现的功能其实很简单,用户访问一个页面,显示一个默认页面.输入参数(post或者get都可以),如果参数在数据库查询得到并满足一定条件,根据 ...

  6. openresty 学习笔记六:使用session库

    openresty 学习笔记六:使用session库 lua-resty-session 是一个面向 OpenResty 的安全和灵活的 session 库,它实现了 Secure Cookie Pr ...

  7. openresty 学习笔记番外篇:python的一些扩展库

    openresty 学习笔记番外篇:python的一些扩展库 要写一个可以使用的python程序还需要比如日志输出,读取配置文件,作为守护进程运行等 读取配置文件 使用自带的ConfigParser模 ...

  8. openresty 学习笔记番外篇:python访问RabbitMQ消息队列

    openresty 学习笔记番外篇:python访问RabbitMQ消息队列 python使用pika扩展库操作RabbitMQ的流程梳理. 客户端连接到消息队列服务器,打开一个channel. 客户 ...

  9. openresty 学习笔记五:访问RabbitMQ消息队列

    openresty 学习笔记五:访问RabbitMQ消息队列 之前通过比较选择,决定采用RabbitMQ这种消息队列来做中间件,目的舒缓是为了让整个架构的瓶颈环节.这里是做具体实施,用lua访问Rab ...

  10. openresty 学习笔记四:连接mysql和进行相关操作

    openresty 学习笔记四:连接mysql和进行相关操作 毕竟redis是作为缓存,供程序的快速读写,虽然reidis也可以做持久化保存,但还是需要一个做数据存储的数据库.比如首次查询数据在red ...

随机推荐

  1. 解决 phpstorm 运行卡,自动关闭等问题

    解决 phpstorm 自动关闭问题: 使用文件搜索工具(可在本博客搜索“管理工具”,或查找安装目录) 找到phpstorm.vmoptions文件,使用记事本打开. 添加以下两行代码: -Dawt. ...

  2. Markdown基础(内含:锚点使用,使用HTML,新页面跳转,目录生成)

    Github样式显示参考:点我 之前说过用word写文章,这次说说Markdown写文章(推荐) 逆天推荐使用VSCode编写 装这个插件写作更方便: 内含:锚点使用,使用HTML,新页面跳转,目录生 ...

  3. kafka为什么这么优秀!

    kafka为什么这么优秀! 阿飞的博客 匠心零度 今天 1.动机2.持久化3.效率4.生产者4.1负载均衡4.2异步发送5.消费者Push vs. Pull消费者位置离线数据加载 1.动机 kafka ...

  4. Nginx宣布正式支持gRPC,附示例代码

    原创 2018-03-20 薛命灯 聊聊架构 作者|Owen Garrett编辑|薛命灯 NGINX 官方博客正式宣布 NGINX 支持原生的 gPRC,现在就可以从代码仓库拉取快照版本.该特性将会被 ...

  5. 手把手教你用1行代码实现人脸识别 --Python Face_recognition

    环境要求: Ubuntu17.10 Python 2.7.14 环境搭建: 1. 安装 Ubuntu17.10 > 安装步骤在这里 2. 安装 Python2.7.14 (Ubuntu17.10 ...

  6. ftp sun jdk自带

    package com.italktv.colnv.stat.util; import java.io.File; import java.io.FileInputStream; import jav ...

  7. A1124. Raffle for Weibo Followers

    John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers ...

  8. cookie 常用操作

    Cookie:指网站为了辨别用户身份.进行会话跟踪而储存在用户本地的 key/value 型数据(通常经过加密), cookie key/value 型数据可以由服务器端自己定义. Cookie是由服 ...

  9. Fiddler安装证书

    1.打开Fiddler,点击工具栏中的Tools——>Fiddler Options…       2.切换到 HTTPS 选项卡,勾选 Capture HTTPS CONNECTs,勾选 De ...

  10. 物联网温度服务器-ECharts、HTML5、JavaScript / ECharts gauge使用示例

    https://blog.csdn.net/u012812482/article/details/51079890 1. 效果 2. 简介 1. 其中仪表的部分使用的是ECharts的gauge控件实 ...