Server environment:

  • 1 the nuclear 2 g
  • 40 gb hard disk
  • centos7.6
  •  1Mbps

Install the docker

  1. download

    yum install docker
    Copy the code

    Update the yum source if you have problems

    yum -y update
    Copy the code

  2. Start and set to boot

    systemctl start docker.service
    systemctl enable docker.service
    Copy the code

  3. View the Docker version

    docker version
    Copy the code

    If the following figure is displayed, the installation is successful

Install the docker compose

  1. Update the curl

    yum update curl
    Copy the code

  2. download

    Sudo curl -l https://github.com/docker/compose/releases/download/1.20.0/docker-compose- ` ` uname - s - ` uname -m ` - o /usr/local/bin/docker-composeCopy the code

    Due to the speed of the network, if too slow please use the following method

  3. The installation

    chmod +x /usr/local/bin/docker-compose
    Copy the code

  4. Check out the Docker Compose version

    docker-compose version
    Copy the code

The second way

  1. Install the PIP

    yum -y install epel-release
    yum -y install python-pip
    Copy the code

  2. View PIP version

    pip --version
    Copy the code

  3. Update the PIP

    pip install --upgrade pip
    Copy the code

  4. Install the docker – compose

    pip install docker-compose 
    Copy the code

  5. Check out the Docker Compose version

    docker-compose version
    Copy the code

Install nodejs

Just follow the orders in turn

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - sudo yum -y install nodejs sudo yum install Nodejs NPM --enablerepo=epel # Error getting repository data for epel, repository not found https://www.cnblogs.com/zhuminghui/p/12102122.html sudo yum install gcc-c++ makeCopy the code

Install mogodb

Edit the file

Vi/etc/yum. Repos. D/mongo - org - 3.4. RepoCopy the code

Add the following

[mongo - org - 3.4] name = directing a Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ gpgcheck = 1 enabled = 1 gpgkey=https://www.mongodb.org/static/pgp/server-3.4.ascCopy the code

Run the following command to install it

yum install -y mongodb-org
Copy the code

If the network speed is slow, press CTRL+C to exit and run the installation command again. The speed will be faster and the download progress will continue

Configuring remote Links

vi /etc/mongod.conf
Copy the code

Modify the bind_IP of the configuration file. The default is 127.0.0.1 for local connections only. So change this to 0.0.0.0 after installation to allow all links!

Start and stop mongodb

Service start mongod start # service mongod stop # close ps - ef | grep mongod # to check the mongo processCopy the code

Start-up success

Install Git

yum install -y git

git --version
Copy the code

Install Yapi

npm install -g yapi-cli --registry https://registry.npm.taobao.org

yapi server
Copy the code

An address + port appears after the installation

For a cloud server, check whether port 9090 and port 3000 are available in the security group. Port 3000 will be available later

I’ll just change the IP to the server’s extranet IP. Let’s see

Just fill in the name of your company and click start deployment. Wait for the end

When the installation is complete, you will be told the password of the administrator account. Remember the password and start yAPI as it says

Go to the YAPI deployment directory first

cd /root/my-yapi
Copy the code

Execute startup command

node vendors/server/app.js
Copy the code



Visit IP +3000 port and see

If the deployment is successful, log in using the administrator account

The problem

If the window link is closed after yAPI is started, the service will also be closed, causing a bug problem, which requires us to use crontab timing task. This problem can be solved by scheduling task execution

Editing a Scheduled Task

crontab -e
Copy the code

Add the following

0 17 * * * nohup node /root/my-yapi/vendors/server/app.js >/dev/null 2>&1 &
0 1 * * * nohup node /root/my-yapi/vendors/server/app.js >/dev/null 2>&1 & 
Copy the code

Save and wait for execution