VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04?comment=95165

โ‡ฑ How To Install MongoDB on Ubuntu | DigitalOcean


How To Install MongoDB on Ubuntu

Updated on January 8, 2026
Not using Ubuntu 20.04?
Choose a different version or distribution.
Ubuntu 20.04
๐Ÿ‘ How To Install MongoDB on Ubuntu

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

Tutorial Series: Getting Started With Cloud Computing

This curriculum introduces open-source cloud computing to a general audience along with the skills necessary to deploy applications and websites securely to the cloud.

About the author(s)

๐Ÿ‘ Mark Drake
Mark Drake
Author
Manager, Developer Education
See author profile

Former Technical Writer at DigitalOcean. Focused on SysAdmin topics including Debian 11, Ubuntu 22.04, Ubuntu 20.04, Databases, SQL and PostgreSQL.

๐Ÿ‘ Manikandan Kurup
Manikandan Kurup
Editor
Senior Technical Content Engineer I
See author profile

With over 6 years of experience in tech publishing, Mani has edited and published more than 75 books covering a wide range of data science topics. Known for his strong attention to detail and technical knowledge, Mani specializes in creating clear, concise, and easy-to-understand content tailored for developers.

Still looking for an answer?

Was this helpful?

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!

Thanks for the tutorial, but Iโ€™m stuck!

When I try to run the cURL command to get the key added, I get the following error:

curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead(see apt-key(8)). gpg: no valid OpenPGP data found.

Whatโ€™s weird is, when I run sudo apt-key list, it shows MongoDB 4.4 key has been addedโ€ฆ but when I run sudo apt update, I get an error basically saying thereโ€™s no certificate.

Hi, thanks for your helpful article.

I have used your instructions once and it worked fine. But Iโ€™m doing the same thing in my new server, and surprisingly itโ€™s not working!

after line:

sudo apt update

in step 1, I get the following error:

E: Failed to fetch https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/4.4/InRelease 403 Forbidden [IP: 65.9.58.40 443]
E: The repository 'https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease' is not signed.

The tutorial is okay but after the install I tried to start the mongo service but it failed with the exit-code

I used the following commands to fix it and it worked.

chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
๐Ÿ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOceanโ€™s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

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

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

ยฉ 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.