安装PostgreSQL、KONG和KONGA

提示:Redhat 的yum命令需要先注册收费才能使用,

使用CentOS。进入CentOS官方网站 http://www-centos-org,下载。

DVD ISO:此镜像类型为普通光盘安装版,可离线安装到计算机硬盘上,包含大量的常用软件,一般选择这种镜像类型即可。

Everything ISO:这个镜像涵盖了上种镜像的内容,并对其进行补充,集成了所有软件。

Minimal ISO:这个版本为精简版的镜像,可以安装一个基本的CentOS系统,包含了可启动系统基本所需的最小安装包。

具体方法百度。

 

先安装PostgreSQL

https://www.postgresql.org/download/linux/redhat/,选择

rpm -qa | grep postgres    检查PostgreSQL 是否已经安装
rpm -qal | grep postgres   检查PostgreSQL 安装位置

备注:

service postgresql-9.6 initdb  #初始化
chkconfig postgresql-9.6 on   #设置开机自启动
service postgresql-9.6 start | restart  #启动服务

查看是否安装成功

netstat -tlun | grep 5432  #postgres是占用5432端口

添加一个新用户kong,postgres数据库默认超级用户为 postgres

su - postgres
psql 
CREATE USER kong; 
CREATE DATABASE kong OWNER kong;
ALTER USER kong WITH password 'kong';

修改postgres的客户端身份验证配置文件 重要:没有此操作,对KONG迁移报错: FATAL: Ident authentication failed for user "kong"

    vim /var/lib/pgsql/9.4/data/pg_hba.conf #打到文件的第80行和82行
    local all all md5  #修改local
    host all all 127.0.0.1/32 md5 #修改ipv4

瞎几把配,服务会启不起来(系统重启后)

修改postgres的主配置文件

vim /var/lib/pgsql/9.4/data/postgresql.conf #找到第57行
listen_addresses = '*'  #将localhost改成*就可以进行远程访问了

 记得执行  service postgresql-9.6 restart

二、安装KONG

官网下载https://docs.konghq.com/install/centos/?_ga=2.192638253.666129234.1538985937-846677731.1538985937

直接下的CentOS6的包,放到系统安装。

前面已经配了数据库和用户。

修改kong的主配置文件

cd /etc/kong  #默认kong会创建一个kong.conf.default的配置文件
cp kong.conf.default kong.conf #复制默认的文件
vim kong.conf #编辑此配置文件,找到第287以下的行
pg_host = 127.0.0.1  #设置postgres数据库的连接地址
pg_port = 5432 #设置postgres数据库的端口
pg_user = kong  #设置postgres数据库的用户
pg_password = kong #设置postgres数据库的密码
pg_database = kong #设置postgres数据库的名称
pg_ssl = off  #设置kong和postgres的连接方式
pg_ssl_verify = off

运行Kong迁移

kong migrations up [-c /path/to/kong.conf]
或者
kong migrations up -c /etc/kong/kong.conf

注意:永远不应同时运行迁移; 只有一个Kong节点应该一次执行迁移。

启动KONG

kong start [-c /path/to/kong.conf]
或者
kong start|restart|stop #启动的命令

检查kong是否安装成功

curl -i http://localhost:8001/
或者
curl 127.0.0.1:8001  #也可以用浏览器访问:ip:8001 

 

三、安装KONGA

安装nodejs和git,nodejs看另一文章,版本>=8,git运行

Centos下使用:yum install git -y  或者  yum install -y git

Ubuntu/Debian下使用 : apt-get install git -y

需要注意版本,git --version  ,    版本太低的话需要重新下载,否则git  clone时会报错

Initialized empty Git repository in /root/KONGA/konga/.git/
error:  while accessing 
https://github.com/pantsel/konga.git/info/refs

fatal: HTTP request failed

去官网下https://mirrors.edge.kernel.org/pub/software/scm/git/

解压编译安装

cd git-2.0.0
make configure
./configure --prefix=/usr/git ##配置目录
make profix=/usr/git
make install

加入环境变量

echo "export PATH=$PATH:/usr/git/bin" >> /etc/profile
source /etc/profile

完成-检查版本

git --version 
git version 2.0.0

-----------

安装KONGA,安装依赖

yum -y install nodejs npm
npm install -g gulp
npm install -g bower
npm install -g sails

安装konga

git clone https://github.com/pantsel/konga.git
cd konga
npm install konga

此时可能会报错

Cloning into 'konga'...
fatal: unable to access 'https://github.com/pantsel/konga.git/': SSL connect error

升级了git版本后git clone报SSL错误,执行 yum update -y nss curl libcurl

配置

# 示例配置位置
/config/local_example.js

# 拷贝一份
cd ./config/
cp local_example.js ./local.js

# 配置默认数据库
vi ./local.js
models: {
    connection: process.env.DB_ADAPTER || 'localDiskDb',
},
# 改成
models: {
    connection: process.env.DB_ADAPTER || 'mysql', // 这里可以用‘mysql’,‘mongo’,‘sqlserver’,‘postgres’
},
# 保存

# 修改数据库默认配置
vi connections.js
mysql: {
    adapter: 'sails-mysql',
    host: process.env.DB_HOST || 'localhost',
    port: process.env.DB_PORT || 3306,
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || null,
    database: process.env.DB_DATABASE || 'konga_database'
},
# 改成
mysql: {
    adapter: 'sails-mysql',
    host: process.env.DB_HOST || 'localhost',
    port: process.env.DB_PORT || 3306,
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || 'root',
    database: process.env.DB_DATABASE || 'konga_database'
},
# 保存

# 创建数据库
mysql -uroot -proot // 这里不建议用明文密码
CREATE DATABASE konga_database CHARACTER SET utf8 COLLATE utf8_general_ci;

# 启动
cd ../
npm start

error: Incompatible Node.js version. Please make sure that you have Node.js >= 8 installed.

node版本太低,换8以上。

启动后可能会报错,

No DB Adapter defined. Using localDB...
error: ** Grunt :: An error occurred. **
error: 
运行npm install sails-postgresql 报错,权限问题,

执行npm install --unsafe-perm=true --allow-root sails-postgresql

 

浏览器输入 localhost:1338,端口可以在local.js改
默认登录名admin,密码是三个admin
配置kong API地址要填写完整地址,后面不要带‘/’

 

 

1. Getting blank page with Uncaught ReferenceError: angular is not defined

In some cases when running npm install, the bower dependencies are not installed properly. You will need to cd into your project's root directory and install them manually by typing

$ npm run bower-deps

2. Can't add/edit some plugin properties.

When a plugin property is an array, the input is handled by a chip component. You will need to press enter after every value you type in so that the component assigns it to an array index. See issue #48 for reference.

3. EACCES permission denied, mkdir '/kongadata/'.

If you see this error while trying to run Konga, it means that konga has no write permissions to it's default data dir /kongadata. You will just have to define the storage path yourself to a directory Konga will have access permissions via the env var STORAGE_PATH.

4. The hook grunt is taking too long to load

The default timeout for the sails hooks to load is 60000. In some cases, depending on the memory the host machine has available, startup tasks like code minification and uglyfication may take longer to complete. You can fix that by setting then env var KONGA_HOOK_TIMEOUT to something greater than 60000, like 120000.

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值