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

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

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

3、搜索指定软件包名称

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

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

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

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

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

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

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

  1. /usr/local/openresty/site/lualib/resty

编写代码测试

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

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

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

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

  1. /usr/local/openresty/lualib/resty  

要想安装到以上目录

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

  1. 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. 爬虫_豆瓣电影top250 (正则表达式)

    一样的套路,就是多线程还没弄 import requests import re import json headers = 'Mozilla/5.0 (Windows NT 10.0; WOW64) ...

  2. Hdoj 2563.统计问题 题解

    Problem Description 在一无限大的二维平面中,我们做如下假设: 1. 每次只能移动一格: 2. 不能向后走(假设你的目的地是"向上",那么你可以向左走,可以向右走 ...

  3. css元素溢出

    当子元素的尺寸超过父元素的尺寸时,需要设置父元素显示溢出的子元素的方式,设置的方法是通过overflow属性来设置. overflow的设置项: 1.visible 默认值.内容不会被修剪,会呈现在元 ...

  4. table用模板生成的问题

    在使用<template></template>存放HTML模板标记时,发现一个烦人的问题,表格不行. <template> <table> <t ...

  5. 通过pycharm将代码push到远程仓库

    现在使用pycharm作为python编辑器的人还是不少,而且,也可以通过pycharm将代码push到远程仓库. 步骤见下面截图: 填上远程仓库地址及克隆到本地的目录 输入远程仓库的账号和密码 修改 ...

  6. LOJ#6282. 数列分块入门 6

    一个动态的插入过程,还需要带有查询操作. 我可以把区间先分块,然后每个块块用vector来维护它的插入和查询操作,但是如果我现在这个块里的vector太大了,我可能的操作会变的太大,所以这时候我需要把 ...

  7. pandas isin

    在已知id索引的情况下,如何获取所需要的行呢?已经不止一次遇到这样的情况,经历过重重筛选,所得到的最终结果是一串满足所有条件的id列表. pandas 的isin 能很好的解决这个问题, import ...

  8. webpack入门(六) API in modules

    A quick summary of all methods and variables available in code compiled with webpack. 用webpack编译的一些变 ...

  9. Python基础之文件和目录操作

    1 .文件操作 1.1 文件打开和关闭 在python, 使用 open 函数, 可以打开一个已经存在的文件, 或者创建一个新文件. # 打开文件 f = open('test.txt', 'w') ...

  10. spring中的@Bean是否一定要与@Configuration一起用

        版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/little_newBee/article/details/80383691 在使用sprin ...