You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 14.04安装MongoDB失败,报错“status: Unknown job: mongod”

Fixing "Unknown job: mongod" on Ubuntu 14.04 when installing MongoDB 3.6

Hey there, let's sort out that frustrating "Unknown job: mongod" error you're hitting. Ubuntu 14.04 relies on Upstart for service management (instead of systemd used in newer Ubuntu versions), and sometimes the MongoDB 3.6 package doesn't set up the Upstart job properly during installation. Here's how to fix it step by step:

Step 1: Ensure you've installed the full MongoDB server package

First, double-check that you installed the core server component—sometimes a partial install can cause this issue. Run:

sudo apt-get install mongodb-org-server

This package provides the mongod service and its associated configuration files.

Step 2: Manually create the Upstart configuration file (if needed)

If the service still isn't recognized, it means the Upstart config file is missing. Create /etc/init/mongod.conf with the following content:

description "MongoDB Database Server"
author "MongoDB Inc."

start on runlevel [2345]
stop on runlevel [016]

script
  # Execute mongod as the mongodb user, using the default config file
  exec start-stop-daemon --start --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongod.conf
end script

pre-start script
  # Ensure required directories exist and have correct permissions
  mkdir -p /var/log/mongodb
  mkdir -p /var/lib/mongodb
  chown mongodb:mongodb /var/log/mongodb
  chown mongodb:mongodb /var/lib/mongodb
end script

Step 3: Reload Upstart and start the service

Once the config file is in place, reload Upstart to pick up the new job definition, then start mongod:

sudo initctl reload-configuration
sudo start mongod

Step 4: Verify the service is running

Check the status to confirm everything works:

sudo status mongod

You should see output indicating the service is running (e.g., mongod start/running, process 1234).

Quick troubleshooting check

If you get an error that mongod isn't found, run which mongod—if there's no output, it means the server package wasn't installed correctly, so go back to Step 1 and re-run the install command.

内容的提问来源于stack exchange,提问作者Ragav Y

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:08:19