我尝试使用https://docs.konghq.com/install/ubuntu/上提供的说明进行安装,还使用了快照存储,但是出现相同的错误。我不知道它是否相关,但是我正在使用预装Ubuntu-20.04的postgres-12.2。 postgres-12.2中的目录结构与以前的目录结构不同。
error: cannot perform the following tasks:
- Run install hook of "kong" snap if present (run hook "install":
-----
The files belonging to this database system will be owned by user "snap_daemon".
This user must also own the server process.
The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /var/snap/kong/172/postgresql/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Kolkata
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/snap/kong/172/usr/lib/postgresql/10/bin/pg_ctl -D /var/snap/kong/172/postgresql/10/main -l logfile start
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/snap/kong/common/sockets/.s.PGSQL.5432"?
-----)```
[1]: https://i.stack.imgur.com/2pzKn.png
最后,它是在经过大量研究和无休止尝试之后才完成的。如果您遇到相同的问题,请遵循以下顺序(仅适用于Ubuntu 20.04):
最好不要使用apt-get或snap安装(至少要等到适用于Ubuntu 20.04的snap才可用)。使用https://docs.konghq.com/install/ubuntu/#packages上的.deb软件包进行安装。下载软件包后,导航至终端中的Downloads文件夹,然后运行以下命令进行安装:
sudo apt-get install openssl libpcre3 procps perl sudo dpkg -i kong-2.0.4。*。deb
不知道第一个命令要安装什么,但根据KONG的官方文档,建议这样做。] >>
在另一个终端中,在postgres中创建一个新用户和数据库以实现KONG连接。
sudo -i -u postgres psql 创建用户kong; 创建数据库kong OWNER kong;
返回到您要安装KONG的终端。尝试运行命令:
sudo kong迁移启动程序
如果一切顺利,请认为自己很幸运,然后转到步骤5。
如果在步骤3发生错误,则为:Error: missing password, required for connect
,还有更多工作要做。
kong check
[error] no file at: /etc/kong/kong.conf
。在目录kong.conf
中创建一个名为/etc/kong
的文件,然后将https://github.com/Kong/kong/blob/master/kong.conf.default中可用的内容粘贴。kong.conf
中的凭据。[在此步骤上创建文件并进行编辑可能会遇到麻烦。]
运行命令
sudo kong start
验证正确的配置。打开浏览器并导航至http://localhost:8001
。如果打开某些页面,则表明您的设备上已正确配置KONG。返回终端,然后使用命令停止KONG
sudo kong stop