Can't install http module with luarocks on Ubuntu - lua

HTTP module installation is failing on Ubuntu with following error:
root#someserver:/var/log# luarocks install http
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://luarocks.org/http-0.4-0.all.rock
Missing dependencies for http 0.4-0:
cqueues >= 20161214 (not installed)
luaossl >= 20161208 (not installed)
basexx >= 0.2.0 (not installed)
binaryheap >= 0.3 (not installed)
fifo (not installed)
http 0.4-0 depends on cqueues >= 20161214 (not installed)
Installing https://luarocks.org/cqueues-20200726.51-0.src.rock
Error: Failed installing dependency: https://luarocks.org/cqueues-20200726.51-0.src.rock - Could not find header file for CRYPTO
No file openssl/crypto.h in /usr/local/include
No file openssl/crypto.h in /usr/include
You may have to install CRYPTO in your system and/or pass CRYPTO_DIR or CRYPTO_INCDIR to the luarocks command.
Example: luarocks install cqueues CRYPTO_DIR=/usr/local
Any tips?

Seems OpenSSL isn't installed in your system. So try running:
sudo apt-get install libssl-dev

Related

luarocks package installer could not find header file for CRYPTO (crypto.h)

I am trying to install lapis through luarocks. When I run luarocks install lapis, the terminal returns this error:
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://luarocks.org/lapis-1.9.0-1.src.rock
Missing dependencies for lapis 1.9.0-1:
luaossl (not installed)
pgmoon (not installed)
lapis 1.9.0-1 depends on lua (5.4-1 provided by VM)
lapis 1.9.0-1 depends on ansicolors (1.0.2-3 installed)
lapis 1.9.0-1 depends on date (2.2-2 installed)
lapis 1.9.0-1 depends on etlua (1.3.0-1 installed)
lapis 1.9.0-1 depends on loadkit (1.1.0-1 installed)
lapis 1.9.0-1 depends on lpeg (1.0.2-1 installed)
lapis 1.9.0-1 depends on lua-cjson (2.1.0-1 installed)
lapis 1.9.0-1 depends on luaossl (not installed)
Installing https://luarocks.org/luaossl-20220711-0.src.rock
Error: Failed installing dependency: https://luarocks.org/luaossl-20220711-0.src.rock - Could not find header file for CRYPTO
No file openssl/crypto.h in /usr/local/include
No file openssl/crypto.h in /usr/include
No file openssl/crypto.h in /include
No file openssl/crypto.h in /usr/local/opt/include
You may have to install CRYPTO in your system and/or pass CRYPTO_DIR or CRYPTO_INCDIR to the luarocks command.
Example: luarocks install luaossl CRYPTO_DIR=/usr/local
I have openssl installed (I am on apple silicone). To install openssl, I just cloned the git repo and then ran:
./Configure
make
make test
As stipulated in the INSTALL.MD file. I think this is an issue a few others have had but there are no answers on how to solve it.
You only followed the instructions in the "Building OpenSSL" section of INSTALL.MD. You skipped the ones in the "Installing OpenSSL" section, so it's not actually installed. Follow them too and then try again.

Luarocks openssl

I am trying to install luajwt using the following command:
$ sudo luarocks install --server=http://rocks.moonscript.org luajwt
But unfortunately, I receive the following error:
Installing http://rocks.moonscript.org/luajwt-1.3-4.src.rock
Missing dependencies for luajwt 1.3-4:
luacrypto >= 0.3.2-1 (not installed)
lua-cjson >= 2.1.0 (not installed)
lbase64 >= 20120807-3 (not installed)
luajwt 1.3-4 depends on lua >= 5.1 (5.4-1 provided by VM)
luajwt 1.3-4 depends on luacrypto >= 0.3.2-1 (not installed)
Installing http://rocks.moonscript.org/luacrypto-0.3.2-2.src.rock
Error: Failed installing dependency: http://rocks.moonscript.org/luacrypto-0.3.2-2.src.rock - Could not find header file for OPENSSL
No file openssl/evp.h in /usr/local/include
No file openssl/evp.h in /usr/include
No file openssl/evp.h in /include
No file openssl/evp.h in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
No file openssl/evp.h in /usr/local/opt/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install luacrypto OPENSSL_DIR=/usr/local
I tried to resolve that issue by installing OpenSSL with luarocks but I am getting the same error:
➜ Luarocks install openssl
Installing https://luarocks.org/openssl-0.8.2-1.src.rock
Error: Could not find header file for OPENSSL
No file openssl/evp.h in /usr/local/include
No file openssl/evp.h in /usr/include
No file openssl/evp.h in /include
No file openssl/evp.h in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
No file openssl/evp.h in /usr/local/opt/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install openssl OPENSSL_DIR=/usr/local
How can I avoid this error?

