centos 7.x无法安装kong gateway 3.9X的解决方案

一、问题背景

笔者想在centos7.9上通过yum的方式安装kong gateway 3.9X,安装官网安装指导

sh 复制代码
 curl -1sLf "https://packages.konghq.com/public/gateway-39/config.rpm.txt?distro=el&codename=$(rpm --eval '%{rhel}')" | sudo tee /etc/yum.repos.d/kong-gateway-39.repo
 sudo yum -q makecache -y --disablerepo='*' --enablerepo='kong-gateway-39'
 sudo yum install -y kong

输出如下信息:

txt 复制代码
[root@localhost ~]#  sudo yum install -y kong
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
... ...
(1/2): kong-gateway-39-source/primary                                                                                                                                    |  145 B  00:00:01
(2/2): kong-gateway-39-noarch/primary                                                                                                                                    |  145 B  00:00:02
No package kong available.
Error: Nothing to do

发现没有安装上,很是疑惑。后面查阅资料发现,3.9版本已经不支持在centos7.X。版本支持的详情信息见:

链接: kong gateway的版本支持

从上面的信息来看,对centos系列只有8.X和9.X了。在7.X系列的,最高只支持3.7版本。

二、解决方案

2.1、 升级操作系统到8.X,然后按照官网描述进行安装

2.1.1 安装kong
sh 复制代码
 curl -1sLf "https://packages.konghq.com/public/gateway-39/config.rpm.txt?distro=el&codename=$(rpm --eval '%{rhel}')" | sudo tee /etc/yum.repos.d/kong-gateway-39.repo
sudo yum -q makecache -y --disablerepo='*' --enablerepo='kong-gateway-39'
sudo yum install -y kong
2.1.2 安装PostgreSQL
sh 复制代码
# 更新安装的yum源
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
#  禁用 CentOS 自带 PostgreSQL 源(避免冲突)
sudo dnf -qy module disable postgresql
# 安装 PostgreSQL(可选最新版本,如 16)
sudo dnf install -y postgresql16-server postgresql16-contrib
# 初始化数据库
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
# 设置开机自启动
sudo systemctl enable --now postgresql-16
# 配置kong相关的账号
sudo -i -u postgres
psql
CREATE USER kong WITH ENCRYPTED PASSWORD 'kongpass';
CREATE DATABASE kong OWNER kong;
GRANT ALL PRIVILEGES ON DATABASE kong TO kong;
2.1.3 配置kong的启动文件
sh 复制代码
  #拷贝kong的配置文件
  cp /etc/kong/kong.cnf.default /etc/kong/kong.cnf
  # 修改配置文件
  vi  /etc/kong/kong.cnf
  # 配置数据库相关数据
  database = postgres             # Determines the database (or no database) for
                                # this node
                                # Accepted values are `postgres` and `off`.

pg_host = 127.0.0.1             # Host of the Postgres server.
pg_port = 5432                  # Port of the Postgres server.
pg_timeout = 5000               # Defines the timeout (in ms), for connecting,
                                # reading and writing.

pg_user = kong                  # Postgres user.
pg_password = kongpass          # Postgres user's password.
pg_database = kong              # The database name to connect to.

  
2.1.34 初始化kong
sh 复制代码
kong migrations bootstrap
2.1.35 启动kong
sh 复制代码
kong start
2.1.36 测试kong
sh 复制代码
[root@iZbp1ivu3yaedumdy0va2vZ ~]# curl -X GET http://localhost:8001/services
{"next":null,"data":[]}[root@iZbp1ivu3yaedumdy0va2vZ ~]#

2.2、 使用docker 来进行安装

具体的操作步骤见

链接: 一分钟搞定!在 CentOS 上用 Docker 部署 Kong Gateway 3.9

相关推荐
野生派蒙4 小时前
Linux:显示 -bash-4.2$ 问题(CentOS 7)
linux·运维·服务器·centos·bash
野生派蒙16 小时前
Linux:安装 CentOS 7(完整教程)
linux·运维·服务器·centos
noravinsc16 小时前
centos部署的openstack发布windows虚拟机
linux·windows·centos
风路丞1 天前
centos-stream-9上安装nvidia驱动和cuda-toolkit
linux·运维·centos
angushine1 天前
Gateway获取下游最终响应码
java·开发语言·gateway
MobiCetus2 天前
Linux Kernel 7
linux·运维·服务器·windows·ubuntu·centos·gnu
XDIGAS2 天前
Dockerfile项目实战-单阶段构建Vue2项目
docker·容器·centos·node.js·vue
西洼工作室2 天前
centos时间不正确解决
linux·运维·centos
锋丷2 天前
Docker安装 (centos)
docker·容器·centos
飞翔中文网2 天前
CentOS下,Xftp中文文件名乱码的处理方式
linux·运维·centos