If You, like me, are new to MongoDB and You’re trying to install it on your lovely SuSE, You might find this article helpful.

First of all, follow the official guide on mongodb.org at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-suse/ and if everything is fine, You should have a working MongoDB server installed on your machine.

Problems begins after You restart the machine. Probably You will not be able to start the mongod service anymore. This happen because of a bug, but there is an easy fix to solve this problem.

The bug is, when the system try to start the mongod service, this one looks for  /var/run/mongodb/mongod.pid, but the directory mongodb in /var/run doesn’t exists!

The easy fix is to create this directory on every boot.

In order to do this, get root privileges and go to /etc/tmpfiles.d/ , inside this directory create a file mongo.conf and type in it the following line d /var/run/mongodb 0755 mongod mongod

Save and exit.

Now if You restart your computer, Mongodb should be working perfectly and if You don’t want to restart right now You can always give this command (as root) systemd-tmpfiles –create mongo.conf and checkout if the service works.

Have fun!