ERROR: No matching distribution found for psycopg2-binary==2.8.2

Please how should i install psycopg2-binary on my python image.
I tried pip install psycopg2-binary==2.8.2 but i got this error
ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.2 (from versions: 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1) ERROR: No matching distribution found for psycopg2-binary==2.8.2
My image is python3.9-alpine
What should i do please???
Given the amount of work that requires to be done, I suggest you use a different base image, e.g. python:3.9 or that you install the alpine package py3-psycopg2 (which is on v 2.8.6 at the time of writing).
Anyway I tried it on my machine and in the error it's also written Error: pg_config executable not found.
The pg_config is part of the postgres_dev package and needs to be installed before installing the psycopg2-binary package.
The psycopg2-binary will also need the gcc to be installed and some other libraries.
In other words, you have to execute the following commands:
apk add postgresql-dev gcc ...
pip install psycopg2-binary==2.8.2
I've abandoned the topic after I had to install a bunch of libraries.

Kong-OIDC Plugin Installation Issue

I am installing Kong-OIDC plugin in a Kong docker container and get following error:
Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.6.0-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-jwt-0.2.2-0.src.rock - Rockspec format 3.0 is not supported, please upgrade LuaRocks.
Seems like one of the underlying dependency "lua-jesty-jwt" is using Rockpsec format 3.0 version, which is not supported any more. Is there a way to get around this issue ?
I updated the Dockerfile with a previous version of the kong-oidc plugin. The Dockerfile looks like this:
FROM kong:0.14-centos
LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
RUN yum install -y git unzip && yum clean all
RUN luarocks install kong-oidc 1.0.1
But running docker build -t kong:0.14-centos-oidc returns this error:
Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Could not find header file for OPENSSL
No file openssl/evp.h in /usr/local/include
No file openssl/evp.h in /usr/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install luacrypto OPENSSL_DIR=/usr/local
So we need to add RUN yum install openssl-devel -y to the Dockerfile. So, if you run again the docker build command, you'll get this error:
Build error: Failed compiling object src/lcrypto.oError: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Build error: Failed compiling object src/lcrypto.o
So we need to install the gcc compiler adding RUN yum install -y gcc to the Dockerfile. The final result is:
FROM kong:0.14-centos
LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
RUN yum install -y git unzip && yum clean all
RUN yum install -y openssl-devel -y
RUN yum install -y gcc
RUN luarocks install kong-oidc 1.0.1
Now the container builds successfully, but I think the current kong-oidc plugin is not maintained anymore.
UPDATE: Check this repository to get a working example of the kong-oidc plugin with Keycloak.
The latest version of kong-oidc (1.1.0) did not work for me, but I was able to install an older version (1.0.1) without much issue. I did have to install an additional library "openssl-devel" (yum install openssl-devel).

When installing oAuth I get a dependency error

I'm installing php oAuth in my Ubuntu 12.04 on PHP 5.6. I tried the following commands
apt-get update
apt-get install libpcre3 libpcre3-dev
apt-get install php5-oauth
I'm getting this error :
php5-oauth : Depends: phpapi-20121212
Also tried with pecl
pecl install oauth
pecl/oauth is already installed and is the same as the released version 1.2.3
install failed
I added extension=oauth.so in php.ini file and restarted Apache also.
I tried this command pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
mongo 1.1.4 stable
oauth 1.2.3 stable
It shows oauth is installed but it not showing oAuth in php info file.

Resources