Conflict when installing MongoDB

2

1

I have a server with CentOS 7, I would like to install mongoDB. I tried installing it typing:

sudo yum install mongodb

with no problems, then I do mongod I get:

-bash: mongod: command not found

If I do only mongo I get:

2017-04-22T21:09:55.078+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2017-04-22T21:09:55.079+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146

So, I tried installing it again following this instructions but then when I type sudo yum install -y mongodb-org I get:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.constant.com
 * epel: mirror.math.princeton.edu
 * extras: mirror.netdepot.com
 * updates: mirror.cc.columbia.edu
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.4.4-1.el7 will be installed
--> Processing Dependency: mongodb-org-tools = 3.4.4 for package: mongodb-org-3.4.4-1.el7.x86_64
--> Processing Dependency: mongodb-org-shell = 3.4.4 for package: mongodb-org-3.4.4-1.el7.x86_64
--> Processing Dependency: mongodb-org-server = 3.4.4 for package: mongodb-org-3.4.4-1.el7.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.4.4 for package: mongodb-org-3.4.4-1.el7.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.4.4-1.el7 will be installed
---> Package mongodb-org-server.x86_64 0:3.4.4-1.el7 will be installed
---> Package mongodb-org-shell.x86_64 0:3.4.4-1.el7 will be installed
---> Package mongodb-org-tools.x86_64 0:3.4.4-1.el7 will be installed
--> Processing Conflict: mongodb-org-server-3.4.4-1.el7.x86_64 conflicts mongodb
--> Processing Conflict: mongodb-org-3.4.4-1.el7.x86_64 conflicts mongodb
--> Processing Conflict: mongodb-org-shell-3.4.4-1.el7.x86_64 conflicts mongodb
--> Processing Conflict: mongodb-org-mongos-3.4.4-1.el7.x86_64 conflicts mongodb
--> Processing Conflict: mongodb-org-tools-3.4.4-1.el7.x86_64 conflicts mongodb
--> Finished Dependency Resolution
Error: mongodb-org-mongos conflicts with mongodb-2.6.12-4.el7.x86_64
Error: mongodb-org-shell conflicts with mongodb-2.6.12-4.el7.x86_64
Error: mongodb-org-tools conflicts with mongodb-2.6.12-4.el7.x86_64
Error: mongodb-org conflicts with mongodb-2.6.12-4.el7.x86_64
Error: mongodb-org-server conflicts with mongodb-2.6.12-4.el7.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

And it's driving me crazy. I read that doing yum makecache and installing again would solve my problem but it didn't. Also tried uninstalling everything with sudo yum erase $(rpm -qa | grep mongodb-org) but then I get:

Loaded plugins: fastestmirror
Error: Need to pass a list of pkgs to erase
 Mini usage:

erase PACKAGE...

Remove a package or packages from your system

aliases: remove, autoremove, erase-n, erase-na, erase-nevra, autoremove-n, autoremove-na, autoremove-nevra, remove-n, remove-na, remove-nevra

So,what else can I do? I just need mongo running. Thanks!

Sredny M Casanova

Posted 2017-04-22T21:16:19.717

Reputation: 121

Answers

1

You have mongodb-2.6.12-4.el7.x86_64 installed (most likely from the EPEL repo - I'm only guessing as you didn't specify) and are trying to install another version from the MongoDB repo.

Try the following:

yum remove mongodb*
yum clean all
yum install mongodb-org

Don't use -y with yum. Take the time to read what's on the screen, especially if it's new to you.

Deeh

Posted 2017-04-22T21:16:19.717

Reputation: 204