在Debian上安装MongoDB通常有以下两种方法:
sudo apt update && sudo apt upgrade -y。wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -(版本不同,公钥URL可能有差异)。echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/debian $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list。sudo apt update。sudo apt install -y mongodb-org。sudo systemctl start mongod,sudo systemctl enable mongod。sudo systemctl status mongod,mongo --eval 'db.runCommand({ connectionStatus: 1 })'。sudo apt-get install snapd。sudo snap install core。sudo snap install mongodb。sudo systemctl start mongod,sudo systemctl enable mongod。sudo systemctl status mongodb。