20

I have yet to find a solution to the problem of installing a specific release of MongoDB. I've found several SO posts and other resources, to no avail. The official docs say:

sudo apt-get install -y mongodb-org=3.0.12 mongodb-org-server=3.0.12 mongodb-org-shell=3.0.12 mongodb-org-mongos=3.0.12 mongodb-org-tools=3.0.12

But I get error messages saying those versions are not found. I've tried previous versions as well, but I get the same error output.

4 Answers 4

24

Refer to Official mongodb administration 'Install on linux' documentation.

Example for Ubuntu

add repo list file

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10  
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update

Install mongo package

sudo apt-get install -y mongodb-org=3.0.12 mongodb-org-server=3.0.12 mongodb-org-shell=3.0.12 mongodb-org-mongos=3.0.12 mongodb-org-tools=3.0.12

Prevent upgrading mongodb version (optional)

Do it only if you don't want to accidentally upgrade mongo with apt-get

echo "mongodb-org hold" | sudo dpkg --set-selections &&
echo "mongodb-org-server hold" | sudo dpkg --set-selections &&
echo "mongodb-org-shell hold" | sudo dpkg --set-selections &&
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections &&
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
Sign up to request clarification or add additional context in comments.

1 Comment

what is the purpose of "add repo list file" ? What is "repo list file" ?
9
  1. go to the guide page.

  2. switch the version you want at left side menu bar. enter image description here

  3. follow the guide of that version on page, then it's done.

Comments

2

Well, I think it's not recommend to install previous version package by package manager like apt or yum, which may break package dependency relation.

MongoDB legacy version (tgz package for all linux distributions) can be a good choice.

All legacy history package can be found here:

https://www.mongodb.org/dl/linux/x86_64

You can install some legacy version by:

wget -c "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-A.B.C.tgz"

just replace A.B.C with the version you want to install.

unpack it:

tar -zxvf mongodb-linux-x86_64-A.B.C.tgz

run mongodb server:

'./mongodb-linux-x86_64-A.B.C/bin/mongod'

Comments

1

Before installing, you have to update the list files (repos). Check below link for more

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.