
Installing MongoDB on Red Hat Linux 7
Published: 11/8/2018
I'm a little bit fascinated by the idea of a no-SQL database. It seems completely counter-intuitive to everything I learned of systems and database design in the early 2000's. But technology is nothing if not fluid and perpetually redefining the rules.
I learned that Drupal could use MongoDB as its backend database, and this solidified my desire to find out more. While taking courses at MongoDB University (opens in new tab) was a natural starting point, I also wanted to understand the install and configuration of MongoDB. But it's rare to find an online article or instruction set that I can follow from beginning to end, especially when working with a product I've never installed, configured or used.
Here's what it took for me to get MongoDB installed and running on my RHEL7 server...
But when you know it's going to take three days to get a response from the Network guy, you simply move on...
I began with the Red Hat installation instructions (opens in new tab) available on the MongoDB website, and this article provided the majority of what I needed. However, for reasons I did not research further, the recommended installation process of creating a new repository and installing through yum simply didn't work for me (I can yum install other packages). I suspect the problem is something unique to my development server, combined with the fact that I'm behind a firewall, and there are rules for talking to repositories. But when you know it's going to take three days to get a response from the Network guy, you simply move on...
Fortunately, the article also included instructions for using the tarball. And the instructions are pretty good, but a few details are, perhaps, assumed by a writer comfortable with the process. A first-time installer might want to know this:
- You have to create your own .conf file. You might think this comes with the tarball (I did!). It does not. Nor does Mongo's instructions specify the manual creation of this file or give full details about its contents.
- You have to create your own data file and logging directories and change ownership of those directories (see step #3).
- You have to create a new OS account named 'mongod,' and this account must own the directories created in step #2.
- Depending on how you want to stop/start MongoDB, there may be other steps specific to your Linux environment. For example, using service <service name> start/stop, which is what the article instructs, does not work unless you've created the service file in /etc/systemd/system/. It doesn't just happen automatically.
Because these details weren't clear, I used this article (opens in new tab) for the more granular steps. This is an older article, likely written for an older version of MongoDB, and the data and logging paths referenced in this article are different from the current MongoDB defaults. But here I was able to find a sample .conf file. I also found instructions for starting MondoDB - and the interactive command line tool - from the Mongo source/installation location.
And... it works!!
Here's a snippet of the command line tool and the help menu. Now to start playing!
