APISIX源码安装问题解决

发布时间 2023-11-10 19:46:31作者: -见

官网手册的安装语句:

curl https://raw.githubusercontent.com/apache/apisix/master/utils/install-dependencies.sh -sL | bash -

执行 install-dependencies.sh 报如下错误:

Transaction check error:
  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.py from install of libstdc++-4.8.5-44.tl2.1.x86_64 conflicts with file from package libstdc++-4.8.5-4.el7.i686
  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.pyc from install of libstdc++-4.8.5-44.tl2.1.x86_64 conflicts with file from package libstdc++-4.8.5-4.el7.i686
  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.pyo from install of libstdc++-4.8.5-44.tl2.1.x86_64 conflicts with file from package libstdc++-4.8.5-4.el7.i686
  file /usr/share/man/man5/cert8.db.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/cert9.db.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/key3.db.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/key4.db.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/pkcs11.txt.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/secmod.db.5.gz from install of nss-3.90.0-2.tl2.x86_64 conflicts with file from package nss-3.19.1-19.el7_2.i686
  file /usr/share/man/man5/ldap.conf.5.gz from install of openldap-2.4.44-25.tl2.x86_64 conflicts with file from package openldap-2.4.40-8.el7.i686
  file /usr/share/man/man5/ldif.5.gz from install of openldap-2.4.44-25.tl2.x86_64 conflicts with file from package openldap-2.4.40-8.el7.i686

Error Summary

解决办法为执行下列语句删除冲突:

yum -y remove libstdc++-4.8.5-4.el7.i686

当 install-dependencies.sh 执行 linux-install-luarocks.sh 时报下列错误:

Configuring LuaRocks version 3.8.0...

Lua version detected: 5.1
Lua interpreter found: /usr/bin/lua
lua.h for Lua 5.1 not found (tried /usr/include/lua/5.1/lua.h /usr/include/lua5.1/lua.h /usr/include/lua-5.1/lua.h /usr/include/lua51/lua.h /usr/include/lua.h)

If the development files for Lua (headers and libraries)
are installed in your system, you may need to use the
--with-lua or --with-lua-include flags to specify their location.

If those files are not yet installed, you need to install
them using the appropriate method for your operating system.

Run ./configure --help for details on flags.

https://www.lua.org/download.html 下载 lua-5.4.6,解压后修改其中的 Makefile 文件,将 INSTALL_TOP 的值改为:

INSTALL_TOP= /usr/local/lua-5.4.6

执行:

make&&make install

成功后再执行:

ln -s /usr/local/lua-5.4.6 /usr/local/lua

更新 PATH,指向 lua-5.4.6:

export PATH=/usr/local/lua:$PATH

重新执行 install-dependencies.sh 完成安装。

在本文写作时,“APISIX_VERSION='3.6.1'” 并不可用,需改为“APISIX_VERSION='3.6.0'”。

执行“make deps”时报错:

[ info ] WARNING: OpenResty not found. You have to install OpenResty and add the binary file to PATH before install Apache APISIX.

下面这个错误同 openresty.repo 有关:

failure: repodata/repomd.xml from openresty: [Errno 256] No more mirrors to try.
https://openresty.org/package/centos/2.6/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

上面这个错误是因为 openresty.repo 配置的 baseurl 实际不存在:

# cat /etc/yum.repos.d/openresty.repo
[openresty]
name=Official OpenResty Open Source Repository for CentOS
baseurl=https://openresty.org/package/centos/$releasever/$basearch
skip_if_unavailable=False
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://openresty.org/package/pubkey.gpg
enabled=1
enabled_metadata=1

在 CentOS 7.9 上查 basearch 和 releasever 的取值:

# python -c 'import yum, json; yb = yum.YumBase(); print json.dumps(yb.conf.yumvar, indent=2)'
Loaded plugins: fastestmirror
{
  "arch": "ia32e", 
  "basearch": "x86_64", 
  "releasever": "2.6", 
  "uuid": "d20a9386-c8d2-225a-8e8d-916f99f582d1"
}

实际存在的,如:

https://openresty.org/package/centos/7/x86_64/repodata/repomd.xml

做下列改动就能通过:

# cat /etc/yum.repos.d/openresty.repo 
[openresty]
name=Official OpenResty Open Source Repository for CentOS
#baseurl=https://openresty.org/package/centos/$releasever/$basearch
baseurl=https://openresty.org/package/centos/7/x86_64/
skip_if_unavailable=False
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://openresty.org/package/pubkey.gpg
enabled=1
enabled_metadata=1