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

相关推荐
yangmf204034 分钟前
如何使用 INFINI Gateway 增量迁移 ES 数据
大数据·数据库·elasticsearch·搜索引擎·gateway
Wang's Blog2 小时前
Linux小课堂: Apache服务在CentOS上的安装与基础配置指南
linux·centos·apache
我爱钱因此会努力2 小时前
ansible实战- 循环创建多个用户
运维·服务器·centos
conkl19 小时前
在 CentOS 系统上实现定时执行 Python 邮件发送任务完整指南
linux·运维·开发语言·python·centos·mail·邮箱
江輕木19 小时前
VMware安装配置CentOS 7
linux·运维·centos
非凡的世界1 天前
ThinkPHP6 集成TCP长连接 GatewayWorker
网络·网络协议·tcp/ip·gateway·thinkphp·worker·workman
戮戮1 天前
一次深入排查:Spring Cloud Gateway TCP 连接复用导致 K8s 负载均衡失效
tcp/ip·spring cloud·kubernetes·gateway·负载均衡·netty
半梦半醒*1 天前
zookeeper + kafka
linux·分布式·zookeeper·kafka·centos·运维开发
小鹿学程序1 天前
虚拟机之间配置免密登录(Centos)
大数据·linux·运维·centos
Maple_land2 天前
编译器的“隐形约定”与本地变量:解锁Linux变量体系的关键密码
linux·运维·服务器·c++·centos