Mongodb doesn't start on ubuntu

I had a strange problem with mongodb after installation, it ends with a message

invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found. dpkg: error processing mongodb-10gen (--configure): 

What is wrong here, I followed these steps: http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

+6
source share
2 answers

The problem is that you are trying to install a version packaged for initstart init services, but Debian Squeeze still uses SysV init by default.

There is a note in the installation documentation: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/#installing-mongodb

If you are using Debian or Ubuntu, which uses the SysV style initialization process, use the following line:

 deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen 
+10
source

This means that you need to create a mongodb start script in /etc/init.d/

Try script

 #!/bin/bash # # mongodb Startup script for the mongodb server # # chkconfig: - 64 36 # description: MongoDB Database Server # # processname: mongodb # # Source function library . /lib/lsb/init-functions if [ -f /etc/sysconfig/mongodb ]; then . /etc/sysconfig/mongodb fi prog="mongod" mongod="/usr/local/mongodb/bin/mongod" RETVAL=0 start() { echo -n $"Starting $prog: " daemon $mongod "--fork --logpath /var/log/mongodb.log --logappend 2>&1 >>/var/log/mongodb.log" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog return $RETVAL } reload() { echo -n $"Reloading $prog: " killproc $prog -HUP RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f /var/lock/subsys/$prog ]; then stop start fi ;; reload) reload ;; status) status $mongod RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}" RETVAL=1 esac exit $RETVAL 

after type in terminal:

 sudo chmod +x /etc/init.d/mongodb sudo /etc/init.d/mongodb start ps -A | grep mongod 
+4
source

Source: https://habr.com/ru/post/916531/


All Articles