Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading mongodb has no effect and still shows the old version

Tags:

mongodb

ubuntu

Following are the commands which I used to upgrade my mongodb version from 2.6.9 to latest, but its still showing me the previous version. Let me know what I am doing wrong with the upgrading process. The problem is that mongod -version still shows the old version installed after upgrade.

Docs which I refer to - Mongodb Docs

Steps I followed -

  • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
  • echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
  • sudo apt-get update
  • sudo apt-get install -y mongodb-org

Result -

Reading package lists... Done Building dependency tree        Reading state information... Done The following packages will be upgraded:   mongodb-org 1 upgraded, 0 newly installed, 0 to remove and 139 not upgraded. Need to get 3,608 B of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://repo.mongodb.org/apt/ubuntu/ trusty/mongodb-org/3.0/multiverse mongodb-org amd64 3.0.2 [3,608 B] Fetched 3,608 B in 0s (18.3 kB/s)       (Reading database ... 298790 files and directories currently installed.) Preparing to unpack .../mongodb-org_3.0.2_amd64.deb ... arg: upgrade Unpacking mongodb-org (3.0.2) over (2.6.9) ... Setting up mongodb-org (3.0.2) ... 

After this I re started the service - sudo service mongod restart

But still its showing me version 2.6.9 Let me know what I am doing wrong here..or missed any step ?

like image 536
swapnesh Avatar asked May 02 '15 06:05

swapnesh


People also ask

How do I upgrade MongoDB 4 to 5?

To upgrade an existing MongoDB deployment to 5.0, you must be running a 4.4-series release. To upgrade from a version earlier than the 4.4-series, you must successively upgrade major releases until you have upgraded to 4.4-series.


1 Answers

I'm in the exact same situation, followed the exact same steps, and had the same issue.

What worked for me was:

Uninstalling:

sudo service mongod stop sudo apt-get purge mongodb-org* 

Do NOT remove data directories - all your data will be lost if you do.

Note: Calling sudo apt-get purge mongodb-org* deletes the mongod.conf file. In case you want to keep this file after the update, make sure you create a backup copy of it and use it after the new version has been installed.

Then install mongodb with:

sudo apt-get install -y mongodb-org 

This assumes that you've already performed the previous installation steps (importing the public key, creating a list file, reloading local package database) as you've stated.

like image 105
Lior Avatar answered Oct 11 '22 01:10

Lior