ubuntu18.04 Installing MongoDB 4.0

Source: Internet
Author: User
Tags install mongodb mongodb mongodb server openssl openssl version

STEP 1: Enter the GPK code in the terminal

$ sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv 9da31620334bd75d9dcb49f368818c72e52529d4

STEP 2: Add a MongoDB source

Ubuntu 18.04 LTS:

$ echo "Deb [ARCH=AMD64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Multiverse" | sudo tee/etc/apt/sources.list.d/mongodb.list

Ubuntu 16.04 LTS:

$ echo "Deb [arch=amd64,arm64] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Multiverse" | sudo tee/etc/apt/sources.list.d/mongodb.list

STEP 3:install MongoDB Server

$ sudo apt update

$ sudo apt install mongodb-org

You can also install the specified version of MongoDB directly

$ sudo apt install mongodb-org=4.0.1 mongodb-org-server=4.0.1 mongodb-org-shell=4.0.1 mongodb-org-mongos=4.0.1 mongodb-org-tools=4.0.1

STEP 4: Management of the MONGODB server

$ sudo systemctl enable Mongod

$ sudo systemctl start Mongod

STEP 5: Verify mongoDB4.0

$ Mongod--version

DB version v4.0.1 git VERSION:54F1582FC6EB01DE4D4C42F26FC133E623F065FB

OpenSSL Version:openssl 1.1.0h Mar 2018

Allocator:tcmalloc

Modules:none

Build Environment:

distmod:ubuntu1804

Distarch:x86_64

Target_arch:x86_64

Step 6: Build a library test

$ MONGO

> Use mydb;

> Db.test.save ({tecadmin:100})

> Db.test.find ()

{"_id": ObjectId ("52b0dc8285f8a8071cbb5daf"), "Tecadmin": 100}

ubuntu18.04 Installing MongoDB 4.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.