I installed mongodb-org 5.0.2 as per official documentation
Codes i used to install via Terminal given below:
1.wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
2.echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
3.sudo apt-get update
4.sudo apt-get install -y mongodb-org
After installation i started using
sudo systemctl start mongod
if I use mongod --version
command it shows :-
Illegal instruction (core dumped)
Stop the mongod
process by issuing the following command:-
sudo service mongod stop
Remove any MongoDB packages that you had previously installed:-
sudo apt-get purge mongodb-org*
Remove MongoDB databases and log files:-
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
Then reinstall MongoDB 4.4.x
Import the public key used by the package management system:-
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
The following instruction is for Ubuntu 20.04 (Focal):-
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
Update Apt
sudo apt-get update
Install MongoDB 4.4.x (Now available 4.4.15)
sudo apt-get install -y mongodb-org=4.4.15 mongodb-org-server=4.4.15 mongodb-org-shell=4.4.15 mongodb-org-mongos=4.4.15 mongodb-org-tools=4.4.15
Use mongod --version
to check if it is successfully installed
If you encounter any error while using mongod
sudo mkdir /data
cd /data
sudo mkdir db
sudo pkill -f mongod
Then use sudo mongod
command.
After long research, it is now working totally fine thanks to this community and Internet.
EDIT:
After following above steps:
if below error occurs:
mongod.service: Failed with result 'exit-code'.
then remove below files and start mongod
service again.
sudo rm -rf /tmp/mongodb-27017.sock
sudo service mongod start