25

How do I install latest version of mongodb-clients on Ubuntu using apt-get?

apt-get install mongodb-clients only installs version 2.4.9.

1
  • Thanks, I did the steps on the docs already, but the package name is mongodb-org-tools instead of mongodb-clients Commented Sep 1, 2017 at 7:35

5 Answers 5

40

On Ubuntu 16.04 to get the 4.2 mongo client

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

sudo apt-get update
sudo apt-get install mongodb-org-shell
Sign up to request clarification or add additional context in comments.

7 Comments

@alexander ,how to open this tool in ubuntu.I have installed successfully but not able to open it.
@akgola here's a list of all tools included github.com/mongodb/mongo-tools
For Ubuntu 18.04: echo "deb [ arch=amd64 ] repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
@akgola one could start the mongo shell by issuing mongo
Thank you! For ubuntu 20 this worked perfectly well for me: wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - && echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list && sudo apt-get update && sudo apt-get install mongodb-org-shell
|
4

Use official MongoDB Documents they already mentioned how to install a version of your choice. Steps for installation for Ubuntu 12.04 and 14.04

For Ubuntu 16.04 use this

NOTE:- Before that beware that you don't have any existing repository file for MongoDB. You can check using sudo apt-get update.While updating it will show if you have any. If you have then delete it using sudo rm /etc/apt/sources.list.d/mongodb*.list and then install MongoDB

Comments

3

For mongodb 3.2, below packages are supported. In order to use mongo shell, you need to install mongo-org-shell. Choose the right package according to your requreiements.

install mongodb on ubuntu

enter image description here

Comments

1

One could install a mongodb shell on Ubuntu by following these instructions or by using an Ansible like Ansible Galaxy.

At the time of writing, this ansible role installed version 4.2.5 of the mongo shell:

user@some-host:~/some-dir$ mongo --version
MongoDB shell version v4.2.5
git version: x
OpenSSL version: OpenSSL y
allocator: z
modules: none
build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64

Comments

-1

20.04 focal is not setup yet, but you can use the instructions for bionic (18.04) successfully. I did! Ray.

1 Comment

Pasting the instructions and adding a link to the docs might help make this a complete answer, and easier for people coming across this problem in the future

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.