yapi的部署和安装

安装Node.js环境

wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz

或者直接浏览器下载传输到服务器上。

复制代码
https://nodejs.org/zh-cn/download/

tar -xvf node-v14.15.4-linux-x64.tar.xz

太高版本不行,install会报错。16开头的。

配置环境变量

在profile中设置:

vim ~/.bash_profile

复制代码
#node.js
export NODE_HOME=/realtime/liaoxg/software/nodejs/node-v14.15.4-linux-x64
export PATH=$PATH:$NODE_HOME/bin

source ~/.bash_profile

export是设置环境变量,不用则是bash变量,前者可传输到子进程,后者则不行。

验证

复制代码
[appuser@host nodejs]npm -v
6.14.10
[appuser@host nodejs]node -v
v14.15.4

npm加速

npm config set registry https://registry.npmmirror.com/

验证:

npm config get registry

安装

直接安装:

复制代码
npm install -g yapi-cli --registry https://registry.npm.taobao.org
yapi server

离线安装

核心要义在有网络的机器上装好再打包,而不是在离线机器上安装。网上些都没说清楚这一点。

不过内网连不上,采用命令行部署:

在windows下下载项目再传到linux上:

复制代码
git clone https://github.com/YMFE/yapi.git vendors

直接用这个老哥的可以:https://blog.csdn.net/w139074301/article/details/117357013

用低版本的node.js和安装包。

复制代码
unzip vendors.zip 
bash 复制代码
cp vendors/config_example.json ./config.json //复制完成后请修改相关配置

npm install --production 

yapi的config.json

config 复制代码
{
  "port": "3000",
  "adminAccount": "admin@admin.com",
  "timeout":120000,
  "db": {
    "servername": "YOUR IP ADDR",
    "DATABASE": "yapi",
    "port": 27017,
    "user": "yapi",
    "pass": "yapi",
    "authSource": ""
  },
  "mail": {
    "enable": true,
    "host": "smtp.163.com",
    "port": 465,
    "from": "***@163.com",
    "auth": {
      "user": "***@163.com",
      "pass": "*****"
    }
  }
}

yapi-vendor@1.8.5 install-server /realtime/software/yapi/vendors

node server/install.js

(node:20720) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

log: mongodb load success...

初始化管理员账号成功,账号名:"admin@admin.com",密码:"ymfe.org"

后台启动:

nohup node /realtime/software/yapi/vendors/server/app.js >> /realtime/software/yapi/log/webStart.log&

nohup node /cdoc/ dcop//yapi/vendors/server/app.js >> /cdoc/ dcop//yapi/log/webStart.log&

访问地址:部署ip:3000端口,默认的管理员用户名/密码:admin@admin.com/ymfe.org

相关推荐
色空大师2 天前
【Linux-安装nginx】
linux·运维·前端·nginx·部署
bingyan03715 天前
openclaw-基于ubuntu24安装部署
ubuntu·部署·openclaw
bingyan03716 天前
itop3-基于rockylinux8的itsm工具安装部署
部署·itsm·itop·rockylinux8
色空大师8 天前
【java打包方式详解】
java·开发语言·部署·打包·启动脚本·jar包分离
羊小猪~~11 天前
LLM--大模型快速展示(Gradio)
人工智能·python·大模型·llm·部署·gradio·ai算法
comedate12 天前
[OpenClaw] OpenWebUI 的部署指南
部署·openwebui·openclaw
维度攻城狮19 天前
Docker 部署 Dify,快速私有化搭建专属知识库问答
人工智能·docker·部署·dify·知识问答
快乐得小萝卜20 天前
Lss-bev系列-2-部署插件IndexPut
ai·部署·bev·lss
cooldream200920 天前
Windows11中 WSL2全方位安装与实战指南
linux·部署·wsl
vpk11225 天前
Docker Compose 部署 Yapi(连接本地MongoDB)
mongodb·docker·yapi