Aqui estão os passos que executei para uma instalação bem-sucedida:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
sudo rm /etc/apt/sources.list.d/mongodb-org*
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org=3.2.4 mongodb-org-server=3.2.4 mongodb-org-shell=3.2.4 mongodb-org-mongos=3.2.4 mongodb-org-tools=3.2.4
sudo mkdir /data/db
sudo chown -R mongodb:mongodb /data
-
Edite
/etc/mongod.conf
e alteredbPath
para/data/db
. -
Edite o
/lib/systemd/system/mongod.service
:[Unit] Description= Documentation=man:mongod(1) After=network.target [Service] Type=forking User=mongodb Group=mongodb RuntimeDirectory=mongod PIDFile=/var/run/mongod/mongod.pid ExecStart=/usr/bin/mongod -f /etc/mongod.conf --pidfilepath /var/run/mongod/mongod.pid --fork TimeoutStopSec=5 KillMode=mixed [Install] WantedBy=multi-user.target
Então deve funcionar.