centos7安装Kong

安装配置

安装kong

 #1.5.1版本安装

 cat > /etc/yum.repos.d/kong.repo <<EOT

[kong]
baseurl=https://kong.bintray.com/kong-rpm/centos/7
gpgcheck=0

EOT


yum install epel-release

yum install kong-1.5.1

安装postgresql

安装postgresql

可以从postgresql下载地址下载安装

#Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install the client packages:
yum install postgresql95

# Optionally install the server packages:
yum install postgresql95-server

#Optionally initialize the database and enable automatic start:

/usr/pgsql-9.5/bin/postgresql95-setup initdb
systemctl enable postgresql-9.5
systemctl start postgresql-9.5

配置 postgresqlkong

  • /var/lib/pgsql/9.5/data/postgresql.conf 中的listen_addresses 注释去掉,并将127.0.0.1改成*,同时将port = 5432注释去掉。
  • 修改/var/lib/pgsql/9.5/data/pg_hba.conf中的ident,将其换成trust
  • 然后重启 systemctl restart postgresql-9.5
  • 新增kong用户
su - postgres << EOF

psql << XOF

CREATE USER kong; CREATE DATABASE kong OWNER kong;

XOF

EOF
  • 创建配置文件,cp /etc/kong/kong.conf.default /etc/kong/kong.conf,并修改/etc/kong/kong.conf中的内容如下
database = postgres             # Determines which of PostgreSQL or Cassandra
                                 # Accepted values are `postgres`,
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,
pg_user = kong                  # Postgres user.
pg_password = 123456                  # Postgres user's password.
pg_database = kong              # The database name to connect to.
  • 导入kong的数据, kong migrations bootstrap --v
  • 启动kongkong start --conf /etc/kong/kong.conf
  • 检查kong状态,kong health
  • 验证是否启动成功,
curl -I -m 10 -o /dev/null -s -w '%{http_code}\n' http://localhost:8001/
#如果返回的是200,代表启动成功

安装konggui

安装npm

wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz
xz -d node-v10.13.0-linux-x64.tar.xz
tar -xf node-v10.13.0-linux-x64.tar
ln -s ~/node-v10.13.0-linux-x64/bin/node /usr/bin/node
ln -s ~/node-v10.13.0-linux-x64/bin/npm /usr/bin/npm

配置npm

npm set prefix /usr/local
echo -e '\nexport PATH=/usr/local/lib/node_modules:$PATH' >> ~/.bashrc
source ~/.bashrc

安装kong-dashboard

npm install -g kong-dashboard

启动kong-dashboard

kong-dashboard start --kong-url http://localhost:8001

# 自定义端口
kong-dashboard start  --kong-url http://localhost:8001  --port [port]

#使用权限认证启动 Kong Dashboard

kong-dashboard start  --kong-url http://kong:8001  --basic-auth user1=password1 user2=password2

启动的时候可以在后面加上&ctr + c就不会关闭进程了

安装konga

konga 的github地址

#先安装node、npm,然后安装bower、gulp包
npm install -g bower
npm install -g gulp
npm install -g sails
#下载konga
git clone https://github.com/pantsel/konga.git

cd konga

npm i

#安装依赖
npm run bower-deps
npm install dotenv-extended
npm install angular

#配置文件
cp .env_example .env
#修改配置文件
#konga/config/connections.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 || 'postgres', // 这里可以用‘mysql’,‘mongo’,‘sqlserver’,‘postgres’
}

修改连接信息如下:

 postgres: {
    adapter: 'sails-postgresql',
    url: process.env.DB_URI,
    host: process.env.DB_HOST || 'localhost',
    user:  process.env.DB_USER || 'postgres',
    password: process.env.DB_PASSWORD || null,
    port: process.env.DB_PORT || 5432,
    database: process.env.DB_DATABASE ||'konga',
    // schema: process.env.DB_PG_SCHEMA ||'public',
    poolSize: process.env.DB_POOLSIZE || 10,
    ssl: process.env.DB_SSL ? true : false // If set, assume it's true
  },
#同步konga数据到postgresql中
node ./bin/konga.js  prepare --adapter postgres --uri postgresql://localhost:5432/konga
#运行
npm run production

##或者后台运行
npm install pm2 -g
pm2 start app.js --name konga

#访问 http://localhost:1337

访问的前提条件是防火墙已经关闭了

#查看防火墙状态
 firewall-cmd --state

 #停止firewall
 systemctl stop firewalld.service

 #禁止firewall开机启动
 systemctl disable firewalld.service

pm2相关

 #重启
 pm2 restart app.js

 #停止
 pm2 stop app_name|app_id

 #如果要停止所有应用,可以
 pm2 stop all

 #查看进程状态
 pm2 list
暂无评论

发送评论 编辑评论


|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