MongoDB4.0 Installation Guide

First, the environment

operating system Installation package Mounting
Ubuntu18.04 mongodb4.0 apt installation
Ubuntu18.04 mongodb4.0 docker installation

Two, apt installation

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] http://mirrors.aliyun.com/mongodb/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
deb [ arch=amd64 ] http://mirrors.aliyun.com/mongodb/apt/ubuntu bionic/mongodb-org/4.0 multiverse
sudo service mongod start
ps aux | grep mongod

Three, docker installation

docker pull mongo:4
docker run -p 27017:27017 -v $PWD/db1:/data/db -d mongo:4

-P port used to map 27017 to a host of the container port 27017;
use the -v db host file folder mount the current path to the container, the persistent data to the host.

Guess you like

Origin blog.51cto.com/13120271/2448402