sudo yum clean all
yum remove nodejs npm -y
curl -sL https://rpm.nodesource.com/setup_8.x | bash -
sudo yum install -y nodejs
[root@VM-48-4-centos my-yapi]# node -v
v8.17.0
[root@VM-48-4-centos my-yapi]# npm -v
6.13.4
yum install -y git
vi /etc/yum.repos.d/mongodb-org-4.0.repo
,添加内容如下:[ngodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/4.0/x86_64/
gpgcheck=0
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
yum install -y mongodb-org
[root@VM-48-4-centos my-yapi]# rpm -ql mongodb-org-server
/etc/mongod.conf # 配置文件
/lib/systemd/system/mongod.service
/usr/bin/mongod
/usr/share/doc/mongodb-org-server-4.0.24
/usr/share/doc/mongodb-org-server-4.0.24/LICENSE-Community.txt
/usr/share/doc/mongodb-org-server-4.0.24/MPL-2
/usr/share/doc/mongodb-org-server-4.0.24/README
/usr/share/doc/mongodb-org-server-4.0.24/THIRD-PARTY-NOTICES
/usr/share/man/man1/mongod.1
/var/lib/mongo
/var/log/mongodb
/var/log/mongodb/mongod.log
/var/run/mongodb
vim /etc/selinux/config
,将SELINUX=enforcing
改为SELINUX=disabled
# 设置开机启动
systemctl enable mongod
# 启动mongodb
systemctl start mongod
# 查看服务状态
systemctl status mongod
npm install -g yapi-cli --registry https://registry.npm.taobao.org
yapi server
命令,按提示操作[root@VM-48-4-centos ~]# yapi server
在浏览器打开 http://0.0.0.0:9090 访问。非本地服务器,请将 0.0.0.0 替换成指定的域名或ip
npm install -g pm2 --registry=https://registry.npm.taobao.org
# 例如:yapi是安装在/usr/local/yapi/
# 启动执行:
pm2 start /usr/local/yapi/vendors/server/app.js
# 关闭执行:
pm2 stop /usr/local/yapi/vendors/server/app.js
YApi的升级非常容易,且不会影响用户的数据,只会更新vendors目录
# 更新到最新版本
yapi update
# 升级到指定的版本
yapi update -v {Version}