2

I'm trying to install MongoDB on Jessie. (Never used MongoDB before).

Following this tutorial I did the following:

apt-get update
apt-get upgrade
apt-get install mongodb-server -y
service mongod start

But that gives me this error:

Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.

What am I doing wrong?

I have looked around but can't make heads or tails of what I've found - all other examples seem to be doing far more complicated things to get it started! PS. I'm doing everything as root because I like the simple & dangerous approach :)

techraf
  • 4,319
  • 10
  • 31
  • 42
Jodes
  • 562
  • 2
  • 6
  • 19

2 Answers2

4

It shows an error, because the correct service name is mongodb and the tutorial contains a typo.

Execute:

service mongodb start

and enjoy MongoDB:

$ mongo
MongoDB shell version: 2.4.10
connecting to: test
Server has startup warnings:
Fri Dec 30 19:04:35.967 [initandlisten]
Fri Dec 30 19:04:35.967 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Fri Dec 30 19:04:35.968 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
Fri Dec 30 19:04:35.968 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
Fri Dec 30 19:04:35.970 [initandlisten]
>
techraf
  • 4,319
  • 10
  • 31
  • 42
0

Most probably unit mongodb.service is masked. Use following command to unmask it.

sudo systemctl unmask mongodb

then re-run

sudo service mongod start

  • Most probably unit mongodb.service is masked No. If you re-read question and answer then you will see that the cause was a simple typo – Dirk Nov 21 '18 at 09:25
  • Santosh is somehow right in my case. I just changed binding IP to 0.0.0.0 and kill the port and when I tried restarting the service it simply failed. When I unmask and restarted the server, it works for em – Dila Gurung Jun 03 '20 at 11:48