Debian 11 - Install MongoDB
This tutorial will show you how to install MongoDB 6.x on Debian 11.
Steps
Install MongoDB From Repository
sudo apt update && sudo apt install wget gnupg -y \
&& wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian 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
Debugging
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):
References
- LinuxHint - How to install MongoDB on Debian 11
- MongoDB Docs - Install MongoDB Community Edition on Debian
- Debian 8 - Install MongoDB
- Proxmox Forums - AVX2 and AVX flags on VM
- Stack Overflow - Illegal instruction (core dumped) mongodb Ubuntu 20.04 LTS
Last updated: 19th July 2023
First published: 9th January 2023
First published: 9th January 2023