How can I uninstall MongoDB and reinstall the latest version?












48















I need to uninstall mongodb completely from my system (Ubuntu 11.10) and install version 2.0.5.



Currently, when I run:



mongo db


I get the following error:




MongoDB shell version: 2.0.1

connecting to: db

Wed Jun 6 13:05:03 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed











share|improve this question

























  • Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

    – jasmines
    Jun 6 '12 at 7:40
















48















I need to uninstall mongodb completely from my system (Ubuntu 11.10) and install version 2.0.5.



Currently, when I run:



mongo db


I get the following error:




MongoDB shell version: 2.0.1

connecting to: db

Wed Jun 6 13:05:03 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed











share|improve this question

























  • Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

    – jasmines
    Jun 6 '12 at 7:40














48












48








48


18






I need to uninstall mongodb completely from my system (Ubuntu 11.10) and install version 2.0.5.



Currently, when I run:



mongo db


I get the following error:




MongoDB shell version: 2.0.1

connecting to: db

Wed Jun 6 13:05:03 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed











share|improve this question
















I need to uninstall mongodb completely from my system (Ubuntu 11.10) and install version 2.0.5.



Currently, when I run:



mongo db


I get the following error:




MongoDB shell version: 2.0.1

connecting to: db

Wed Jun 6 13:05:03 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed








11.10 mongodb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 6 '12 at 9:48









David Edwards

4,11232542




4,11232542










asked Jun 6 '12 at 7:35









jyothijyothi

241133




241133













  • Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

    – jasmines
    Jun 6 '12 at 7:40



















  • Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

    – jasmines
    Jun 6 '12 at 7:40

















Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

– jasmines
Jun 6 '12 at 7:40





Try with: downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/…

– jasmines
Jun 6 '12 at 7:40










4 Answers
4






active

oldest

votes


















81














There are two sets of packages for MongoDB; the standard Ubuntu packages, and a set published by 10gen themselves. The standard packages are out of date, especially for older releases of Ubuntu, so it is probably a good idea to set yourself up to install from the 10gen repositories.



The error message you quote suggests that you might have already tried this, since version 2.0.1 is not a standard Ubuntu package. I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.



Uninstalling existing MongoDB packages



Since I'm not 100% what you've got installed, I suggest the following to make sure everything is uninstalled:



sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove


Some of those commands may fail, depending on what packages you actually have installed, but that's okay.



This should also remove your config from /etc/mongodb.conf. If you want to completely clean up, you might also want to remove the data directory /var/lib/mongodb, so long as you backed it up or don't want it any more.



If you've installed by building from source or using the 10gen binary distributions, then you'll need to manually uninstall and clean up from wherever you put the binary files, config and data files.



Installing the 10gen MongoDB packages



Follow the 10gen instructions for adding their repository:



sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


Edit /etc/apt/sources.list, delete any lines you have already added for Mongo, and add the following single line (since 11.10 uses upstart) at the end:



deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen


Note that if you add this repository using the Software Center, it will automatically add a deb-src entry, which will break apt-get. So you will need to edit your sources list by hand to add only the above line.



Then to install, run:



sudo apt-get update 
sudo apt-get install mongodb-10gen


Checking your install



Installing the packages should automatically start up the MongoDB server. So you should be able to run the client from the command line:



mongo


which should successfully connect to the test database. You can quit by typing exit.



If that fails, please update your question with further details, including the output of trying to connect and attaching your /var/log/mongodb/mongodb.log file.






share|improve this answer


























  • maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

    – jyothi
    Jun 6 '12 at 10:02













  • That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

    – David Edwards
    Jun 6 '12 at 10:07











  • Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

    – David Edwards
    Jun 6 '12 at 10:30











  • can i know how to install or to update mongo db to 2.0.5 from 2.0.1

    – jyothi
    Jun 6 '12 at 10:59













  • Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

    – David Edwards
    Jun 6 '12 at 11:15





















25














To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.





  1. Stop MongoDB



    Stop the mongod process by issuing the following command:



    sudo service mongod stop



  2. Remove Packages



    Remove any MongoDB packages that you had previously installed.



    sudo apt-get purge mongodb-org*



  3. Remove Data Directories.



    Remove MongoDB databases and log files.



    sudo rm -r /var/log/mongodb /var/lib/mongodb







