Sources


There seems to be very little complete documentation on installing the latest versions of MongoDB on Fedora. My situation was specifically Fedora 22. I was able to get everything working fortunately after discovering a feed from someone else posting the question, and then some digging around the MongoDB documentation for start-up instructions. Oddly Mongo doesn't have anything specifically for Fedora, so I had to poke around and guess a bit with CentOS and RedHat instructions. Fortunately they are very much the same for the most part with Fedora

Add the Repository

This took a bit of mixing from the feed and the mongodb documentation. Taking from the feed doesn't end up completely adding the repository properly, so I found it worked better doing it the following way. cd to the repository directory in /etc/yum.repos.d/ and create a file called mongodb-org-3.0.repo. Then add the following in the file:

[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  

Note that there is a variable $releasever in the above code snippet. From the feed for Fedora 22 the $releasever should be replaced with 7. Since this may eventually become obsolete though, I have left the variable in. Replace with the appropriate value is 7 is no longer appropriate

As a side, the main difference between the method of adding the repository described in the MongoDB documentation to the feed is the gpgcheck. From the snippet above and the MongoDB docs you can see it is set to false, as the code is not signed. The feed though adds the repository with the dnf helper command:

dnf config-manager --add-repo https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/  

Which the config-manager default enabled the gpgcheck. Now you can side step this when you install with the --nogpgcheck parameter in the install call but I thought it was a bit messy for my liking.

Install Mongo

This is the easy part. Run and execute:

dnf install -y mongodb-org  

Start Mongo

This step tripped me up initially as Fedora, from my experience so far, names its services the same as the program name or the installed package. To start mongoDB though you need to execute the following command:

systemctl start mongod  

This command may take awhile as mongo does a first time load. Mongo will then have loaded. You can restart, stop and get the status of mongo with the following commands:

Stop Mongo

systemctl stop mongod  

Restart Mongo

systemctl restart mongod  

Get Mongo Status

systemctl status mongod  

Use Mongo

You can now interact with mongo locally through the mongo shell client like so:

mongo  

This will automatically log you in and load the test database. To configure Mongo further for external access and such, checkout the above links. The MongoDB documentation has good information on where to go. There is a specific issue with dealing with SELinux that the documentation says will interfere with that kind of setup