Wednesday, September 15, 2021

Install MongoDB in ubuntu

 when you take a specific version of MongoDB, it does not support all the operating systems as a whole.

1. So we need to check the compatibility before.

2. Once find out the correct version suitable for your OS, you can start installing


Below are short steps to install mongo in Ubuntu 18.04 Bionic version.

1. Import the public key used by the package management system.

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -


2. Create a list file for MongoDB

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

3. Reload local package database

sudo apt-get update

4.Install the MongoDB packages

sudo apt-get install -y mongodb-org

5. Start MongoDB service

 before start service, check whether linux use "systemd" or "init" --> run below

ps --no-headers -o comm 1

to run mongodb

sudo systemctl start mongod

6. Add mondb service to start at restart

sudo systemctl enable mongod


For more info, you can follow

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

No comments:

Post a Comment