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

相关推荐
金斗潼关5 小时前
SpringCloud GateWay网关
java·spring cloud·gateway
虎头金猫5 小时前
如何解决 403 错误:请求被拒绝,无法连接到服务器
运维·服务器·python·ubuntu·chatgpt·centos·bug
残花月伴15 小时前
springCloud/Alibaba常用中间件之GateWay网关
spring cloud·中间件·gateway
编码雪人1 天前
CentOS算法部署
linux·运维·centos
穿条秋裤到处跑1 天前
Centos离线安装mysql、redis、nginx等工具缺乏层层依赖的解决方案
mysql·centos
柚个朵朵1 天前
Springclound常用五大组件及其使用原理
spring cloud·hystrix·eureka·ribbon·gateway·feign
曹朋羽2 天前
spring cloud gateway 断言(Predicates)与过滤器(filters)
spring cloud·gateway
B64A-消闲2 天前
linux(centos)联网情况下部署
linux·运维·centos
hzj62 天前
GateWay使用
java·spring·gateway
不明之明3 天前
解决Centos连不上网
linux·运维·centos