Installation of MongoDb on Ubuntu 22.04

Atlas with Vscode should work.What error are you getting
Check this link

Also check our forum threads for alternative solutions for Mongodb on Ubuntu 20.04

1 Like

Thanks for replying.

The problem is with IP address. It was not whitelisted before. I changed the setting. And now it is working.
Thanks.

Hi!

It will soon be a year since the stable version of ubuntu 22.04 came out and still mongo db does not support it. Please tell me if the developers plan to support mongo db for ubuntu at all? It seems that the developers of mongo db do not care about ubuntu support

1 Like

Related Installing mongodb over Ubuntu 22.04 - #7 by Stennie

The JIRA tickets are completed so it should be possible to install following instructions in that thread.

I don’t know the reasons why it’s not in the docs yet.

I tried and replacing the last MongoDB installation commands for ubuntu 20.04 focal with with jammy installed the program.

Edit: as said above, and by @chris (below) here is the link to instructions. @chaosmos.

Could you point out here exactly how i can now install mongo db on ubuntu 22.04? There are so many different options in the thread you mentioned that it is not clear which one is working and optimal

Also, could you tell me when we should expect an official release with support for ubuntu 22.04? And what is the reason for the fact that for almost a year it is impossible to install mongo db on the most popular Linux distribution in a regular way?

1 Like

@chaosmos please check this recent shorter discussion we had:
How to install mongodb 6.0 on Ubuntu 22.04 - Ops and Admin / Installation & Upgrades - MongoDB Developer Community Forums

“Fast release cycles” of operating systems favor the latest versions of libraries (ubuntu comes every 6 months). unfortunately, “latest” does not always mean proven to be “stable” or easy to migrate. Stability is important for server programs like MongoDB so they have to use battle-tested libraries (even if they may have bugs) hence the delay of support to newer OS versions.

The fortunate thing is older libraries can still be installed and used mostly without any problems if all their dependencies can also be installed. you just need to dive into some settings manually. that is until developers manage to migrate to new libraries, which MongoDB also did but that is not just reflected in documents yet.

Follow the existing instructions. Replace focal with jammy.

Done.

2 Likes

Thank you. This worked perfectly for me.

Hi Chris please I am completely a newbie to MongoDB but I am using ubuntu 22.04, could you help me with the clear steps to install the latest MongoDB

As per @santimir:

The instructions are here

Step 2: Is where focal needs to be replaced withjammy. When you copy and paste that line

So that would become:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
1 Like

Just switch back to ubuntu 20.04 or some fedora or arch. Or learn and use docker instead. because this is only one package(mongoDB). God knows how many more softwares are not supported in 22.04 (They have done many critical upgrades like wayland, libssl1 → libssl3, etc. Wait a year or so for everything get supported in ubuntu 22.04 and based distros( like popos, mint, distros).
Happy coding fella:)

actually, it is not that easy (or complicated, depending on where you look at it) as you describe.

you can use any version of any library (even 30 years old ones) as long as their dependencies do not contradict what the current OS uses, provided they work with the architecture.

Ubuntu 22.x is called “jammy” and installs packages with that name. but you can still install packages from older (bionic, focal, trusty etc.) repositories if you need them. You just need to add their repository url to the apt source list file. the same also goes for independent packages like MongoDB: they have their own repository urls you need to add to apt source list.

Here in this topic, installing MongoDB 6.0 on Ubuntu 22.x, we have two options:

  • add one of older ubuntu repositories to your apt list (then follow remaining steps):

    • echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
  • wait for a new build (which is already here) and use it (@chris mentioned this many times)

    • echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

The first method uses MongoDB built for “ubuntu/focal” and the second one uses “ubuntu/jammy” build. The only thing missing is the official installation page does not yet have this on it.

One can easily see which versions have been built for which ubuntu here: MongoDB Repositories. If you follow “Parent Directory” link, you can even find builds for other Linux distros there.

As you said the mongoDb server uses dependency libss1 which is upgraded to libssl3 in ubuntu 22.04. So I have to install this dependency externally which opens several velnerabilities and result in breaking system. Since there is some point in canonical’s decision to depricate libssl1

1 Like

@mkbhru i am also facing same issue by installing mangodb in raspberrypi4b .please let me know how to resolve the issue

Hello there, I am not sure if I have to open a new thread or just post my issue here, since this is my first time to post. I have the same issue with ubuntu 22.04 regarding the libssl1.1. I manage to install it following other threads,

Blockquote

~$ dpkg -l | grep libssl1.1
ii libssl1.1:amd64 1.1.1f-1ubuntu2 amd64

Blockquote

however when I run this;

Blockquote

$ ldd $(which mongod) | grep libssl
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f8c3b78b000)

Blockquote

it is showing libssl.so.3, does it mean mongodb 4.4 is pointing to libssl3? Is there a way to make sure that mogodb will use the libssl1. Thanks

if you see only 1 line of output, then it most possibly means what you have installed is not 4.4 version. Here is what I get for mongodb 4.4 on a WSL-Ubuntu 22.04:

$ ldd $(which mongod) | grep libssl
libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f8e25ed4000)
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f8e25a03000)

I don’t know what steps/tutorials you have followed, but if you need 4.4 on Ubuntu 22.04, then one easy way is to just follow instruction for Ubuntu 20.04 (focal) on Mongodb 4.4 installation page and, anywhere before actual install step, run the following to be able to get “libssl1.1” from focal’s official repository.

echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list

This works because any linux application can run on any distribution as long as the dependencies can be found and run on the current system. and above command just adds/tells where to find working openssl-1.1

Thank you for your reply. Correct me if I am wrong, once I add this

echo “deb Index of /ubuntu focal-security main” | sudo tee /etc/apt/sources.list.d/focal-security.list

Blockquote
Do I have to do anything to install the libssl1.1? Thanks.

You can use it for any program (or any mongodb version) that needs openssl-1.1 for new Ubuntu versions (as long as they keep compatibility). You execute this command and then follow the instructions to install with sudo apt-get install .... It will know where to look for the libssl1.1

By the way, did you notice what happened to the actual command in your reply? when you add code blocks or commands, add them in backticks, just like you quote “important” things. single ` (or double``) backticks for inline, and triple ```(or quad ````) backticks for blocks.

I will take note of what you said regarding the quotes, sorry. Anyways I finally installed the libssl1.1 and it show now the 2 version of libssl:

ldd $(which mongod) | grep libssl

    libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fc8907e1000)
    libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007fc890310000)

however when I check the status, the service is disable:

systemctl status mongod

× mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Wed 2023-11-29 14:45:48 PST; 1 day 18h ago
I did try stopping it then restarting it, however same error. Any hints? Thank you.

Just continue reading on the same installation page. Enabling and running as a service is explained there. Again on a clean WSL-Ubuntu 22.04, I used “Install a specific release of MongoDB” tab and installed version 4.4.25. All instructions ended up with a finely working instance for me with all the default configurations.

However, this “failed” message suggests to me that you have somehow broken configurations in your previous attempts. Unfortunately, this post is about how we “install” mongodb and it is best to keep it that way. Besides, we have many other posts here on the forums about how you can solve your current problem. I suggest making searches here on the forum first, try reading official documentations, and if you really feel hopeless then open a new post on the forum and at least mark my username starting with an “@” sign.

Alternatively, you can search on how to remove mongodb installation along with all configurations, and then start clean. Both methods need your own actions, so get ready to hands-on learn more troubleshooting methods.