How to install MongoDB 7.0 on Ubuntu 20.04 and 22.04

From PheonixSolutions
Jump to navigation Jump to search

How to install MongoDB 7.0 on Ubuntu 20.04 and 22.04

Introduction:
MongoDB 7.0 is the MongoDB database's latest major release, a NoSQL database system. In version 7.0, MongoDB has introduced several improvements in migrations, performance, developer experience, and security. Notably, it features Queryable Encryption, which allows for the encryption of sensitive workloads and the ability to query encrypted data. Performance enhancements include an advanced query execution strategy and faster chunk migrations for sharded clusters.
Prerequisite:
1. Server root login credentials.
Step 1:
Log in to your Ubuntu or Centos server as a user with sudo privileges. You can use SSH or directly access the server.

 ssh root@Ip

Step 2:

Before we start on anything, update your APT package index:

 sudo apt update -y

Install all the required packages:

sudo apt install wget curl gnupg2 software-properties-common apt-transport-https ca-certificates lsb-release vim

Step 3:

Next, import the GPG key for the MongoDB 7.0 repository:

 curl -fsSL https://pgp.mongodb.com/server-7.0.asc |sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-server-7.0.gpg

Now add the MongoDB 7.0 Repo on Ubuntu 20.04 & 20.04:

 echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

Step 4:

Once the repository has been added, update your package index.

 sudo apt update

Install MongoDB 7.0 using the command:

 sudo apt install mongodb-org

Step 5:

Start and enable the service:

 sudo systemctl enable --now mongod

Verify the mongod status.

 systemctl status mongod

Step 6:

Verify the installed MongoDB version:

 mongod --version