share|improve this answer

































    4














    Follow the steps:





    1. Remove lock file



      sudo rm /var/lib/mongodb/mongod.lock



    2. Repair mongodb



      mongod --repair



    3. Start mongodb



      sudo service mongodb start



    4. Start mongo console



      mongo







    share|improve this answer


























    • @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

      – David Foerster
      May 2 '18 at 8:01





















    -3














    Great Article! Mangodb is best technology I really appreciate the blog for such a nice Information. Please keep sharing. Being a best Mangodb services in Usa It's our pleasure to read the blog.





    share








    New contributor




    Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f147135%2fhow-can-i-uninstall-mongodb-and-reinstall-the-latest-version%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      81














      There are two sets of packages for MongoDB; the standard Ubuntu packages, and a set published by 10gen themselves. The standard packages are out of date, especially for older releases of Ubuntu, so it is probably a good idea to set yourself up to install from the 10gen repositories.



      The error message you quote suggests that you might have already tried this, since version 2.0.1 is not a standard Ubuntu package. I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.



      Uninstalling existing MongoDB packages



      Since I'm not 100% what you've got installed, I suggest the following to make sure everything is uninstalled:



      sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
      sudo apt-get purge mongodb-10gen
      sudo apt-get autoremove


      Some of those commands may fail, depending on what packages you actually have installed, but that's okay.



      This should also remove your config from /etc/mongodb.conf. If you want to completely clean up, you might also want to remove the data directory /var/lib/mongodb, so long as you backed it up or don't want it any more.



      If you've installed by building from source or using the 10gen binary distributions, then you'll need to manually uninstall and clean up from wherever you put the binary files, config and data files.



      Installing the 10gen MongoDB packages



      Follow the 10gen instructions for adding their repository:



      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


      Edit /etc/apt/sources.list, delete any lines you have already added for Mongo, and add the following single line (since 11.10 uses upstart) at the end:



      deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen


      Note that if you add this repository using the Software Center, it will automatically add a deb-src entry, which will break apt-get. So you will need to edit your sources list by hand to add only the above line.



      Then to install, run:



      sudo apt-get update 
      sudo apt-get install mongodb-10gen


      Checking your install



      Installing the packages should automatically start up the MongoDB server. So you should be able to run the client from the command line:



      mongo


      which should successfully connect to the test database. You can quit by typing exit.



      If that fails, please update your question with further details, including the output of trying to connect and attaching your /var/log/mongodb/mongodb.log file.






      share|improve this answer


























      • maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

        – jyothi
        Jun 6 '12 at 10:02













      • That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

        – David Edwards
        Jun 6 '12 at 10:07











      • Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

        – David Edwards
        Jun 6 '12 at 10:30











      • can i know how to install or to update mongo db to 2.0.5 from 2.0.1

        – jyothi
        Jun 6 '12 at 10:59













      • Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

        – David Edwards
        Jun 6 '12 at 11:15


















      81














      There are two sets of packages for MongoDB; the standard Ubuntu packages, and a set published by 10gen themselves. The standard packages are out of date, especially for older releases of Ubuntu, so it is probably a good idea to set yourself up to install from the 10gen repositories.



      The error message you quote suggests that you might have already tried this, since version 2.0.1 is not a standard Ubuntu package. I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.



      Uninstalling existing MongoDB packages



      Since I'm not 100% what you've got installed, I suggest the following to make sure everything is uninstalled:



      sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
      sudo apt-get purge mongodb-10gen
      sudo apt-get autoremove


      Some of those commands may fail, depending on what packages you actually have installed, but that's okay.



      This should also remove your config from /etc/mongodb.conf. If you want to completely clean up, you might also want to remove the data directory /var/lib/mongodb, so long as you backed it up or don't want it any more.



      If you've installed by building from source or using the 10gen binary distributions, then you'll need to manually uninstall and clean up from wherever you put the binary files, config and data files.



      Installing the 10gen MongoDB packages



      Follow the 10gen instructions for adding their repository:



      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


      Edit /etc/apt/sources.list, delete any lines you have already added for Mongo, and add the following single line (since 11.10 uses upstart) at the end:



      deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen


      Note that if you add this repository using the Software Center, it will automatically add a deb-src entry, which will break apt-get. So you will need to edit your sources list by hand to add only the above line.



      Then to install, run:



      sudo apt-get update 
      sudo apt-get install mongodb-10gen


      Checking your install



      Installing the packages should automatically start up the MongoDB server. So you should be able to run the client from the command line:



      mongo


      which should successfully connect to the test database. You can quit by typing exit.



      If that fails, please update your question with further details, including the output of trying to connect and attaching your /var/log/mongodb/mongodb.log file.






      share|improve this answer


























      • maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

        – jyothi
        Jun 6 '12 at 10:02













      • That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

        – David Edwards
        Jun 6 '12 at 10:07











      • Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

        – David Edwards
        Jun 6 '12 at 10:30











      • can i know how to install or to update mongo db to 2.0.5 from 2.0.1

        – jyothi
        Jun 6 '12 at 10:59













      • Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

        – David Edwards
        Jun 6 '12 at 11:15
















      81












      81








      81







      There are two sets of packages for MongoDB; the standard Ubuntu packages, and a set published by 10gen themselves. The standard packages are out of date, especially for older releases of Ubuntu, so it is probably a good idea to set yourself up to install from the 10gen repositories.



      The error message you quote suggests that you might have already tried this, since version 2.0.1 is not a standard Ubuntu package. I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.



      Uninstalling existing MongoDB packages



      Since I'm not 100% what you've got installed, I suggest the following to make sure everything is uninstalled:



      sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
      sudo apt-get purge mongodb-10gen
      sudo apt-get autoremove


      Some of those commands may fail, depending on what packages you actually have installed, but that's okay.



      This should also remove your config from /etc/mongodb.conf. If you want to completely clean up, you might also want to remove the data directory /var/lib/mongodb, so long as you backed it up or don't want it any more.



      If you've installed by building from source or using the 10gen binary distributions, then you'll need to manually uninstall and clean up from wherever you put the binary files, config and data files.



      Installing the 10gen MongoDB packages



      Follow the 10gen instructions for adding their repository:



      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


      Edit /etc/apt/sources.list, delete any lines you have already added for Mongo, and add the following single line (since 11.10 uses upstart) at the end:



      deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen


      Note that if you add this repository using the Software Center, it will automatically add a deb-src entry, which will break apt-get. So you will need to edit your sources list by hand to add only the above line.



      Then to install, run:



      sudo apt-get update 
      sudo apt-get install mongodb-10gen


      Checking your install



      Installing the packages should automatically start up the MongoDB server. So you should be able to run the client from the command line:



      mongo


      which should successfully connect to the test database. You can quit by typing exit.



      If that fails, please update your question with further details, including the output of trying to connect and attaching your /var/log/mongodb/mongodb.log file.






      share|improve this answer















      There are two sets of packages for MongoDB; the standard Ubuntu packages, and a set published by 10gen themselves. The standard packages are out of date, especially for older releases of Ubuntu, so it is probably a good idea to set yourself up to install from the 10gen repositories.



      The error message you quote suggests that you might have already tried this, since version 2.0.1 is not a standard Ubuntu package. I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.



      Uninstalling existing MongoDB packages



      Since I'm not 100% what you've got installed, I suggest the following to make sure everything is uninstalled:



      sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
      sudo apt-get purge mongodb-10gen
      sudo apt-get autoremove


      Some of those commands may fail, depending on what packages you actually have installed, but that's okay.



      This should also remove your config from /etc/mongodb.conf. If you want to completely clean up, you might also want to remove the data directory /var/lib/mongodb, so long as you backed it up or don't want it any more.



      If you've installed by building from source or using the 10gen binary distributions, then you'll need to manually uninstall and clean up from wherever you put the binary files, config and data files.



      Installing the 10gen MongoDB packages



      Follow the 10gen instructions for adding their repository:



      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


      Edit /etc/apt/sources.list, delete any lines you have already added for Mongo, and add the following single line (since 11.10 uses upstart) at the end:



      deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen


      Note that if you add this repository using the Software Center, it will automatically add a deb-src entry, which will break apt-get. So you will need to edit your sources list by hand to add only the above line.



      Then to install, run:



      sudo apt-get update 
      sudo apt-get install mongodb-10gen


      Checking your install



      Installing the packages should automatically start up the MongoDB server. So you should be able to run the client from the command line:



      mongo


      which should successfully connect to the test database. You can quit by typing exit.



      If that fails, please update your question with further details, including the output of trying to connect and attaching your /var/log/mongodb/mongodb.log file.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 17 '16 at 6:30









      Chaitanya Bapat

      1136




      1136










      answered Jun 6 '12 at 9:40









      David EdwardsDavid Edwards

      4,11232542




      4,11232542













      • maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

        – jyothi
        Jun 6 '12 at 10:02













      • That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

        – David Edwards
        Jun 6 '12 at 10:07











      • Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

        – David Edwards
        Jun 6 '12 at 10:30











      • can i know how to install or to update mongo db to 2.0.5 from 2.0.1

        – jyothi
        Jun 6 '12 at 10:59













      • Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

        – David Edwards
        Jun 6 '12 at 11:15





















      • maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

        – jyothi
        Jun 6 '12 at 10:02













      • That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

        – David Edwards
        Jun 6 '12 at 10:07











      • Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

        – David Edwards
        Jun 6 '12 at 10:30











      • can i know how to install or to update mongo db to 2.0.5 from 2.0.1

        – jyothi
        Jun 6 '12 at 10:59













      • Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

        – David Edwards
        Jun 6 '12 at 11:15



















      maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

      – jyothi
      Jun 6 '12 at 10:02







      maisapride1@maisapride1:/$ sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev Reading package lists... Done Building dependency tree Reading state information... Done Package mongodb is not installed, so not removed Package mongodb-clients is not installed, so not removed Package mongodb-dev is not installed, so not removed Package mongodb-server is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 406 not upgraded. -----when trying to remove, when i again give mongo it showing the vesion:MongoDB shell version: 2.0.1

      – jyothi
      Jun 6 '12 at 10:02















      That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

      – David Edwards
      Jun 6 '12 at 10:07





      That is fine; as I said, some of those commands may fail, depending on which packages you have installed. Those particular errors show that you did not have the standard Ubuntu MongoDB packages installed.

      – David Edwards
      Jun 6 '12 at 10:07













      Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

      – David Edwards
      Jun 6 '12 at 10:30





      Have you run the second command to remove the 10gen packages? If that removes nothing too, and you can still run the mongo client, then you must have done a manual install and you will have to delete by hand.

      – David Edwards
      Jun 6 '12 at 10:30













      can i know how to install or to update mongo db to 2.0.5 from 2.0.1

      – jyothi
      Jun 6 '12 at 10:59







      can i know how to install or to update mongo db to 2.0.5 from 2.0.1

      – jyothi
      Jun 6 '12 at 10:59















      Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

      – David Edwards
      Jun 6 '12 at 11:15







      Installing the 10gen packages as described in my answer will give you 2.0.6. Previous versions are available for download and manual install from the MongoDB website, but I strongly suggest you stick to the packaged versions.

      – David Edwards
      Jun 6 '12 at 11:15















      25














      To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.





      1. Stop MongoDB



        Stop the mongod process by issuing the following command:



        sudo service mongod stop



      2. Remove Packages



        Remove any MongoDB packages that you had previously installed.



        sudo apt-get purge mongodb-org*



      3. Remove Data Directories.



        Remove MongoDB databases and log files.



        sudo rm -r /var/log/mongodb /var/lib/mongodb







      share|improve this answer






























        25














        To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.





        1. Stop MongoDB



          Stop the mongod process by issuing the following command:



          sudo service mongod stop



        2. Remove Packages



          Remove any MongoDB packages that you had previously installed.



          sudo apt-get purge mongodb-org*



        3. Remove Data Directories.



          Remove MongoDB databases and log files.



          sudo rm -r /var/log/mongodb /var/lib/mongodb







        share|improve this answer




























          25












          25








          25







          To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.





          1. Stop MongoDB



            Stop the mongod process by issuing the following command:



            sudo service mongod stop



          2. Remove Packages



            Remove any MongoDB packages that you had previously installed.



            sudo apt-get purge mongodb-org*



          3. Remove Data Directories.



            Remove MongoDB databases and log files.



            sudo rm -r /var/log/mongodb /var/lib/mongodb







          share|improve this answer















          To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.





          1. Stop MongoDB



            Stop the mongod process by issuing the following command:



            sudo service mongod stop



          2. Remove Packages



            Remove any MongoDB packages that you had previously installed.



            sudo apt-get purge mongodb-org*



          3. Remove Data Directories.



            Remove MongoDB databases and log files.



            sudo rm -r /var/log/mongodb /var/lib/mongodb








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 2 '18 at 7:57









          David Foerster

          28.1k1365111




          28.1k1365111










          answered May 17 '16 at 11:53









          BhaveshBhavesh

          26132




          26132























              4














              Follow the steps:





              1. Remove lock file



                sudo rm /var/lib/mongodb/mongod.lock



              2. Repair mongodb



                mongod --repair



              3. Start mongodb



                sudo service mongodb start



              4. Start mongo console



                mongo







              share|improve this answer


























              • @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

                – David Foerster
                May 2 '18 at 8:01


















              4














              Follow the steps:





              1. Remove lock file



                sudo rm /var/lib/mongodb/mongod.lock



              2. Repair mongodb



                mongod --repair



              3. Start mongodb



                sudo service mongodb start



              4. Start mongo console



                mongo







              share|improve this answer


























              • @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

                – David Foerster
                May 2 '18 at 8:01
















              4












              4








              4







              Follow the steps:





              1. Remove lock file



                sudo rm /var/lib/mongodb/mongod.lock



              2. Repair mongodb



                mongod --repair



              3. Start mongodb



                sudo service mongodb start



              4. Start mongo console



                mongo







              share|improve this answer















              Follow the steps:





              1. Remove lock file



                sudo rm /var/lib/mongodb/mongod.lock



              2. Repair mongodb



                mongod --repair



              3. Start mongodb



                sudo service mongodb start



              4. Start mongo console



                mongo








              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited May 15 '13 at 5:44









              Aditya

              9,288125589




              9,288125589










              answered May 15 '13 at 5:23









              user2123184user2123184

              411




              411













              • @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

                – David Foerster
                May 2 '18 at 8:01





















              • @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

                – David Foerster
                May 2 '18 at 8:01



















              @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

              – David Foerster
              May 2 '18 at 8:01







              @stumblebee: Please watch out for edit suggestions like this one! The service name is indeed mongodb as in the original version and you can verify that via the package file list.

              – David Foerster
              May 2 '18 at 8:01













              -3














              Great Article! Mangodb is best technology I really appreciate the blog for such a nice Information. Please keep sharing. Being a best Mangodb services in Usa It's our pleasure to read the blog.





              share








              New contributor




              Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                -3














                Great Article! Mangodb is best technology I really appreciate the blog for such a nice Information. Please keep sharing. Being a best Mangodb services in Usa It's our pleasure to read the blog.





                share








                New contributor




                Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  -3












                  -3








                  -3







                  Great Article! Mangodb is best technology I really appreciate the blog for such a nice Information. Please keep sharing. Being a best Mangodb services in Usa It's our pleasure to read the blog.





                  share








                  New contributor




                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Great Article! Mangodb is best technology I really appreciate the blog for such a nice Information. Please keep sharing. Being a best Mangodb services in Usa It's our pleasure to read the blog.






                  share








                  New contributor




                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.








                  share


                  share






                  New contributor




                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 4 mins ago









                  Justin jeosepJustin jeosep

                  1




                  1




                  New contributor




                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Justin jeosep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f147135%2fhow-can-i-uninstall-mongodb-and-reinstall-the-latest-version%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      GameSpot

                      connect to host localhost port 22: Connection refused

                      Getting a Wifi WPA2 wifi connection