Trying to reinstall MongoDB using Yum. First it says package is not installed, then it says already installed?

7,031

Solution 1

Look closely at both sets of yum status messages; they are both 100% the same. They are both showing an attempt to uninstall and displaying messages like this:

Package(s) mongodb-org-2.6.1-2.x86_64 available, but not installed.

All that means is the package mongodb-org-2.6.1-2.x86_64 is available from the yum package repository, but is not actually installed on your system.

Have you just tried reinstalling it after uninstalling?

yum install mongodb-org-2.6.1-2.x86_64 mongodb-org-server-2.6.1-2.x86_64 mongodb-org-shell-2.6.1-2.x86_64 mongodb-org-mongos-2.6.1-2.x86_64 mongodb-org-tools-2.6.1-2.x86_64

Once you do that, the software should be reinstalled and you can just run this to start it:

sudo service mongod start

Solution 2

try it

  • Stop mongod service

    sudo service mongod stop
    
  • Remove Package

    sudo yum erase $(rpm -qa | grep mongodb-org)
    
  • Remove Data Directories

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

Create a /etc/yum.repos.d/mongodb-org-3.0.repo file so that you can install MongoDB directly, using yum

hold the following configuration for [email protected]

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0  /x86_64/
gpgcheck=0
enabled=1

then hit this one

 sudo yum install -y mongodb-org

You must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

--Disable SELinux entirely by changing the SELINUX setting to disabled in /etc/selinux/config

 SELINUX=disabled

--Set SELinux to permissive mode in /etc/selinux/config by changing the SELINUX setting to permissive

 SELINUX=permissive

Enable access to the relevant ports (e.g. 27017) for SELinux if in enforcing mode. See Default MongoDB Port for more information on MongoDB’s default ports. For default settings, this can be accomplished by running

semanage port -a -t mongod_port_t -p tcp 27017
Share:
7,031

Related videos on Youtube

Surgetheurge
Author by

Surgetheurge

Updated on September 18, 2022

Comments

  • Surgetheurge
    Surgetheurge almost 2 years

    I have a problem with a service, it fails to start. I am trying to troubleshoot it by re-installing it. When I try to start or stop the service I see the following:

    enter image description here

    When I try uninstalling MongoDB using Yum I get this:

    yum remove mongodb-org-2.6.1-2.x86_64 mongodb-org-server-2.6.1-2.x86_64 mongodb-org-    shell-2.6.1-2.x86_64 mongodb-org-mongos-2.6.1-2.x86_64 mongodb-org-tools-2.6.1-2.x86_64
    Loaded plugins: fastestmirror, security
    Setting up Remove Process
    No Match for argument: mongodb-org-2.6.1-2.x86_64
    Loading mirror speeds from cached hostfile
    * base: mirrors.usc.edu
    * extras: mirror.ancl.hawaii.edu
    * rpmforge: mirror.hmc.edu
    * updates: repos.lax.quadranet.com
    Package(s) mongodb-org-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-server-2.6.1-2.x86_64
    Package(s) mongodb-org-server-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-shell-2.6.1-2.x86_64
    Package(s) mongodb-org-shell-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-mongos-2.6.1-2.x86_64
    Package(s) mongodb-org-mongos-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-tools-2.6.1-2.x86_64
    Package(s) mongodb-org-tools-2.6.1-2.x86_64 available, but not installed.
    No Packages marked for removal
    

    Then when I uninstall again, the packages, it says:

    yum remove mongodb-org-2.6.1-2.x86_64 mongodb-org-server-2.6.1-2.x86_64 mongodb-org-    shell-2.6.1-2.x86_64 mongodb-org-mongos-2.6.1-2.x86_64 mongodb-org-tools-2.6.1-2.x86_64
    Loaded plugins: fastestmirror, security
    Setting up Remove Process
    No Match for argument: mongodb-org-2.6.1-2.x86_64
    Loading mirror speeds from cached hostfile
     * base: mirror.hmc.edu
     * extras: mirror.us.leaseweb.net
     * rpmforge: mirror.hmc.edu
     * updates: repos.lax.quadranet.com
    Package(s) mongodb-org-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-server-2.6.1-2.x86_64
    Package(s) mongodb-org-server-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-shell-2.6.1-2.x86_64
    Package(s) mongodb-org-shell-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-mongos-2.6.1-2.x86_64
    Package(s) mongodb-org-mongos-2.6.1-2.x86_64 available, but not installed.
    No Match for argument: mongodb-org-tools-2.6.1-2.x86_64
    Package(s) mongodb-org-tools-2.6.1-2.x86_64 available, but not installed.
    No Packages marked for removal
    
  • Alok Deshwal
    Alok Deshwal over 8 years
    I have modified it for CentOS or RedHat, check it
  • Surgetheurge
    Surgetheurge over 8 years
    hey dude, thank you for your effort. Unfortunately I have solved this problem years ago. I forgot the solution. I'm sorry I've wasted your time. Have an upvote anyway.