问题
I'm using the cloud9 IDE and I'm trying to connect through the mongo shell to a mongodb instance running on mongolab. Mongolab now runs mongodb version 3.0 but cloud9 has version 2.6 installed.
I've tried following the instructions on the mongodb website for installing on ubuntu 14.04 using the mongodb binaries, and although all of the commands it instructed me to use were executed without errors, I didn't understand exactly what was happening, and when I checked the mongodb version with mongod --version
it still said I was running the old version - 2.6.10
Can someone explain the steps to uninstall the old version and install the new version of mongodb in cloud9?
回答1:
The first thing you have to do is to remove the existing mongodb:
sudo apt-get remove mongodb* --purge
Then we can follow instructions from MongoDB docs.
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
sudo apt-get install -y mongodb-org
I hope this helps.
来源:https://stackoverflow.com/questions/33204739/how-to-delete-an-old-version-of-mongodb-and-install-the-new-one-in-cloud9-ide