Local building easy-mock

Original link: https://www.cnblogs.com/lasdaybg/p/9767117.html

 


easy-mock use nodejs start, you need to install nodejs

ubuntu system: 
APT install the Node 
CentOS systems: 
curl --silent --location HTTPS: // rpm.nodesource.com/setup_8.x | bash - 
yum  install the Node

 

and easy-mock dependent mongo redis, need to ensure that the server has mongo and redis, may be mounted by way of docker

Installation docker

ubuntu system: 
APT install docker.io 
CentOS system: 
yum  install Docker

 

Install mongo

docker pull mongo
docker run --name mongo -p 27017:27017 -d mongo

 

Install redis

docker pull redis
docker run --name redis -p 6379:6379 -d redis

 

easy-mock code on github, need to install the tool for pulling the code git

ubuntu system: 
APT install git 
CentOS system: 
yum  install git

 

From github easy-mock codes will pull down

cd /home
git clone https://github.com/easy-mock/easy-mock.git

After running the code is downloaded to the / home / easy-mock directory

Download npm related libraries

cd /home/easy-mock
npm install

 

Use easy-mock node directly run there is a problem, easy-mock is running in the foreground, if the session quit, the process will quit. In order to ensure that the process has been able to run, you can use pm2 background to start the process.
Installation pm2

npm install pm2 -g

 

Start easy-mock

cd /home/easy-mock
pm2 start app.js

 

 


easy-mock use nodejs start, you need to install nodejs

ubuntu system: 
APT install the Node 
CentOS systems: 
curl --silent --location HTTPS: // rpm.nodesource.com/setup_8.x | bash - 
yum  install the Node

 

and easy-mock dependent mongo redis, need to ensure that the server has mongo and redis, may be mounted by way of docker

Installation docker

ubuntu system: 
APT install docker.io 
CentOS system: 
yum  install Docker

 

Install mongo

docker pull mongo
docker run --name mongo -p 27017:27017 -d mongo

 

Install redis

docker pull redis
docker run --name redis -p 6379:6379 -d redis

 

easy-mock code on github, need to install the tool for pulling the code git

ubuntu system: 
APT install git 
CentOS system: 
yum  install git

 

From github easy-mock codes will pull down

cd /home
git clone https://github.com/easy-mock/easy-mock.git

After running the code is downloaded to the / home / easy-mock directory

Download npm related libraries

cd /home/easy-mock
npm install

 

Use easy-mock node directly run there is a problem, easy-mock is running in the foreground, if the session quit, the process will quit. In order to ensure that the process has been able to run, you can use pm2 background to start the process.
Installation pm2

npm install pm2 -g

 

Start easy-mock

cd /home/easy-mock
pm2 start app.js

 

Guess you like

Origin www.cnblogs.com/chengquanomg/p/12054158.html