Skip to content

Instantly share code, notes, and snippets.

@Kumawatlalit912
Created January 31, 2023 05:07
Show Gist options
  • Save Kumawatlalit912/8483ebf6c1279fde1c3d6f4f7a4b4b75 to your computer and use it in GitHub Desktop.
Save Kumawatlalit912/8483ebf6c1279fde1c3d6f4f7a4b4b75 to your computer and use it in GitHub Desktop.
How to install mongodb in linux machine
1 - Uninstall current installation completely
Source - official instructions
sudo service mongod stop
Remove Packages
sudo apt-get purge mongodb-org*
Remove the folders
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
2 - Reinstall as described on official site, I will just write down the all steps. enter link description here
Import the public key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
Create a list file for Ubuntu 16.04
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
update the list
sudo apt-get update
Install the latest package
sudo apt-get install -y mongodb-org
3 - Now it should work, please try below command
sudo service mongod start
sudo apt install mongodb-clients
and check the status
mongo
it should appear the mongo shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment