Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ubuntu - Fail to install mongodb properly on digitalocean

I am trying to install mongo on DigitalOcean but am getting this error:

The following packages have unmet dependencies:

mongodb-org : Depends: mongodb-org-shell but it is not going to be installed
           Depends: mongodb-org-server but it is not going to be installed
           Depends: mongodb-org-mongos but it is not going to be installed
           Depends: mongodb-org-tools but it is not going to be installed
           E: Unable to correct problems, you have held broken packages.

I followed this documentation

My steps:

  1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

  2. echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

  3. sudo apt-get update

  4. sudo apt-get install mongodb-org

But when I used this command "sudo apt-get install mongodb " it install successfully but throw this error "Failed to start mongod.service: Unit mongod.service not found." when I run this command sudo systemctl start mongod


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I finally installed it by following these steps:

  1. sudo apt-get remove --purge mongodb-org
  2. sudo apt-get autoremove

Then I followed the official docs to re-install and it works fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...