Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a specific version of MongoDB?

Tags:

mongodb

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.

like image 409
doubledherin Avatar asked Oct 03 '16 02:10

doubledherin


People also ask

How do I know if MongoDB is installed Ubuntu?

MongoDB installs as a systemd service, which means that you can manage it using standard systemd commands alongside all other sytem services in Ubuntu. To verify the status of the service, type: sudo systemctl status mongodb.


1 Answers

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
like image 133
Ruslan Kurkebayev Avatar answered Oct 11 '22 20:10

Ruslan Kurkebayev