Mongodb is a widely used document oriented NoSQL database management system. Mongodb uses json like format called BSON ( Bianary Json) and it stores data in a collection of documents rather than storing in a table. Mongodb is designed in that way, it can be scaled and performed in an optional lavel and that became a choice for many large scale applications.
Mongodb is used in many web and mobile applications and here are the steps to install mongodb in ubuntu system 22.04,
step 1 : Import the MongoDB public GPG key:
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
step 2 : Create a file for mongoDB
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
step 3: Reload the package database
sudo apt-get update
Step 4: Install MongoDB Community Edition
sudo apt-get install -y mongodb-org
Step 5: Start mongoDB
sudo systemctl start mongod
you can also enable automatic start of mongoDB on boot by using this command
sudo systemctl enable mongod
Troubleshoot : While you are going to start mongoDB you might see this message,
MongoDB Install Fails on Ubuntu 22.04 - Depends on libssl1.1 but it is not installable
as Ubuntu 22.04 has upgraded libssl to 3 and does not propose libssl1.1. as MongoDb has no official build for ubuntu 22.04. To overcome this issue ubuntu 22.04 installed in your system need to force the installation of libssl1.1 by adding the ubuntu 20.04 source:
step 1:
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
Sep 2: Now again run the same previosly used command to install mongodb,
sudo apt-get install -y mongodb-org
now delete the focal-security list file you just created,
sudo rm /etc/apt/sources.list.d/focal-security.list
Now you you can start mongoDB in your system using command,
sudo systemctl start mongod
and it will start working fine in your sytem.
Top comments (0)