Report this

What is the reason for this report?

How To Install MongoDB version 6.0 on Ubuntu 22.04 (LTS) x64

Posted on December 23, 2022

I follow this https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04. But I got Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). Jave any tutorial for this?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @sittiphansittisak,

Adding a key to /etc/apt/trusted.gpg.d is insecure because it adds the key for all repositories. This is exactly why apt-key had to be deprecated.

If you want to use the key at https://example.com/EXAMPLE.gpg for a repository listed in /etc/apt/sources.list.d/EXAMPLE.list, use:

sudo mkdir -p /etc/apt/keyrings/
wget -O- https://example.com/EXAMPLE.gpg |
    gpg --dearmor |
    sudo tee /etc/apt/keyrings/EXAMPLE.gpg > /dev/null

echo "deb [signed-by=/etc/apt/keyrings/EXAMPLE.gpg] https://example.com/apt stable main" |
    sudo tee /etc/apt/sources.list.d/EXAMPLE.list

I followed that documentation below. It works like charm:

https://techviewleo.com/install-mongodb-on-ubuntu-linux/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.