MongoDB 3.0.2 won't start after upgrading to Ubuntu 15.10
I recently upgraded to Ubuntu 15.10 after which MongoDB 3.0.2 is not starting.
$ sudo service mongod start
which would throw error:
Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.
Solution 1:
It's just the lack of a service file for systemd. No need to go back to upstart like Kartik did or use a different repository than described in https://docs.mongodb.org/manual/installation/.
Create a file /lib/systemd/system/mongodb.service
with the following content:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
[Install]
WantedBy=multi-user.target
Solution 2:
This error occurred due to the problem with the new Ubuntu (15 and ahead).
Default init system is systemd which was Upstart previously. So you need to install Upstart, reboot your system and here you go, you can now run mongodb service.
- Install Upstart
sudo apt-get install upstart-sysv
- Reboot your system
sudo service mongod start
mongod start/running, process 3371
Solution 3:
I used debian package in ubuntu 15.10
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org