YAPI在Ubuntu16.04的安装

/ Linux服务安装搭建 / 没有评论 / 657浏览

环境

Linux 16.04

node 新版本

Mongodb 启动 默认配置就可以

install style

UI and Commandline

install yapi

root@paa4:~#  npm install -g yapi-cli --registry https://registry.npm.taobao.org

/usr/local/nodejs/bin/yapi -> /usr/local/nodejs/lib/node_modules/yapi-cli/bin/yapi-cli
/usr/local/nodejs/bin/yapi-cli -> /usr/local/nodejs/lib/node_modules/yapi-cli/bin/yapi-cli
······

Link

root@paa4:~#  ln -s /usr/local/nodejs/bin/yapi /usr/sbin/yapi
root@paa4:~#  ln -s /usr/local/nodejs/bin/yapi-cli /usr/sbin/yapi-cli
root@paa4:~#  chmod +x /usr/sbin/yapi /usr/sbin/yapi-cli

mongo db setting

> use admin   #切换到admin数据库
switched to db admin
#创建dba用户
> db.createUser(
{
user: "dbuser",
pwd: "dbpasswd",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
#创建yapi数据库
> use yapi
switched to db yapi
#给yapi数据库添加test1用户,权限为读写
> db.createUser(
{
user: "user1",
pwd: "user1passwd",
roles: [
{ role: "readWrite", db: "yapi" }  
]
}
)

web ui setting

http://192.168.0.168:9090

web ui start install

稍等一会

会出现以下提示

依赖库安装完成,正在初始化数据库mongodb...
> yapi-vendor@1.5.6 install-server /opt/mongodb/my-yapi/vendors > node server/install.js
log: mongodb load success...
初始化管理员账号成功,账号名:"admin@admin.com",密码:"ymfe.org"
部署成功,请切换到部署目录,输入: "node vendors/server/app.js" 指令启动服务器, 然后在浏览器打开 http://127.0.0.1:3000 访问

run

root@paa4:/opt/mongodb/my-yapi# node vendors/server/app.js
log: 服务已启动,请打开下面链接访问:
http://127.0.0.1:3000/
log: mongodb load success...
(node:30664) DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead.

http://192.168.0.168:3000/

Have fun ~