Today I want to share with you how to easily make MongoDB work in Fedora. Recently, while moving to F19 I have faced the issue when my Mongo does not start. What I mean by does not start ?
Also when I try to start service:
[aspektor@localhost routes]$ service mongod start Starting mongod (via systemctl): Failed to issue method call: Access denied [FAILED]
The main thing here is:
DO NOT PANIC 🙂
I even put it in green, because green suppose to be the most relaxing colour :))))
The problem lies in SELinux , disallowing access to MongoDB. I have tried setting SELinux to permissive, and one time it worked, but it didn’t the other time. And frankly saying, you don’t want your SELinux to be in Permissive mode.
So what you need to do is to create a policy allowing Mongo to access your system.
SELinux provides you with these 2 commands:
[root@localhost routes]$ grep mongod /var/log/audit/audit.log | audit2allow -M mypol ******************** IMPORTANT *********************** To make this policy package active, execute: semodule -i mypol.pp [root@localhost routes]$ semodule -i mypol.pp1
If you are still curious where did I get this commands from – I got them right from SELinux (image clickable):
After setting the new policy that allow mongo, just try to start it again:
[root@localhost routes] exit [aspektor@localhost routes]$ mongo MongoDB shell version: 2.4.3 connecting to: test
Let me know if it worked for you!