Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 11 - Install MongoDB

This tutorial will show you how to install MongoDB 6.x on Debian 11.


Install MongoDB From Repository

sudo apt update && sudo apt install wget gnupg -y \
  && wget -qO - | sudo apt-key add - \
  && echo "deb bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list \
  && sudo apt update \
  && sudo apt install -y mongodb-org mongodb-org-server mongodb-org-database mongodb-org-mongos mongodb-org-shell mongodb-org-tools

Start And Enable MongoDB Service

sudo systemctl start mongod
sudo systemctl enable mongod

Check Version

mongod --version


Illegal instruction - MongoDB Needs AVX CPU Feature

If you get an error saying illegal instruction when running the mongod --version command, then it's quite likely due to your CPU not having AVX instruction support. If this is the case, and you are running a VM through proxmox, then you may just have to go to the virtual machine in question, and change the CPU type to host as shown below (assuming your host CPU has AVX support, which is probably does):


Last updated: 19th July 2023
First published: 9th January 2023