Reputation: 313
I followed official guide to install, but I got below error, when I check for status.
Active: failed (Result: core-dump) since
Upvotes: 0
Views: 3028
Reputation: 313
First remove previously installed files related to Mongodb
sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
After multiple install and uninstall I found the issue, with official guide, as of 13/08/2021 it does not have information on 21.04, but if you check in the command their only one thing is changing that is codename, 20.04 has focal, 18.04 bionic same way 21.04 has "hirsute"
you can check this by typing in terminal "lsb_release -dc"
command with correct codename
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu hirsute/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get install -y mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod
run the able commands in order.
Upvotes: 2
Reputation: 29
This works for me!
curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | \
sudo tee /etc/apt/trusted.gpg.d/mongodb.asc > /dev/null
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
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod
Upvotes: 3
Reputation: 11
Currently you can follow the installation guide for 20.04, except for Step 1 - Import Public Key use the following instead:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb.asc > /dev/null
Upvotes: 0
Reputation: 1
I installed like Harish suggested but left it with Focal when creating the apt source list instead of Hirsute. Got same error as OP. Looked at /var/log/mongodb, noticed no mongod.log had been created so I created mongod.log file under /var/log/mongodb, then changed the owner to mongodb for mongod.log, restarted the service for mongod and it worked.
sudo touch /var/log/mongodb/mongod.log
sudo chown mongodb:mongodb /var/log/mongodb/mongod.log
sudo systemctl restart mongod.service
sudo systemctl status mongod.service
Upvotes: 0