Cannot uninstall MongoDB on Ubuntu 18.04












0















I want to completely uninstall MongoDB from my Ubuntu 18.04.



sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb


The first two commands worked but the last two commands are not working. The following error is showing.



rm: cannot remove '/var/log/mongodb': No such file or directory  


If I hit mongod the following error shows.



bash: /usr/bin/mongod: No such file or directory  


If i hit sudo systemctl status mongodb the following error shows.



mongodb.service - High-performance, schema-free document-oriented >database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-01-05 19:45:53 +06; 1h 3min ago
Main PID: 18811 (code=exited, status=2)

জানু 05 19:45:53 anon-acer systemd[1]: Started High-performance, schema-free document-oriented >database.
জানু 05 19:45:53 anon-acer mongod[18811]: Error reading config file: No such file or directory
জানু 05 19:45:53 anon-acer mongod[18811]: try '/usr/bin/mongod --help' for more information
জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Failed with result 'exit-code'.


How can I completely uninstall all of the files, configurations and everything of MongoDB from my pc?










share|improve this question



























    0















    I want to completely uninstall MongoDB from my Ubuntu 18.04.



    sudo service mongod stop
    sudo apt-get purge mongodb-org*
    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb


    The first two commands worked but the last two commands are not working. The following error is showing.



    rm: cannot remove '/var/log/mongodb': No such file or directory  


    If I hit mongod the following error shows.



    bash: /usr/bin/mongod: No such file or directory  


    If i hit sudo systemctl status mongodb the following error shows.



    mongodb.service - High-performance, schema-free document-oriented >database
    Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sat 2019-01-05 19:45:53 +06; 1h 3min ago
    Main PID: 18811 (code=exited, status=2)

    জানু 05 19:45:53 anon-acer systemd[1]: Started High-performance, schema-free document-oriented >database.
    জানু 05 19:45:53 anon-acer mongod[18811]: Error reading config file: No such file or directory
    জানু 05 19:45:53 anon-acer mongod[18811]: try '/usr/bin/mongod --help' for more information
    জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
    জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Failed with result 'exit-code'.


    How can I completely uninstall all of the files, configurations and everything of MongoDB from my pc?










    share|improve this question

























      0












      0








      0








      I want to completely uninstall MongoDB from my Ubuntu 18.04.



      sudo service mongod stop
      sudo apt-get purge mongodb-org*
      sudo rm -r /var/log/mongodb
      sudo rm -r /var/lib/mongodb


      The first two commands worked but the last two commands are not working. The following error is showing.



      rm: cannot remove '/var/log/mongodb': No such file or directory  


      If I hit mongod the following error shows.



      bash: /usr/bin/mongod: No such file or directory  


      If i hit sudo systemctl status mongodb the following error shows.



      mongodb.service - High-performance, schema-free document-oriented >database
      Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
      Active: failed (Result: exit-code) since Sat 2019-01-05 19:45:53 +06; 1h 3min ago
      Main PID: 18811 (code=exited, status=2)

      জানু 05 19:45:53 anon-acer systemd[1]: Started High-performance, schema-free document-oriented >database.
      জানু 05 19:45:53 anon-acer mongod[18811]: Error reading config file: No such file or directory
      জানু 05 19:45:53 anon-acer mongod[18811]: try '/usr/bin/mongod --help' for more information
      জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
      জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Failed with result 'exit-code'.


      How can I completely uninstall all of the files, configurations and everything of MongoDB from my pc?










      share|improve this question














      I want to completely uninstall MongoDB from my Ubuntu 18.04.



      sudo service mongod stop
      sudo apt-get purge mongodb-org*
      sudo rm -r /var/log/mongodb
      sudo rm -r /var/lib/mongodb


      The first two commands worked but the last two commands are not working. The following error is showing.



      rm: cannot remove '/var/log/mongodb': No such file or directory  


      If I hit mongod the following error shows.



      bash: /usr/bin/mongod: No such file or directory  


      If i hit sudo systemctl status mongodb the following error shows.



      mongodb.service - High-performance, schema-free document-oriented >database
      Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
      Active: failed (Result: exit-code) since Sat 2019-01-05 19:45:53 +06; 1h 3min ago
      Main PID: 18811 (code=exited, status=2)

      জানু 05 19:45:53 anon-acer systemd[1]: Started High-performance, schema-free document-oriented >database.
      জানু 05 19:45:53 anon-acer mongod[18811]: Error reading config file: No such file or directory
      জানু 05 19:45:53 anon-acer mongod[18811]: try '/usr/bin/mongod --help' for more information
      জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
      জানু 05 19:45:53 anon-acer systemd[1]: mongodb.service: Failed with result 'exit-code'.


      How can I completely uninstall all of the files, configurations and everything of MongoDB from my pc?







      mongodb






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 5 at 15:01









      Maruf Al Hossain PrinceMaruf Al Hossain Prince

      354




      354






















          2 Answers
          2






          active

          oldest

          votes


















          1














          When you purged/uninstalled MongoDB, /var/log/mongodb and /var/lib/mongodb were removed automatically. When you tried to remove those "removed" files explicitly, it threw errors,



          rm: cannot remove '/var/log/mongodb': No such file or directory
          bash: /usr/bin/mongod: No such file or directory


          Just because there were indeed no such files.



          Moreover after you uninstalled MongoDB, there was still a file /etc/systemd/system/mongodb.service which is used to start/stop/restart MongoDB service via systemctl. Since MongoDB was already uninstalled but that file was still there and it was unable to run that service, thus showed Active: failed.



          Remove that file using:



          sudo rm /etc/systemd/system/mongodb.service


          And you are done. Try checking its status or starting using:



          sudo systemctl status mongodb
          sudo systemctl start mongodb


          You'll get an error like "Service not found". Now there is no service MongoDB in your system






          share|improve this answer































            0














            If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .



            1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/



            2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.



            3) Then make a directory at /data/db location and give write permission to thatdirectory.



            sudo mkdir -p /data/db

            sudo chmod -R 777 /data/db


            4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)



            pwd 


            it will show



            /home/<your user name>


            Then type



            ls -al



            This command will show up all hiddenfile at home directory and search for



            ~/.bashrc



            5) Edit the .bashrc file and write



            export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH


            and save the file type source ./bashrc



            Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin



            6) Now at terminal type mongo --nodb
            it will show MongoDB shell version v4.0.4



            From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.



            7) Then start mongod



            >sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
            >mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
            >mongo --port 27017





            share|improve this answer























              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%2f1107204%2fcannot-uninstall-mongodb-on-ubuntu-18-04%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              When you purged/uninstalled MongoDB, /var/log/mongodb and /var/lib/mongodb were removed automatically. When you tried to remove those "removed" files explicitly, it threw errors,



              rm: cannot remove '/var/log/mongodb': No such file or directory
              bash: /usr/bin/mongod: No such file or directory


              Just because there were indeed no such files.



              Moreover after you uninstalled MongoDB, there was still a file /etc/systemd/system/mongodb.service which is used to start/stop/restart MongoDB service via systemctl. Since MongoDB was already uninstalled but that file was still there and it was unable to run that service, thus showed Active: failed.



              Remove that file using:



              sudo rm /etc/systemd/system/mongodb.service


              And you are done. Try checking its status or starting using:



              sudo systemctl status mongodb
              sudo systemctl start mongodb


              You'll get an error like "Service not found". Now there is no service MongoDB in your system






              share|improve this answer




























                1














                When you purged/uninstalled MongoDB, /var/log/mongodb and /var/lib/mongodb were removed automatically. When you tried to remove those "removed" files explicitly, it threw errors,



                rm: cannot remove '/var/log/mongodb': No such file or directory
                bash: /usr/bin/mongod: No such file or directory


                Just because there were indeed no such files.



                Moreover after you uninstalled MongoDB, there was still a file /etc/systemd/system/mongodb.service which is used to start/stop/restart MongoDB service via systemctl. Since MongoDB was already uninstalled but that file was still there and it was unable to run that service, thus showed Active: failed.



                Remove that file using:



                sudo rm /etc/systemd/system/mongodb.service


                And you are done. Try checking its status or starting using:



                sudo systemctl status mongodb
                sudo systemctl start mongodb


                You'll get an error like "Service not found". Now there is no service MongoDB in your system






                share|improve this answer


























                  1












                  1








                  1







                  When you purged/uninstalled MongoDB, /var/log/mongodb and /var/lib/mongodb were removed automatically. When you tried to remove those "removed" files explicitly, it threw errors,



                  rm: cannot remove '/var/log/mongodb': No such file or directory
                  bash: /usr/bin/mongod: No such file or directory


                  Just because there were indeed no such files.



                  Moreover after you uninstalled MongoDB, there was still a file /etc/systemd/system/mongodb.service which is used to start/stop/restart MongoDB service via systemctl. Since MongoDB was already uninstalled but that file was still there and it was unable to run that service, thus showed Active: failed.



                  Remove that file using:



                  sudo rm /etc/systemd/system/mongodb.service


                  And you are done. Try checking its status or starting using:



                  sudo systemctl status mongodb
                  sudo systemctl start mongodb


                  You'll get an error like "Service not found". Now there is no service MongoDB in your system






                  share|improve this answer













                  When you purged/uninstalled MongoDB, /var/log/mongodb and /var/lib/mongodb were removed automatically. When you tried to remove those "removed" files explicitly, it threw errors,



                  rm: cannot remove '/var/log/mongodb': No such file or directory
                  bash: /usr/bin/mongod: No such file or directory


                  Just because there were indeed no such files.



                  Moreover after you uninstalled MongoDB, there was still a file /etc/systemd/system/mongodb.service which is used to start/stop/restart MongoDB service via systemctl. Since MongoDB was already uninstalled but that file was still there and it was unable to run that service, thus showed Active: failed.



                  Remove that file using:



                  sudo rm /etc/systemd/system/mongodb.service


                  And you are done. Try checking its status or starting using:



                  sudo systemctl status mongodb
                  sudo systemctl start mongodb


                  You'll get an error like "Service not found". Now there is no service MongoDB in your system







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 5 at 15:47









                  KulfyKulfy

                  4,29651342




                  4,29651342

























                      0














                      If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .



                      1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/



                      2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.



                      3) Then make a directory at /data/db location and give write permission to thatdirectory.



                      sudo mkdir -p /data/db

                      sudo chmod -R 777 /data/db


                      4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)



                      pwd 


                      it will show



                      /home/<your user name>


                      Then type



                      ls -al



                      This command will show up all hiddenfile at home directory and search for



                      ~/.bashrc



                      5) Edit the .bashrc file and write



                      export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH


                      and save the file type source ./bashrc



                      Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin



                      6) Now at terminal type mongo --nodb
                      it will show MongoDB shell version v4.0.4



                      From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.



                      7) Then start mongod



                      >sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
                      >mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
                      >mongo --port 27017





                      share|improve this answer




























                        0














                        If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .



                        1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/



                        2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.



                        3) Then make a directory at /data/db location and give write permission to thatdirectory.



                        sudo mkdir -p /data/db

                        sudo chmod -R 777 /data/db


                        4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)



                        pwd 


                        it will show



                        /home/<your user name>


                        Then type



                        ls -al



                        This command will show up all hiddenfile at home directory and search for



                        ~/.bashrc



                        5) Edit the .bashrc file and write



                        export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH


                        and save the file type source ./bashrc



                        Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin



                        6) Now at terminal type mongo --nodb
                        it will show MongoDB shell version v4.0.4



                        From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.



                        7) Then start mongod



                        >sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
                        >mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
                        >mongo --port 27017





                        share|improve this answer


























                          0












                          0








                          0







                          If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .



                          1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/



                          2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.



                          3) Then make a directory at /data/db location and give write permission to thatdirectory.



                          sudo mkdir -p /data/db

                          sudo chmod -R 777 /data/db


                          4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)



                          pwd 


                          it will show



                          /home/<your user name>


                          Then type



                          ls -al



                          This command will show up all hiddenfile at home directory and search for



                          ~/.bashrc



                          5) Edit the .bashrc file and write



                          export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH


                          and save the file type source ./bashrc



                          Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin



                          6) Now at terminal type mongo --nodb
                          it will show MongoDB shell version v4.0.4



                          From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.



                          7) Then start mongod



                          >sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
                          >mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
                          >mongo --port 27017





                          share|improve this answer













                          If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .



                          1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/



                          2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.



                          3) Then make a directory at /data/db location and give write permission to thatdirectory.



                          sudo mkdir -p /data/db

                          sudo chmod -R 777 /data/db


                          4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)



                          pwd 


                          it will show



                          /home/<your user name>


                          Then type



                          ls -al



                          This command will show up all hiddenfile at home directory and search for



                          ~/.bashrc



                          5) Edit the .bashrc file and write



                          export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH


                          and save the file type source ./bashrc



                          Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin



                          6) Now at terminal type mongo --nodb
                          it will show MongoDB shell version v4.0.4



                          From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.



                          7) Then start mongod



                          >sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
                          >mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
                          >mongo --port 27017






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 2 days ago









                          Kaushik DasKaushik Das

                          15




                          15






























                              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%2f1107204%2fcannot-uninstall-mongodb-on-ubuntu-18-04%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

                              flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                              Mangá

                              Eduardo VII do Reino Unido